# svk(1) completion -*- shell-script -*- proc _svk { local cur prev words cword _init_completion || return local commands options command setglobal commands = ''add admin annotate ann blame praise cat checkout co cleanup cmerge cm commit ci copy cp delete del remove rm depotmap depot describe desc diff di help h ? import info list ls log merge mirror mi mkdir move mv ren rename patch propdel pd pdel propedit pe pedit propget pg pget proplist pl plist propset ps pset pull push resolved revert smerge sm status st stat switch sw sync sy update up verify'' if [[ $cword -eq 1 ]] { if [[ "$cur" == -* ]] { setglobal COMPREPLY = ''( $( compgen -W '--version' -- "$cur" ) ) } else { setglobal COMPREPLY = ''( $( compgen -W "$commands" -- "$cur" ) ) } } else { match $prev { with -F|--file|--targets _filedir return 0 with --encoding setglobal COMPREPLY = ''( $( compgen -W \ '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) ) return 0 } setglobal command = $(words[1]) if [[ "$cur" == -* ]] { # possible options for the command match $command { with add setglobal options = '' --non-recursive -N -q --quiet'' with blame|annotate|ann|praise setglobal options = ''-r --revisions -x --cross'' with cat setglobal options = ''-r --revision'' with checkout|co setglobal options = ''-r --revision -q --quiet -N --non-recursive -l --list -d --detach --export --relocate --purge'' with cleanup setglobal options = ''-a --all'' with cmerge|cm setglobal options = ''-c --change -l --log -r --revision -a --auto --verbatim --no-ticket -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with commit|ci setglobal options = ''--import -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only -N --non-recursive --direct'' with copy|cp setglobal options = ''-r --revision -p --parent -q --quiet -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with delete|del|remove|rm setglobal options = ''-k --keep-local -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only --direct'' with depotmap|depot setglobal options = ''-i --init -l --list -d --detach --relocate'' with diff|di setglobal options = ''-r --revision -s --summarize -b --verbose -N --non-recursive'' with import setglobal options = ''-f --from-checkout -t --to-checkout -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only -N --non-recursive --direct'' with list|ls setglobal options = ''-r --revision -v --verbose -R --recursive -d --depth -f --full-path'' with log setglobal options = ''-r --revision -l --limit -q --quiet -x --cross -v --verbose'' with merge setglobal options = ''-r --revision -c --change -I --incremental -a --auto -l --log -s --sync -t --to -f --from --verbatim --no-ticket --track-rename -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with mirror|mi setglobal options = ''-l --list -d --detach --relocate --recover --unlock --upgrade'' with mkdir setglobal options = ''-p --parent -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with move|mv|rename|ren setglobal options = ''-r --revision -p --parent -q --quiet -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only --direct'' with patch setglobal options = ''--depot'' with propdel|propset|pdel|pset|pd|ps setglobal options = ''-R --recursive -r --revision --revprop -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only -q --quiet --direct'' with propedit|pedit|pe setglobal options = ''-R --recursive -r --revision --revprop -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with propget|pget|pg setglobal options = ''-R --recursive -r --revision --revprop --strict'' with proplist|plist|pl setglobal options = ''-R --recursive -v --verbose -r --revision --revprop'' with pull setglobal options = ''-a --all -l --lump'' with push setglobal options = ''-f --from -l --lump -C --check -P --patch -S --sign --verbatim'' with resolved setglobal options = ''-R --recursive'' with revert setglobal options = ''-R --recursive -q --quiet'' with smerge|sm setglobal options = ''-I --incremental -l --log -B --baseless -b --base -s --sync -t --to -f --from --verbatim --no-ticket --track-rename --host --remoterev -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with status|stat|st setglobal options = ''-q --quiet --no-ignore -N --non-recursive -v --verbose'' with switch|sw setglobal options = ''-r --revision -d --detach -q --quiet'' with sync|sy setglobal options = ''-a --all -s --skipto -t --torev'' with update|up setglobal options = ''-r --revision -N --non-recursive -C --check-only -s --sync -m --merge -q --quiet'' } setglobal options = '" --help -h'" setglobal COMPREPLY = ''( $( compgen -W "$options" -- "$cur" ) ) } else { match $command { with help|h|\? setglobal COMPREPLY = ''( $( compgen -W "$commands environment commands intro" -- "$cur" ) ) with admin setglobal COMPREPLY = ''( $( compgen -W 'help deltify dump hotcopy list-dblogs list-unused-dblogs load lstxns recover rmtxns setlog verify rmcache' -- "$cur" ) ) with patch setglobal COMPREPLY = ''( $( compgen -W '--ls --list --cat --view --regen --regenerate --up --update --apply --rm --delete' -- "$cur" ) ) with sync setglobal COMPREPLY = ''( $( compgen -W "$( $1 mirror --list \ 2>/dev/null | awk '/^\//{print $1}' )" -- "$cur" ) ) with co|checkout|push|pull if [[ "$cur" == //*/* ]] { setglobal path = "$(cur%/*)/" } else { setglobal path = '//' } setglobal COMPREPLY = ''( $( compgen -W "$( $1 list $path 2>/dev/null | \ sed -e 's|\(.*\)|'$path'\1|')" -- "$cur" ) ) with * _filedir } } } return 0 } && complete -F _svk svk # ex: ts=4 sw=4 et filetype=sh