mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-25 01:47:25 +08:00
Compare commits
2 Commits
0e833b622b
...
66e0438d47
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
66e0438d47 | ||
|
|
9e5f280f87 |
28
lib/cli.zsh
28
lib/cli.zsh
@ -37,7 +37,7 @@ function _omz {
|
|||||||
changelog) local -a refs
|
changelog) local -a refs
|
||||||
refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
|
refs=("${(@f)$(command git for-each-ref --format="%(refname:short):%(subject)" refs/heads refs/tags)}")
|
||||||
_describe 'command' refs ;;
|
_describe 'command' refs ;;
|
||||||
plugin) subcmds=('list:List plugins')
|
plugin) subcmds=('info:Get plugin information' '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')
|
||||||
_describe 'command' subcmds ;;
|
_describe 'command' subcmds ;;
|
||||||
@ -46,6 +46,8 @@ function _omz {
|
|||||||
esac
|
esac
|
||||||
elif (( CURRENT == 4 )); then
|
elif (( CURRENT == 4 )); then
|
||||||
case "$words[2]::$words[3]" in
|
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) \
|
theme::use) compadd "$ZSH"/themes/*.zsh-theme(.N:t:r) \
|
||||||
"$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;;
|
"$ZSH_CUSTOM"/**/*.zsh-theme(.N:r:gs:"$ZSH_CUSTOM"/themes/:::gs:"$ZSH_CUSTOM"/:::) ;;
|
||||||
esac
|
esac
|
||||||
@ -143,6 +145,7 @@ Usage: omz plugin <command> [options]
|
|||||||
|
|
||||||
Available commands:
|
Available commands:
|
||||||
|
|
||||||
|
info <plugin> Get information of a plugin
|
||||||
list List all available Oh My Zsh plugins
|
list List all available Oh My Zsh plugins
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
@ -155,6 +158,29 @@ EOF
|
|||||||
_omz::plugin::$command "$@"
|
_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 {
|
function _omz::plugin::list {
|
||||||
local -a custom_plugins builtin_plugins
|
local -a custom_plugins builtin_plugins
|
||||||
custom_plugins=("$ZSH_CUSTOM"/plugins/*(-/N:t))
|
custom_plugins=("$ZSH_CUSTOM"/plugins/*(-/N:t))
|
||||||
|
|||||||
@ -188,8 +188,8 @@ function pacdisowned() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function pacmanallkeys() {
|
function pacmanallkeys() {
|
||||||
curl -s https://www.archlinux.org/people/{developers,trustedusers}/ | \
|
curl -sL https://www.archlinux.org/people/{developers,trusted-users}/ | \
|
||||||
awk -F\" '(/pgp.mit.edu/) { sub(/.*search=0x/,""); print $1}' | \
|
awk -F\" '(/keyserver.ubuntu.com/) { sub(/.*search=0x/,""); print $1}' | \
|
||||||
xargs sudo pacman-key --recv-keys
|
xargs sudo pacman-key --recv-keys
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user