Plugin,Arcanist: Add completion for the Arcanist plugin
Copied from the Arcanist source tree: https://github.com/phacility/arcanist/blob/master/resources/shell/bash-completion
This commit is contained in:
parent
291e96dcd0
commit
182671929a
@ -19,3 +19,32 @@ alias arl='arc land'
|
||||
alias arli='arc lint'
|
||||
alias arls='arc list'
|
||||
alias arpa='arc patch'
|
||||
|
||||
#
|
||||
# Completion
|
||||
#
|
||||
|
||||
autoload -U +X bashcompinit && bashcompinit
|
||||
|
||||
_arc ()
|
||||
{
|
||||
CUR="${COMP_WORDS[COMP_CWORD]}"
|
||||
COMPREPLY=()
|
||||
OPTS=$(echo | 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
|
||||
|
Loading…
Reference in New Issue
Block a user