add pear/pecl plugin

This commit is contained in:
thbourlove 2014-01-23 22:33:50 +00:00
commit 4c8cd395d3
2 changed files with 74 additions and 0 deletions

View 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

View 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