Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
github
oh-my-zsh
Commits
567bd593
Unverified
Commit
567bd593
authored
Jan 17, 2022
by
Marc Cornellà
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(cli): use self-referencing in subcommand functions
parent
1e277553
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
17 deletions
+17
-17
cli.zsh
lib/cli.zsh
+17
-17
No files found.
lib/cli.zsh
View file @
567bd593
...
@@ -182,7 +182,7 @@ function _omz::changelog {
...
@@ -182,7 +182,7 @@ function _omz::changelog {
!
command
git rev-parse
--verify
"
${
version
}
^{commit}"
!
command
git rev-parse
--verify
"
${
version
}
^{commit}"
)
&>/dev/null
;
then
)
&>/dev/null
;
then
cat
>
&2
<<
EOF
cat
>
&2
<<
EOF
Usage:
omz changelog
[version]
Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
[version]
NOTE: <version> must be a valid branch, tag or commit.
NOTE: <version> must be a valid branch, tag or commit.
EOF
EOF
...
@@ -193,9 +193,9 @@ EOF
...
@@ -193,9 +193,9 @@ EOF
}
}
function
_omz::plugin
{
function
_omz::plugin
{
((
$#
>
0
&&
$+
functions[
_omz::plugin
::
$1
]
))
||
{
((
$#
>
0
&&
$+
functions[
$0
::
$1
]
))
||
{
cat
>
&2
<<
EOF
cat
>
&2
<<
EOF
Usage:
omz plugin
<command> [options]
Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<command> [options]
Available commands:
Available commands:
...
@@ -212,12 +212,12 @@ EOF
...
@@ -212,12 +212,12 @@ EOF
local command
=
"
$1
"
local command
=
"
$1
"
shift
shift
_omz::plugin
::
$command
"
$@
"
$0
::
$command
"
$@
"
}
}
function
_omz::plugin::disable
{
function
_omz::plugin::disable
{
if
[[
-z
"
$1
"
]]
;
then
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage:
omz plugin disable
<plugin> [...]"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<plugin> [...]"
return
1
return
1
fi
fi
...
@@ -307,7 +307,7 @@ multi == 1 && length(\$0) > 0 {
...
@@ -307,7 +307,7 @@ multi == 1 && length(\$0) > 0 {
function
_omz::plugin::enable
{
function
_omz::plugin::enable
{
if
[[
-z
"
$1
"
]]
;
then
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage:
omz plugin enable
<plugin> [...]"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<plugin> [...]"
return
1
return
1
fi
fi
...
@@ -383,7 +383,7 @@ multi == 1 && /^[^#]*\)/ {
...
@@ -383,7 +383,7 @@ multi == 1 && /^[^#]*\)/ {
function
_omz::plugin::info
{
function
_omz::plugin::info
{
if
[[
-z
"
$1
"
]]
;
then
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage:
omz plugin info
<plugin>"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<plugin>"
return
1
return
1
fi
fi
...
@@ -430,7 +430,7 @@ function _omz::plugin::list {
...
@@ -430,7 +430,7 @@ function _omz::plugin::list {
function
_omz::plugin::load
{
function
_omz::plugin::load
{
if
[[
-z
"
$1
"
]]
;
then
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage:
omz plugin load
<plugin> [...]"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<plugin> [...]"
return
1
return
1
fi
fi
...
@@ -477,9 +477,9 @@ function _omz::plugin::load {
...
@@ -477,9 +477,9 @@ function _omz::plugin::load {
}
}
function
_omz::pr
{
function
_omz::pr
{
((
$#
>
0
&&
$+
functions[
_omz::pr
::
$1
]
))
||
{
((
$#
>
0
&&
$+
functions[
$0
::
$1
]
))
||
{
cat
>
&2
<<
EOF
cat
>
&2
<<
EOF
Usage:
omz pr
<command> [options]
Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<command> [options]
Available commands:
Available commands:
...
@@ -493,7 +493,7 @@ EOF
...
@@ -493,7 +493,7 @@ EOF
local command
=
"
$1
"
local command
=
"
$1
"
shift
shift
_omz::pr
::
$command
"
$@
"
$0
::
$command
"
$@
"
}
}
function
_omz::pr::clean
{
function
_omz::pr::clean
{
...
@@ -534,7 +534,7 @@ function _omz::pr::test {
...
@@ -534,7 +534,7 @@ function _omz::pr::test {
# Check the input
# Check the input
if
!
[[
-n
"
$1
"
&&
"
$1
"
=
~ ^[[:digit:]]+
$
]]
;
then
if
!
[[
-n
"
$1
"
&&
"
$1
"
=
~ ^[[:digit:]]+
$
]]
;
then
echo
>
&2
"Usage:
omz pr test
<PR_NUMBER_or_URL>"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<PR_NUMBER_or_URL>"
return
1
return
1
fi
fi
...
@@ -619,9 +619,9 @@ function _omz::reload {
...
@@ -619,9 +619,9 @@ function _omz::reload {
}
}
function
_omz::theme
{
function
_omz::theme
{
((
$#
>
0
&&
$+
functions[
_omz::theme
::
$1
]
))
||
{
((
$#
>
0
&&
$+
functions[
$0
::
$1
]
))
||
{
cat
>
&2
<<
EOF
cat
>
&2
<<
EOF
Usage:
omz theme
<command> [options]
Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<command> [options]
Available commands:
Available commands:
...
@@ -636,7 +636,7 @@ EOF
...
@@ -636,7 +636,7 @@ EOF
local command
=
"
$1
"
local command
=
"
$1
"
shift
shift
_omz::theme
::
$command
"
$@
"
$0
::
$command
"
$@
"
}
}
function
_omz::theme::list
{
function
_omz::theme::list
{
...
@@ -671,7 +671,7 @@ function _omz::theme::list {
...
@@ -671,7 +671,7 @@ function _omz::theme::list {
function
_omz::theme::set
{
function
_omz::theme::set
{
if
[[
-z
"
$1
"
]]
;
then
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage:
omz theme set
<theme>"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<theme>"
return
1
return
1
fi
fi
...
@@ -739,7 +739,7 @@ EOF
...
@@ -739,7 +739,7 @@ EOF
function
_omz::theme::use
{
function
_omz::theme::use
{
if
[[
-z
"
$1
"
]]
;
then
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage:
omz theme use
<theme>"
echo
>
&2
"Usage:
${
(j
:
:
)
${
(s.
::.
)0#_
}}
<theme>"
return
1
return
1
fi
fi
...
...
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