1
0
Fork 0
mirror of https://we.phorge.it/source/arcanist.git synced 2024-12-01 19:22:41 +01:00
phorge-arcanist/resources/shell/bash-completion
epriestley 4818892841 Basic 'shell-complete' workflow.
Summary:
Adds data-driven shell completion help to arcanist.

Test Plan:
ran various commands in git and svn working copies,
output seemed reasonable

Differential Revision: 201754
Reviewed By: adonohue
Reviewers: mroch, adonohue
Commenters: crackerjack
CC: epriestley, adonohue, achao
Revert Plan:
OK
2011-01-17 20:18:27 -08:00

24 lines
420 B
Text

_arc()
{
CUR="${COMP_WORDS[COMP_CWORD]}"
COMPREPLY=()
OPTS=$(arc shell-complete --current ${COMP_CWORD} -- ${COMP_WORDS[@]})
if [ $? -ne 0 ]; then
return $?
fi
if [ "$OPTS" = "FILE" ]; then
COMPREPLY=( $(compgen -f -- ${CUR}) )
return 0
fi
if [ "$OPTS" = "ARGUMENT" ]; then
return 0
fi
COMPREPLY=( $(compgen -W "${OPTS}" -- ${CUR}) )
}
complete -F _arc -o filenames arc