Created
July 26, 2010 21:57
-
-
Save rsky/491322 to your computer and use it in GitHub Desktop.
http://openpear.org/package/phpman 用zsh/bash補完関数
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#compdef phpman | |
_search_word () { | |
_wanted test expl 'search_word' compadd \ | |
$(command ls $(pear config-get data_dir)/phpman/php-chunked-xhtml \ | |
| sed -e 's/\.html$//' \ | |
| sed -e 's/^.*\.//' \ | |
| sed -e 's/-/_/g' \ | |
| sort | uniq) | |
} | |
_arguments \ | |
'(-s --sync)'{-s,--sync}'[update php manual newest]' \ | |
'(-h --help)'{-h,--help}'[shop help]' \ | |
':search_word:_search_word' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_phpman_search_words=$(ls $(pear config-get data_dir)/phpman/php-chunked-xhtml \ | |
| sed -e 's/\.html$//' \ | |
| sed -e 's/^.*\.//' \ | |
| sed -e 's/-/_/g' \ | |
| sort | uniq) | |
_phpman() | |
{ | |
COMPREPLY=( $( \ | |
compgen -W "-s --sync -h --help $_phpman_search_words" \ | |
${COMP_WORDS[COMP_CWORD]} \ | |
) ) | |
} | |
complete -F _phpman phpman |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment