1 | #compdef hophop
|
2 |
|
3 | local -a _commands
|
4 | _commands=(
|
5 | 'gh:GitHub workflow commands'
|
6 | )
|
7 |
|
8 | local -a _gh_commands
|
9 | _gh_commands=(
|
10 | 'feature:create a local branch referencing an open issue'
|
11 | 'pr:push the current feature branch and, if needed, open a pull request'
|
12 | 'commit:create a commit that closes an open issue'
|
13 | 'setup:setup GitHub API token'
|
14 | )
|
15 |
|
16 | local -a _gh_feature_commands
|
17 | _gh_feature_commands=(
|
18 | 'create:create a new issue for a feature'
|
19 | )
|
20 |
|
21 | _arguments '*:: :->command'
|
22 |
|
23 | if (( CURRENT == 1 )); then
|
24 | _describe -t commands 'hophop command' _commands
|
25 | return
|
26 | fi
|
27 |
|
28 | if (( CURRENT == 2 )); then
|
29 | case "$words[1]" in
|
30 | gh)
|
31 | _describe 'gh command' _gh_commands ;;
|
32 | esac
|
33 | fi
|
34 |
|
35 | if (( CURRENT == 3 )); then
|
36 | case "$words[2]" in
|
37 | feature)
|
38 | _describe 'gh feature command' _gh_feature_commands ;;
|
39 | esac
|
40 | fi
|