-
-
Save sloria/795686a107c0f9698152 to your computer and use it in GitHub Desktop.
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 ped | |
# vim: ft=zsh sw=2 ts=2 et | |
_ped() { | |
local curcontext="$curcontext" state line | |
integer NORMARG | |
typeset -A opt_args | |
_arguments -C -s -n \ | |
'(- -h --help)'{-h,--help}'[Show help message]' \ | |
'(- -v --version)'{-v,--version}'[Print version and exit]' \ | |
'(- -e --editor)'{-e,--editor}'[Editor to use]' \ | |
'(- -i --info)'{-i,--info}'[Print module name, path, and line number]' \ | |
'1: :->module' | |
case $state in | |
module) | |
if [[ CURRENT -eq NORMARG ]] | |
then | |
# If the current argument is the first non-option argument | |
# then complete with python modules | |
cmds=( ${(uf)"$(ped ${words[CURRENT]} --complete)"} ) | |
_arguments '1:modules:(${cmds})' | |
_message -e patterns 'pattern' && ret=0 | |
fi | |
;; | |
*) | |
esac | |
} | |
_ped "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment