_cpanm 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #compdef cpanm
  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. local arguments curcontext="$curcontext"
  12. typeset -A opt_args
  13. arguments=(
  14. # Commands
  15. # '(--install -i)'{--install,-i}'[Installs the modules]'
  16. '(- :)--self-upgrade[Upgrades itself]'
  17. '(- :)--info[Displays distribution info on CPAN]'
  18. '(--installdeps)--installdeps[Only install dependencies]'
  19. '(--look)--look[Download/unpack the distribution and then open the directory with your shell]'
  20. '(- :)'{--help,-h}'[Displays help information]'
  21. '(- :)'{--version,-V}'[Displays software version]'
  22. # Options
  23. {--force,-f}'[Force install]'
  24. {--notest,-n}'[Do not run unit tests]'
  25. {--sudo,-S}'[sudo to run install commands]'
  26. '(-v --verbose --quiet -q)'{--verbose,-v}'[Turns on chatty output]'
  27. '(-q --quiet --verbose -v)'{--quiet,-q}'[Turns off all output]'
  28. {--local-lib,-l}'[Specify the install base to install modules]'
  29. {--local-lib-contained,-L}'[Specify the install base to install all non-core modules]'
  30. '--mirror[Specify the base URL for the mirror (e.g. http://cpan.cpantesters.org/)]:URLs:_urls'
  31. '--mirror-only[Use the mirror\''s index file instead of the CPAN Meta DB]'
  32. '--prompt[Prompt when configure/build/test fails]'
  33. '--reinstall[Reinstall the distribution even if you already have the latest version installed]'
  34. '--interactive[Turn on interactive configure]'
  35. '--scandeps[Scan the depencencies of given modules and output the tree in a text format]'
  36. '--format[Specify what format to display the scanned dependency tree]:scandeps format:(tree json yaml dists)'
  37. '--save-dists[Specify the optional directory path to copy downloaded tarballs]'
  38. # '--uninst-shadows[Uninstalls the shadow files of the distribution that you\''re installing]'
  39. '--auto-cleanup[Number of days that cpanm\''s work directories expire in. Defaults to 7]'
  40. '(--no-man-pages)--man-pages[Generates man pages for executables (man1) and libraries (man3)]'
  41. '(--man-pages)--no-man-pages[Do not generate man pages]'
  42. # Note: Normally with "--lwp", "--wget" and "--curl" options set to true (which is the default) cpanm tries LWP,
  43. # Wget, cURL and HTTP::Tiny (in that order) and uses the first one available.
  44. # (So that the exclusions are not enabled here for the completion)
  45. '(--lwp)--lwp[Use LWP module to download stuff]'
  46. '(--wget)--wget[Use GNU Wget (if available) to download stuff]'
  47. '(--curl)--curl[Use cURL (if available) to download stuff]'
  48. # Other completions
  49. '*:Local directory or archive:_files -/ -g "*.(tar.gz|tgz|tar.bz2|zip)(-.)"'
  50. # '*::args: _normal' # this looks for default files (any files)
  51. )
  52. _arguments -s $arguments \
  53. && return 0
  54. return 1