mirror of
https://we.phorge.it/source/arcanist.git
synced 2024-11-29 02:02:40 +01:00
4818892841
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
24 lines
420 B
Text
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
|