mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-02-13 03:01:32 +01:00
add pear/pecl plugin
This commit is contained in:
parent
d485044169
commit
4c8cd395d3
2 changed files with 74 additions and 0 deletions
37
plugins/pear/pear.plugin.zsh
Normal file
37
plugins/pear/pear.plugin.zsh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# FILE: pear.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh pear plugin file.
|
||||
# AUTHOR: Hongbo Tang (thbourlove@gmail.com)
|
||||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_pear_get_command_list () {
|
||||
pear help | sed '1d;/Usage:/,$d;s/ .*//g'
|
||||
}
|
||||
|
||||
_pear_get_package_list () {
|
||||
pear list | sed '1,/PACKAGE/d;s/ .*//g'
|
||||
}
|
||||
|
||||
_pear () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'2: :->package'\
|
||||
'3: :->extra'
|
||||
case $state in
|
||||
command)
|
||||
compadd `_pear_get_command_list`
|
||||
;;
|
||||
package)
|
||||
case $words[2] in
|
||||
uninstall|upgrade|package-dependencies|info)
|
||||
compadd `_pear_get_package_list`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compdef _pear pear
|
||||
37
plugins/pecl/pecl.plugin.zsh
Normal file
37
plugins/pecl/pecl.plugin.zsh
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# ------------------------------------------------------------------------------
|
||||
# FILE: pecl.plugin.zsh
|
||||
# DESCRIPTION: oh-my-zsh pecl plugin file.
|
||||
# AUTHOR: Hongbo Tang (thbourlove@gmail.com)
|
||||
# VERSION: 1.0.0
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
_pecl_get_command_list () {
|
||||
pecl help | sed '1d;/Usage:/,$d;s/ .*//g'
|
||||
}
|
||||
|
||||
_pecl_get_package_list () {
|
||||
pecl list | sed '1,/PACKAGE/d;s/ .*//g'
|
||||
}
|
||||
|
||||
_pecl () {
|
||||
local curcontext="$curcontext" state line
|
||||
typeset -A opt_args
|
||||
_arguments \
|
||||
'1: :->command'\
|
||||
'2: :->package'\
|
||||
'3: :->extra'
|
||||
case $state in
|
||||
command)
|
||||
compadd `_pecl_get_command_list`
|
||||
;;
|
||||
package)
|
||||
case $words[2] in
|
||||
uninstall|upgrade|package-dependencies|info)
|
||||
compadd `_pecl_get_package_list`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
compdef _pecl pecl
|
||||
Loading…
Add table
Add a link
Reference in a new issue