From b4f52e13fbf0d581eae192deb0c79c2920817baf Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Sun, 25 Sep 2011 13:26:04 -0400 Subject: [PATCH] Add MacPorts completion --- _port | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 _port diff --git a/_port b/_port new file mode 100644 index 0000000..52c3716 --- /dev/null +++ b/_port @@ -0,0 +1,102 @@ +#compdef port +# ------------------------------------------------------------------------------ +# Description +# ----------- +# +# Completion script for MacPorts (http://www.macports.org). +# +# ------------------------------------------------------------------------------ +# Authors +# ------- +# +# * Matt Cable +# * Sorin Ionescu +# +# ------------------------------------------------------------------------------ + +local subcmds + +# Cache the list of ports. +if (( ! $+_port_list )); then + _port_list=($(port echo all; echo "all current active inactive installed uninstalled outdated")) +fi + +subcmds=( + 'activate' + 'archive' + 'build' + 'cat' + 'clean' + 'configure' + 'contents' + 'deactivate' + 'dependents' + 'deps' + 'destroot' + 'dir' + 'distcheck' + 'distclean' + 'dmg' + 'echo' + 'edit' + 'extract' + 'fetch' + 'file' + 'help' + 'info' + 'install' + 'installed' + 'list' + 'livecheck' + 'location' + 'mpkg' + 'outdated' + 'patch' + 'pkg' + 'provides' + 'rpmpackage' + 'search' + 'selfupdate' + 'sync' + 'test' + 'unarchive' + 'uninstall' + 'upgrade' + 'variants' + 'version' +) + +_arguments -C \ + '-v[verbose mode (generate verbose messages)]' \ + '-d[debug mode (generate debugging messages)]' \ + '-q[quiet mode (suppress messages)]' \ + '-D[specify portdir]' \ + '-k[keep mode (do not autoclean after install)]' \ + '-n[dont follow dependencies in upgrade (only for upgrading)]' \ + '-a[upgrade all installed ports (only for upgrading)]' \ + '-u[uninstall non-active ports when upgrading and uninstalling]' \ + '-f[force mode (ignore state file)]' \ + '-s[source-only mode]' \ + '-b[binary-only mode]' \ + '-o[honor state files older than Portfile]' \ + '*::command:->command' \ + && return 0 + +case "$state" in + (command) + if (( CURRENT == 1 )); then + state='subcommands' + else + state='portname' + fi + ;; +esac + +case "$state" in + (subcommands) + _describe -t commands 'port commands' subcmds + ;; + (portname) + _describe -t commands 'available ports' _port_list + ;; +esac