All pastes #732370 Raw Edit

Mine

public text v1 · immutable
·published 2007-10-10 22:19 UTC
rendered paste body
_svnlook()
{
        local cur prev commands options mode

        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}

        commands='author cat changed date diff dirs-changed help ? h history \
                info lock log propget pget pg proplist plist pl tree uuid \
                youngest'

        if [[ $COMP_CWORD -eq 1 ]] ; then
                if [[ "$cur" == -* ]]; then
                        COMPREPLY=( $( compgen -W '--version' -- $cur ) )
                else
                        COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
                fi
        else
                command=${COMP_WORDS[1]}

                if [[ "$cur" == -* ]]; then
                        # possible options for the command
                        case $command in
                                @(author|cat|date|dirs-changed|info|log))
                                        options='-r --revision -t \
                                                --transaction'
                                        ;;
                                changed)
                                        options='-r --revision -t \
                                                --transaction --copy-info'
                                        ;;
                                diff)
                                        options='-r --revision -t \
                                                --transaction \
                                                --no-diff-deleted \
                                                --no-diff-added \
                                                --diff-copy-from'
                                        ;;
                                history)
                                        options='-r --revision --show-ids'
                                        ;;
                                prop@(get|list))
                                        options='-r --revision -t \
                                                --transaction --revprop'
                                        ;;
                                tree)
                                        options='-r --revision -t \
                                                --transaction --show-ids \
                                                --full-paths'
                                        ;;
                        esac

                        options="$options --help -h"
                        COMPREPLY=( $( compgen -W "$options" -- $cur ) )
                else
                        if [[ "$command" == @(help|h|\?) ]]; then
                                COMPREPLY=( $( compgen -W "$commands" -- $cur ) )
                        else
                                _filedir
                        fi
                fi
        fi

        return 0
}
complete -F _svnlook $default svnlook
}