diff options
Diffstat (limited to 'completions/p4')
-rw-r--r-- | completions/p4 | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/completions/p4 b/completions/p4 index ed5f20c..5bcadf6 100644 --- a/completions/p4 +++ b/completions/p4 @@ -1,30 +1,29 @@ # Perforce completion -*- shell-script -*- # by Frank Cusack <frank@google.com> -_p4() +_comp_cmd_p4() { - local cur prev words cword - _init_completion || return + local cur prev words cword comp_args + _comp_initialize -- "$@" || return local p4commands p4filetypes # rename isn't really a command - p4commands="$(p4 help commands 2>/dev/null | awk 'NF>3 {print $1}')" + p4commands="$(p4 help commands 2>/dev/null | _comp_awk 'NF>3 {print $1}')" p4filetypes="ctext cxtext ktext kxtext ltext tempobj ubinary \ uresource uxbinary xbinary xltext xtempobj xtext \ text binary resource" if ((cword == 1)); then - COMPREPLY=($(compgen -W "$p4commands" -- "$cur")) + _comp_compgen -- -W "$p4commands" elif ((cword == 2)); then case $prev in help) - COMPREPLY=($(compgen -W "simple commands environment - filetypes jobview revisions usage views $p4commands" \ - -- "$cur")) + _comp_compgen -- -W "simple commands environment filetypes + jobview revisions usage views $p4commands" ;; admin) - COMPREPLY=($(compgen -W "checkpoint stop" -- "$cur")) + _comp_compgen -- -W "checkpoint stop" ;; *) ;; @@ -34,7 +33,7 @@ _p4() -t) case ${words[cword - 2]} in add | edit | reopen) - COMPREPLY=($(compgen -W "$p4filetypes" -- "$cur")) + _comp_compgen -- -W "$p4filetypes" ;; *) ;; @@ -46,6 +45,6 @@ _p4() fi } && - complete -F _p4 -o default p4 g4 + complete -F _comp_cmd_p4 -o default p4 g4 # ex: filetype=sh |