Diff
1diff --git a/plugins/cpanm/_cpanm b/plugins/cpanm/_cpanm
2new file mode 100644
3index 0000000000000000000000000000000000000000..58451d35ae7b4ab1a32c880e76b47c3d00e7aacd
4--- /dev/null
5+++ b/plugins/cpanm/_cpanm
6@@ -0,0 +1,67 @@
7+#compdef cpanm
8+
9+##
10+# cpanminus Z Shell completion script
11+##
12+#
13+# Current supported cpanm version: 1.4000 (Tue Mar 8 01:00:49 PST 2011)
14+#
15+# The latest code is always located at:
16+# https://github.com/rshhh/cpanminus/blob/master/etc/_cpanm
17+#
18+
19+local arguments curcontext="$curcontext"
20+typeset -A opt_args
21+
22+
23+arguments=(
24+
25+# Commands
26+# '(--install -i)'{--install,-i}'[Installs the modules]'
27+ '(- :)--self-upgrade[Upgrades itself]'
28+ '(- :)--info[Displays distribution info on CPAN]'
29+ '(--installdeps)--installdeps[Only install dependencies]'
30+ '(--look)--look[Download/unpack the distribution and then open the directory with your shell]'
31+ '(- :)'{--help,-h}'[Displays help information]'
32+ '(- :)'{--version,-V}'[Displays software version]'
33+
34+# Options
35+ {--force,-f}'[Force install]'
36+ {--notest,-n}'[Do not run unit tests]'
37+ {--sudo,-S}'[sudo to run install commands]'
38+ '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]'
39+ '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]'
40+ {--local-lib,-l}'[Specify the install base to install modules]'
41+ {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]'
42+ '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls'
43+ '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]'
44+ '--prompt[Prompt when configure/build/test fails]'
45+ '--reinstall[Reinstall the distribution even if you already have the latest version installed]'
46+ '--interactive[Turn on interactive configure]'
47+
48+ '--scandeps[Scan the depencencies of given modules and output the tree in a text format]'
49+ '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)'
50+
51+ '--save-dists[Specify the optional directory path to copy downloaded tarballs]'
52+# '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]'
53+
54+ '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]'
55+ '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]'
56+ '(--man-pages)--no-man-pages[Do not generate man pages]'
57+
58+
59+ # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP,
60+ # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available.
61+ # (So that the exclusions are not enabled here for the completion)
62+ '(--lwp)--lwp[Use LWP module to download stuff]'
63+ '(--wget)--wget[Use GNU Wget (if available) to download stuff]'
64+ '(--curl)--curl[Use cURL (if available) to download stuff]'
65+
66+# Other completions
67+ '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"'
68+ # '*::args: _normal' # this looks for default files (any files)
69+)
70+_arguments -s $arguments \
71+ && return 0
72+
73+return 1
74diff --git a/plugins/cpanm/cpanm.plugin.zsh b/plugins/cpanm/cpanm.plugin.zsh
75new file mode 100644
76index 0000000000000000000000000000000000000000..af52d3e8b2567a2a61f9f41cae8f3b15e0d4b933
77--- /dev/null
78+++ b/plugins/cpanm/cpanm.plugin.zsh
79@@ -0,0 +1,4 @@
80+# add cpanm completion function to path
81+fpath=($ZSH/plugins/cpanm $fpath)
82+autoload -U compinit
83+compinit -i