update hub completion

pull/837/head
MunifTanjim 2016-11-19 03:00:56 +06:00
parent 87a9190a79
commit 25eb084ff7
1 changed files with 9 additions and 4 deletions

View File

@ -1,6 +1,11 @@
# hub tab-completion script for bash. # hub tab-completion script for bash.
# This script complements the completion script that ships with git. # This script complements the completion script that ships with git.
# If there is no git tab completion, but we have the _completion loader try to load it
if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; then
_completion_loader git
fi
# Check that git tab completion is available # Check that git tab completion is available
if declare -F _git > /dev/null; then if declare -F _git > /dev/null; then
# Duplicate and rename the 'list_all_commands' function # Duplicate and rename the 'list_all_commands' function
@ -225,13 +230,13 @@ EOF
fi fi
} }
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] # hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
_git_pull_request() { _git_pull_request() {
local i c=2 flags="-f -m -F -i -b -h" local i c=2 flags="-f -m -F -i -b -h -a -M -l"
while [ $c -lt $cword ]; do while [ $c -lt $cword ]; do
i="${words[c]}" i="${words[c]}"
case "$i" in case "$i" in
-m|-F|-i|-b|-h) -m|-F|-i|-b|-h|-a|-M|-l)
((c++)) ((c++))
flags=${flags/$i/} flags=${flags/$i/}
;; ;;
@ -245,7 +250,7 @@ EOF
-i) -i)
COMPREPLY=() COMPREPLY=()
;; ;;
-b|-h) -b|-h|-a|-M|-l)
# (Doesn't seem to need this...) # (Doesn't seem to need this...)
# Uncomment the following line when 'owner/repo:[TAB]' misbehaved # Uncomment the following line when 'owner/repo:[TAB]' misbehaved
#_get_comp_words_by_ref -n : cur #_get_comp_words_by_ref -n : cur