From 6c09f2a45c5541e9c207d14fc7aa21a4a0066bde Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:03:19 +0200 Subject: Merging upstream version 1:2.12.0. Signed-off-by: Daniel Baumann --- completions/p4 | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'completions/p4') 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 -_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 -- cgit v1.2.3