Skip to content

Instantly share code, notes, and snippets.

@akiym
Created Mar 31, 2011
Embed
What would you like to do?
zsh autcompletion for plackup / cpanm / dzil
#compdef cpanm
#autoload
typeset -A opt_args
local context state line
_arguments -C \
'(-h)'{-h,--help}'[prints help]' \
'(-v --verobse)'{-v,--verbose}'[turn on chatty output.]' \
'(-q --quiet)'{-q,--quiet}'[turn off the most output.]' \
'(-f --force)'{-f,--force}'[force install.]' \
'(-n --notest)'{-n,--notest}'[do not run unit tests.]' \
'(-S --sudo)'{-s,--sudo}'[sudo to run install commands.]' \
'(-l --local-lib)'{-l,--local-lib}'[specify the install base to install modules]' \
'(-L --local-lib-contained)'{-L,--local-lib-contained}'[specify the install base to install all non-core modules]' \
'(--interactive)--interactive[turns on interactive configure.]' \
'(--installdeps)--installdeps[only install dependencies.]' \
'(--reinstall)--reinstall[reinstall the distributions even if you already have the latest version installed.]' \
'(--mirror)--mirror[specify the base URL for the mirror.]' \
'(--mirror-only)--mirror-only[use the mirrors index file instead of the CPAN Meta DB]' \
'(--prompt)--prompt[prompt when configure build test fails]' \
'(--auto-cleanup)--auto-cleanup[number of days that cpanms work directories expire in. Defaults to 7]' \
'1: :->cmds' \
'(1 *): :->args' && return 0
case $state in
cmds)
local -a cmds
cmds=( --self-upgrade --info --look --version )
_describe -t commands 'cpanm command' cmds && ret=0
;;
esac
return ret
#compdef cpanm
#autoload
typeset -A opt_args
local context state line
_arguments -C \
'(-h)'{-h,--help}'[prints help]' \
'(-v --verobse)'{-v,--verbose}'[turn on chatty output.]' \
'(-q --quiet)'{-q,--quiet}'[turn off the most output.]' \
'(-f --force)'{-f,--force}'[force install.]' \
'(-n --notest)'{-n,--notest}'[do not run unit tests.]' \
'(-S --sudo)'{-s,--sudo}'[sudo to run install commands.]' \
'(-l --local-lib)'{-l,--local-lib}'[specify the install base to install modules]' \
'(-L --local-lib-contained)'{-L,--local-lib-contained}'[specify the install base to install all non-core modules]' \
'(--interactive)--interactive[turns on interactive configure.]' \
'(--installdeps)--installdeps[only install dependencies.]' \
'(--reinstall)--reinstall[reinstall the distributions even if you already have the latest version installed.]' \
'(--mirror)--mirror[specify the base URL for the mirror.]' \
'(--mirror-only)--mirror-only[use the mirrors index file instead of the CPAN Meta DB]' \
'(--prompt)--prompt[prompt when configure build test fails]' \
'(--auto-cleanup)--auto-cleanup[number of days that cpanms work directories expire in. Defaults to 7]' \
'1: :->cmds' \
'(1 *): :->args' && return 0
case $state in
cmds)
local -a cmds
cmds=( --self-upgrade --info --look --version )
_describe -t commands 'cpanm command' cmds && ret=0
;;
esac
return ret
#compdef plackup
#autoload
typeset -A opt_args
local context state line
_arguments -C \
'(- 1 *)'{-h,--help}'[prints help]' \
'(-a --app)'{-a,--app}'[locate a .psgi script.]' \
'(-o --host)'{-o,--host}'[the interface a TCP based server daemon binds to.]' \
'(-p --port)'{-p,--port}'[the port number a TCP based server daemon listens on.]' \
'(-s --server)'{-s,--server}'[select a specific implementation to run on.]' \
'(-S --socket)'{-S,--socket}'[UNIX domain socket path to listen on.]' \
'(-l --listen)'{-l,--listen}'[addresses to listen on.]' \
'(-D --daemonize)'{-D,--daemonize}'[makes the process go background.]' \
'(-e)-e[evaluate the given code as a PSGI app.]' \
'(-I)-I[specify perl library include path.]' \
'(-M)-M[specify modules to load before loading the app code.]' \
'(-E --env)'{-E,--env}'[specify the environment option.]' \
'(-r --reload)'{-r,--reload}'[make plackup to watch updates from your development directory and restarts the server whenever a file is updated.]' \
'(-R --Reload)'{-R,--Reload}'[allows you to specify the path to watch file updates separated by comma.]' \
'(-L --Loader)'{-L,--Loader}'[specify the server loading subclass that implements how to run the server.]' \
'(--access-log)--access-log[specify the pathname of a file where the access log should be written.]' \
'(1 *): :->args' && return 0
case $state in
args)
_files && return 0
;;
esac
return ret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment