7712da89ee841f4773d0158370174200813169e1
- Author
- Marc Cornellà <marc.cornella@live.com>
- Committer
- Marc Cornellà <marc.cornella@live.com>
- Date
Message
Diff
This diff is truncated to protect this page.
1diff --git a/lib/cli.zsh b/lib/cli.zsh
2index e8ce261313a5ddeed3bf1ec0250b7fc384e34074..253c554c12017b7c776a693304b707c5bc104490 100644
3--- a/lib/cli.zsh
4+++ b/lib/cli.zsh
5@@ -20,53 +20,43 @@ function omz {
6 }
7
8 function _omz {
9- local -a cmds subcmds
10- cmds=(
11- 'help:Usage information'
12- 'plugin:Commands for Oh My Zsh plugins management'
13- 'pr:Commands for Oh My Zsh Pull Requests management'
14- 'theme:Commands for Oh My Zsh themes management'
15- 'update:Update Oh My Zsh'
16- )
17-
18- if (( CURRENT == 2 )); then
19- _describe 'command' cmds
20- elif (( CURRENT == 3 )); then
21- case "$words[2]" in
22- plugin) subcmds=('list:List plugins')
23- _describe 'command' subcmds ;;
24- pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches')
25- _describe 'command' subcmds ;;
26- theme) subcmds=('use:Load a theme' 'list:List themes')
27- _describe 'command' subcmds ;;
28- esac
29- elif (( CURRENT == 4 )); then
30- case "$words[2]::$words[3]" in
31- theme::use) compadd "$ZSH"/themes/*.zsh-theme(.N:t:r) \
32- "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;;
33- esac
34- fi
35+ local -a cmds subcmds
36+ cmds=(
37+ 'changelog:Print the changelog'
38+ 'help:Usage information'
39+ 'plugin:Manage plugins'
40+ 'pr:Manage Oh My Zsh Pull Requests'
41+ 'theme:Manage themes'
42+ 'update:Update Oh My Zsh'
43+ )
44
45- return 0
46+ if (( CURRENT == 2 )); then
47+ _describe 'command' cmds
48+ elif (( CURRENT == 3 )); then
49+ case "$words[2]" in
50+ changelog) local -a refs
51+ refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
52+ _describe 'command' refs ;;
53+ plugin) subcmds=('list:List plugins')
54+ _describe 'command' subcmds ;;
55+ pr) subcmds=('test:Test a Pull Request' 'clean:Delete all Pull Request branches')
56+ _describe 'command' subcmds ;;
57+ theme) subcmds=('use:Load a theme' 'list:List themes')
58+ _describe 'command' subcmds ;;
59+ esac
60+ elif (( CURRENT == 4 )); then
61+ case "$words[2]::$words[3]" in
62+ theme::use) compadd "$ZSH"/themes/*.zsh-theme(.N:t:r) \
63+ "$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;;
64+ esac
65+ fi
66+
67+ return 0
68 }
69
70 compdef _omz omz
71
72-
73-function _omz::help {
74- cat <<EOF
75-Usage: omz <command> [options]
76-
77-Available commands:
78-
79- help Print this help message
80- plugin <command> Manage plugins
81- pr <command> Manage Oh My Zsh Pull Requests
82- theme <command> Manage themes
83- update Update Oh My Zsh
84-
85-EOF
86-}
87+## Utility functions
88
89 function _omz::confirm {
90 # If question supplied, ask it before reading the answer
91@@ -111,6 +101,41 @@ function _omz::log {
92 esac >&2
93 }
94
95+## User-facing commands
96+
97+function _omz::help {
98+ cat <<EOF
99+Usage: omz <command> [options]
100+
101+Available commands:
102+
103+ help Print this help message
104+ changelog Print the changelog