提交 1cd31ae8 编写于 作者: S Siôn le Roux

Add --remote-name flag to bash completion for git fork

Instead of adding more if statements I swapped the remote=yes variable
for a list of available flags which we drop elements from on each
completion.  This is based on the logic in git create above.

Fixes #2108.
上级 6faa8a8b
...@@ -218,21 +218,19 @@ EOF ...@@ -218,21 +218,19 @@ EOF
esac esac
} }
# hub fork [--no-remote] # hub fork [--no-remote] [--remote-name]
_git_fork() { _git_fork() {
local i c=2 remote=yes local i c=2 flags="--no-remote --remote-name"
while [ $c -lt $cword ]; do while [ $c -lt $cword ]; do
i="${words[c]}" i="${words[c]}"
case "$i" in case "$i" in
--no-remote) --no-remote|--remote-name)
unset remote flags=${flags/$i/}
;; ;;
esac esac
((c++)) ((c++))
done done
if [ -n "$remote" ]; then __gitcomp "$flags"
__gitcomp "--no-remote"
fi
} }
# hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>] # hub pull-request [-f] [-m <MESSAGE>|-F <FILE>|-i <ISSUE>|<ISSUE-URL>] [-b <BASE>] [-h <HEAD>] [-a <USER>] [-M <MILESTONE>] [-l <LABELS>]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册