Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
7712da89
Commit
7712da89
authored
Nov 04, 2020
by
Marc Cornellà
Browse files
feat(CLI): add `omz changelog` command
parent
eeab4e51
Changes
1
Show whitespace changes
Inline
Side-by-side
lib/cli.zsh
View file @
7712da89
...
@@ -22,10 +22,11 @@ function omz {
...
@@ -22,10 +22,11 @@ function omz {
function
_omz
{
function
_omz
{
local
-a
cmds subcmds
local
-a
cmds subcmds
cmds
=(
cmds
=(
'changelog:Print the changelog'
'help:Usage information'
'help:Usage information'
'plugin:
Commands for Oh My Zsh plugins management
'
'plugin:
Manage plugins
'
'pr:
Commands for
Oh My Zsh Pull Requests
management
'
'pr:
Manage
Oh My Zsh Pull Requests'
'theme:
Commands for Oh My Zsh themes management
'
'theme:
Manage themes
'
'update:Update Oh My Zsh'
'update:Update Oh My Zsh'
)
)
...
@@ -33,6 +34,9 @@ function _omz {
...
@@ -33,6 +34,9 @@ function _omz {
_describe
'command'
cmds
_describe
'command'
cmds
elif
((
CURRENT
==
3
))
;
then
elif
((
CURRENT
==
3
))
;
then
case
"
$words
[2]"
in
case
"
$words
[2]"
in
changelog
)
local
-a
refs
refs
=(
"
${
(@f)
$(
command
git
for
-each-ref
--format
=
"%(refname:short):%(subject)"
refs/heads refs/tags
)
}
"
)
_describe
'command'
refs
;;
plugin
)
subcmds
=(
'list:List plugins'
)
plugin
)
subcmds
=(
'list:List plugins'
)
_describe
'command'
subcmds
;;
_describe
'command'
subcmds
;;
pr
)
subcmds
=(
'test:Test a Pull Request'
'clean:Delete all Pull Request branches'
)
pr
)
subcmds
=(
'test:Test a Pull Request'
'clean:Delete all Pull Request branches'
)
...
@@ -52,21 +56,7 @@ function _omz {
...
@@ -52,21 +56,7 @@ function _omz {
compdef _omz omz
compdef _omz omz
## Utility functions
function
_omz::help
{
cat
<<
EOF
Usage: omz <command> [options]
Available commands:
help Print this help message
plugin <command> Manage plugins
pr <command> Manage Oh My Zsh Pull Requests
theme <command> Manage themes
update Update Oh My Zsh
EOF
}
function
_omz::confirm
{
function
_omz::confirm
{
# If question supplied, ask it before reading the answer
# If question supplied, ask it before reading the answer
...
@@ -111,6 +101,41 @@ function _omz::log {
...
@@ -111,6 +101,41 @@ function _omz::log {
esac
>
&2
esac
>
&2
}
}
## User-facing commands
function
_omz::help
{
cat
<<
EOF
Usage: omz <command> [options]
Available commands:
help Print this help message
changelog Print the changelog
plugin <command> Manage plugins
pr <command> Manage Oh My Zsh Pull Requests
theme <command> Manage themes
update Update Oh My Zsh
EOF
}
function
_omz::changelog
{
local
version
=
${
1
:-
HEAD
}
format
=
${
3
:-
"--text"
}
if
!
command
git
-C
"
$ZSH
"
show-ref
--verify
refs/heads/
$version
&>/dev/null
&&
\
!
command
git
-C
"
$ZSH
"
show-ref
--verify
refs/tags/
$version
&>/dev/null
&&
\
!
command
git
-C
"
$ZSH
"
rev-parse
--verify
"
${
version
}
^{commit}"
&>/dev/null
;
then
cat
<<
EOF
Usage: omz changelog [version]
NOTE: <version> must be a valid branch, tag or commit.
EOF
return
1
fi
"
$ZSH
/tools/changelog.sh"
"
$version
"
"
${
2
:-}
"
"
$format
"
}
function
_omz::plugin
{
function
_omz::plugin
{
((
$#
>
0
&&
$+
functions[_omz::plugin::
$1
]
))
||
{
((
$#
>
0
&&
$+
functions[_omz::plugin::
$1
]
))
||
{
cat
<<
EOF
cat
<<
EOF
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment