Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
oh-my-zsh
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
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
9e5f280f
Unverified
Commit
9e5f280f
authored
Jan 03, 2021
by
Fernando Crespo
Committed by
GitHub
Jan 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(CLI): add `plugin info` subcommand (#9452)
Co-authored-by:
Fernando Crespo
<
fxcrespo@iMac-44054.local
>
Co-authored-by:
Marc Cornellà
<
marc.cornella@live.com
>
parent
0e833b62
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
1 deletion
+27
-1
cli.zsh
lib/cli.zsh
+27
-1
No files found.
lib/cli.zsh
View file @
9e5f280f
...
...
@@ -37,7 +37,7 @@ function _omz {
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
=(
'
info:Get plugin information'
'
list:List plugins'
)
_describe
'command'
subcmds
;;
pr
)
subcmds
=(
'test:Test a Pull Request'
'clean:Delete all Pull Request branches'
)
_describe
'command'
subcmds
;;
...
...
@@ -46,6 +46,8 @@ function _omz {
esac
elif
((
CURRENT
==
4
))
;
then
case
"
$words
[2]::
$words
[3]"
in
plugin::info
)
compadd
"
$ZSH
"
/plugins/
*
/README.md
(
.N:h:t
)
\
"
$ZSH_CUSTOM
"
/plugins/
*
/README.md
(
.N:h:t
)
;;
theme::use
)
compadd
"
$ZSH
"
/themes/
*
.zsh-theme
(
.N:t:r
)
\
"
$ZSH_CUSTOM
"
/
**
/
*
.zsh-theme
(
.N:r:gs:
"
$ZSH_CUSTOM
"
/themes/:::gs:
"
$ZSH_CUSTOM
"
/:::
)
;;
esac
...
...
@@ -143,6 +145,7 @@ Usage: omz plugin <command> [options]
Available commands:
info <plugin> Get information of a plugin
list List all available Oh My Zsh plugins
EOF
...
...
@@ -155,6 +158,29 @@ EOF
_omz::plugin::
$command
"
$@
"
}
function
_omz::plugin::info
{
if
[[
-z
"
$1
"
]]
;
then
echo
>
&2
"Usage: omz plugin info <plugin>"
return
1
fi
local
readme
for
readme
in
"
$ZSH_CUSTOM
/plugins/
$1
/README.md"
"
$ZSH
/plugins/
$1
/README.md"
;
do
if
[[
-f
"
$readme
"
]]
;
then
((
${
+commands[less]
}
))
&&
less
"
$readme
"
||
cat
"
$readme
"
return
0
fi
done
if
[[
-d
"
$ZSH_CUSTOM
/plugins/
$1
"
||
-d
"
$ZSH
/plugins/
$1
"
]]
;
then
_omz::log error
"the '
$1
' plugin doesn't have a README file"
else
_omz::log error
"'
$1
' plugin not found"
fi
return
1
}
function
_omz::plugin::list
{
local
-a
custom_plugins builtin_plugins
custom_plugins
=(
"
$ZSH_CUSTOM
"
/plugins/
*
(
-/N:t
))
...
...
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