Browse code

add completion plugin 'cpanm' for cpanminus

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