Skip to content

Commit 2fc4118

Browse files
author
David Calavera
committed
Merge pull request #147 from jingweno/update_completions
Update completion scripts.
2 parents d3f30fa + e86eea1 commit 2fc4118

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

etc/gh.bash_completion.sh

+19-11
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ create
1717
browse
1818
compare
1919
ci-status
20+
release
21+
issue
22+
update
2023
EOF
2124
__git_list_all_commands_without_hub
2225
}
@@ -54,11 +57,10 @@ EOF
5457
# hub browse [-u] [--|[USER/]REPOSITORY] [SUBPAGE]
5558
_git_browse() {
5659
local i c=2 u=-u repo subpage
57-
local -A subpages
58-
subpages["/"]="commits issues tree wiki pulls branches stargazers
60+
local subpages_="commits issues tree wiki pulls branches stargazers
5961
contributors network network/ graphs graphs/"
60-
subpages["/network"]="members"
61-
subpages["/graphs"]="commit-activity code-frequency punch-card"
62+
local subpages_network="members"
63+
local subpages_graphs="commit-activity code-frequency punch-card"
6264
while [ $c -lt $cword ]; do
6365
i="${words[c]}"
6466
case "$i" in
@@ -81,10 +83,11 @@ EOF
8183
case "$cur" in
8284
*/*)
8385
local pfx="${cur%/*}" cur_="${cur#*/}"
84-
__gitcomp "${subpages[/$pfx]}" "$pfx/" "$cur_"
86+
local subpages_var="subpages_$pfx"
87+
__gitcomp "${!subpages_var}" "$pfx/" "$cur_"
8588
;;
8689
*)
87-
__gitcomp "$u ${subpages[/]}"
90+
__gitcomp "$u ${subpages_}"
8891
;;
8992
esac
9093
else
@@ -184,8 +187,9 @@ EOF
184187
case "$i" in
185188
-d|-h)
186189
((c++))
187-
;;&
188-
-p|-d|-h)
190+
flags=${flags/$i/}
191+
;;
192+
-p)
189193
flags=${flags/$i/}
190194
;;
191195
*)
@@ -232,8 +236,9 @@ EOF
232236
case "$i" in
233237
-m|-F|-i|-b|-h)
234238
((c++))
235-
;;&
236-
-f|-m|-F|-i|-b|-h)
239+
flags=${flags/$i/}
240+
;;
241+
-f)
237242
flags=${flags/$i/}
238243
;;
239244
esac
@@ -248,7 +253,10 @@ EOF
248253
# Uncomment the following line when 'owner/repo:[TAB]' misbehaved
249254
#_get_comp_words_by_ref -n : cur
250255
__gitcomp_nl "$(__hub_heads)"
251-
__ltrim_colon_completions "$cur"
256+
# __ltrim_colon_completions "$cur"
257+
;;
258+
-F)
259+
COMPREPLY=( "$cur"* )
252260
;;
253261
-f|*)
254262
__gitcomp "$flags"

etc/gh.zsh_completion

+3
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ create
112112
browse
113113
compare
114114
ci-status
115+
release
116+
issue
117+
update
115118
EOF
116119
__git_list_all_commands_without_hub
117120
}

0 commit comments

Comments
 (0)