_p4()
{
local cur prev p4cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
p4cmds=$(p4 help commands | awk '{print $1}')
case "${prev}" in
-u)
COMPREPLY=( $(compgen -W "$(p4 users | awk '{print $1}')" ${cur}) )
return 0
;;
-c)
COMPREPLY=( $(compgen -W "$(p4 clients | awk '{print $2}')" ${cur}) )
return 0
;;
*)
COMPREPLY=( $(compgen -W "${p4cmds}" ${cur}) )
return 0
;;
esac
}
complete -F _p4 p4
# |
Change |
User |
Description |
Committed |
|
#1
|
9132 |
Liz Lam |
Initial add of simple p4 bash completion script. |
|
|