Skip to content

Commit 7e83598

Browse files
committed
Update completion scripts.
1 parent d3f30fa commit 7e83598

File tree

2 files changed

+20
-11
lines changed

2 files changed

+20
-11
lines changed

etc/gh.bash_completion.sh

+18-11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ create
1717
browse
1818
compare
1919
ci-status
20+
release
21+
issue
2022
EOF
2123
__git_list_all_commands_without_hub
2224
}
@@ -54,11 +56,10 @@ EOF
5456
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
5557
_git_browse() {
5658
local i c=2 u=-u repo subpage
57-
local -A subpages
58-
subpages["/"]="commits issues tree wiki pulls branches stargazers
59+
local subpages_="commits issues tree wiki pulls branches stargazers
5960
contributors network network/ graphs graphs/"
60-
subpages["/network"]="members"
61-
subpages["/graphs"]="commit-activity code-frequency punch-card"
61+
local subpages_network="members"
62+
local subpages_graphs="commit-activity code-frequency punch-card"
6263
while [ $c -lt $cword ]; do
6364
i="${words[c]}"
6465
case "$i" in
@@ -81,10 +82,11 @@ EOF
8182
case "$cur" in
8283
*/*)
8384
local pfx="${cur%/*}" cur_="${cur#*/}"
84-
__gitcomp "${subpages[/$pfx]}" "$pfx/" "$cur_"
85+
local subpages_var="subpages_$pfx"
86+
__gitcomp "${!subpages_var}" "$pfx/" "$cur_"
8587
;;
8688
*)
87-
__gitcomp "$u ${subpages[/]}"
89+
__gitcomp "$u ${subpages_}"
8890
;;
8991
esac
9092
else
@@ -184,8 +186,9 @@ EOF
184186
case "$i" in
185187
-d|-h)
186188
((c++))
187-
;;&
188-
-p|-d|-h)
189+
flags=${flags/$i/}
190+
;;
191+
-p)
189192
flags=${flags/$i/}
190193
;;
191194
*)
@@ -232,8 +235,9 @@ EOF
232235
case "$i" in
233236
-m|-F|-i|-b|-h)
234237
((c++))
235-
;;&
236-
-f|-m|-F|-i|-b|-h)
238+
flags=${flags/$i/}
239+
;;
240+
-f)
237241
flags=${flags/$i/}
238242
;;
239243
esac
@@ -248,7 +252,10 @@ EOF
248252
# Uncomment the following line when 'owner/repo:[TAB]' misbehaved
249253
#_get_comp_words_by_ref -n : cur
250254
__gitcomp_nl "$(__hub_heads)"
251-
__ltrim_colon_completions "$cur"
255+
# __ltrim_colon_completions "$cur"
256+
;;
257+
-F)
258+
COMPREPLY=( "$cur"* )
252259
;;
253260
-f|*)
254261
__gitcomp "$flags"

etc/gh.zsh_completion

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ create
112112
browse
113113
compare
114114
ci-status
115+
release
116+
issue
115117
EOF
116118
__git_list_all_commands_without_hub
117119
}

0 commit comments

Comments
 (0)