Created
April 1, 2014 15:41
-
-
Save zachwhaley/9916754 to your computer and use it in GitHub Desktop.
perforce bash completion
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function _p4() | |
{ | |
local cmds='add annotate attribute branch branches change changes changelist changelists client clients copy | |
counter counters cstat delete depot depots describe diff diff2 dirs edit filelog files fix fixes flush fstat grep | |
group groups have help info integrate integrated interchanges istat job jobs key keys label labels labelsync list | |
lock logger login logout merge move open opened passwd populate print protect protects reconcile rename reopen | |
resolve resolved revert review reviews set shelve status sizes stream streams submit sync tag tickets unlock | |
unshelve update user users where workspace workspaces' | |
if [ ${COMP_CWORD} -eq 1 ]; then | |
COMPREPLY=( $(compgen -W '${cmds}' -- ${COMP_WORDS[1]}) ) | |
elif [[ ${COMP_CWORD} -eq 2 && ${COMP_WORDS[1]} = 'help' ]]; then | |
COMPREPLY=( $(compgen -W '${cmds}' -- ${COMP_WORDS[2]}) ) | |
else | |
COMPREPLY=( $(compgen -f ${COMP_WORDS[${COMP_CWORD}]}) ) | |
fi | |
} | |
complete -o filenames -o bashdefault -F _p4 p4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I moved this to an actual repo https://github.com/zachwhaley/p4-completion