# svk(1) completion -*- shell-script -*- proc _svk { var cur = '', prev = '', words = '', cword = '' _init_completion || return var commands = '', options = '', command = '' set 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 } set command = $(words[1]) if [[ "$cur" == -* ]] { # possible options for the command match $command { with add set options = '' --non-recursive -N -q --quiet'' with blame|annotate|ann|praise set options = ''-r --revisions -x --cross'' with cat set options = ''-r --revision'' with checkout|co set options = ''-r --revision -q --quiet -N --non-recursive -l --list -d --detach --export --relocate --purge'' with cleanup set options = ''-a --all'' with cmerge|cm set 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 set options = ''--import -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only -N --non-recursive --direct'' with copy|cp set 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 set options = ''-k --keep-local -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only --direct'' with depotmap|depot set options = ''-i --init -l --list -d --detach --relocate'' with diff|di set options = ''-r --revision -s --summarize -b --verbose -N --non-recursive'' with import set 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 set options = ''-r --revision -v --verbose -R --recursive -d --depth -f --full-path'' with log set options = ''-r --revision -l --limit -q --quiet -x --cross -v --verbose'' with merge set 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 set options = ''-l --list -d --detach --relocate --recover --unlock --upgrade'' with mkdir set options = ''-p --parent -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with move|mv|rename|ren set options = ''-r --revision -p --parent -q --quiet -m --message -F --file --encoding --template -P --patch -S --sign -C --check-only --direct'' with patch set options = ''--depot'' with propdel|propset|pdel|pset|pd|ps set 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 set options = ''-R --recursive -r --revision --revprop -m --message -F --file --template --encoding -P --patch -S --sign -C --check-only --direct'' with propget|pget|pg set options = ''-R --recursive -r --revision --revprop --strict'' with proplist|plist|pl set options = ''-R --recursive -v --verbose -r --revision --revprop'' with pull set options = ''-a --all -l --lump'' with push set options = ''-f --from -l --lump -C --check -P --patch -S --sign --verbatim'' with resolved set options = ''-R --recursive'' with revert set options = ''-R --recursive -q --quiet'' with smerge|sm set 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 set options = ''-q --quiet --no-ignore -N --non-recursive -v --verbose'' with switch|sw set options = ''-r --revision -d --detach -q --quiet'' with sync|sy set options = ''-a --all -s --skipto -t --torev'' with update|up set options = ''-r --revision -N --non-recursive -C --check-only -s --sync -m --merge -q --quiet'' } set 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