1 | #compdef hophop
|
2 |
|
3 | local -a _commands
|
4 | _commands=(
|
5 | 'gh:GitHub workflow commands'
|
6 | 'toggl:Toggl time tracker commands'
|
7 | )
|
8 |
|
9 | local -a _toggl_commands
|
10 | _toggl_commands=(
|
11 | 'start:start time tracking for the current issue'
|
12 | 'misc:start time tracking for generic task'
|
13 | 'test:start time tracking for test task'
|
14 | 'stop:stop time tracking'
|
15 | 'setup:setup Toggl API token'
|
16 | 'install-hooks:install git hooks'
|
17 | )
|
18 |
|
19 | local -a _gh_commands
|
20 | _gh_commands=(
|
21 | 'feature:create a local branch referencing an open issue'
|
22 | 'pr:push the current feature branch and, if needed, open a pull request'
|
23 | 'commit:create a commit that closes an open issue'
|
24 | 'setup:setup GitHub API token'
|
25 | )
|
26 |
|
27 | local -a _gh_feature_commands
|
28 | _gh_feature_commands=(
|
29 | 'create:create a new issue for a feature'
|
30 | )
|
31 |
|
32 | _arguments '*:: :->command'
|
33 |
|
34 | if (( CURRENT == 1 )); then
|
35 | _describe -t commands 'hophop command' _commands
|
36 | return
|
37 | fi
|
38 |
|
39 | if (( CURRENT == 2 )); then
|
40 | case "$words[1]" in
|
41 | gh)
|
42 | _describe 'gh command' _gh_commands ;;
|
43 | toggl)
|
44 | _describe 'toggl command' _toggl_commands ;;
|
45 | esac
|
46 | fi
|
47 |
|
48 | if (( CURRENT == 3 )); then
|
49 | case "$words[2]" in
|
50 | feature)
|
51 | _describe 'gh feature command' _gh_feature_commands ;;
|
52 | esac
|
53 | fi
|