From 6483c0c3a13d9feb9bb2a1cb3db8b430c35e4669 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Wed, 20 Mar 2013 08:22:38 +0100 Subject: [PATCH 01/12] Overhauled port command completion Port command completion got smarter. It can now complete paths for the provides subcommand, and complete pseudo-portnames. It will complete all ports or only installed ones (for example, when completing for the uninstall command). It will complete the select subcommand with appropriate values. --- src/_port | 190 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 109 insertions(+), 81 deletions(-) diff --git a/src/_port b/src/_port index 9053f53..db39c1f 100644 --- a/src/_port +++ b/src/_port @@ -11,92 +11,120 @@ # # * Matt Cable # * Sorin Ionescu +# * Aljaž Srebrnič # # ------------------------------------------------------------------------------ -local subcmds +_port_select() { + if (( CURRENT == 3 )); then + _describe 'Port select options' select_options + elif (( CURRENT == 4 )); then + local select_group + select_group=() + for f in $port_prefix/etc/select/*; do + select_group+=$(basename $f) + done + _describe "Port select groups" select_group + elif [[ $CURRENT -eq 5 && $words[3] == '--set' ]]; then + local select_variants + select_variants=("${(f)$(port select --list $words[4] | sed -e '1 d' -e 's/^[ \t]*//' -e 's/ (active)$//')}") + _describe "Port select group $words[4] variants" select_variants + 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' -) +_port() { + # Variables for _argument + typeset -A opt_args + local context state state_descr line -_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 + local actions pseudo_common pseudo_advanced select_options port_prefix -case "$state" in - (command) - if (( CURRENT == 1 )); then - state='subcommands' - else - state='portname' - fi - ;; -esac + port_prefix=$(which port | sed 's|/bin/port||') -case "$state" in - (subcommands) - _describe -t commands 'port commands' subcmds - ;; - (portname) - # Cache the list of ports. - if (( ! $+_port_list )); then - _port_list=($(port echo all; echo "all current active inactive installed uninstalled outdated")) - fi + actions=( activate archive archivefetch build cat cd + checksum clean configure contents deactivate dependents deps + destroot dir distcheck distfiles dmg dpkg echo edit exit + extract fetch file gohome help info install installed lint list + livecheck load location log logfile mdmg mirror mpkg notes + outdated patch pkg platform portpkg provides quit rdependents + rdeps rev-upgrade rpm search select selfupdate setrequested space + srpm submit sync test unarchive uninstall unload unsetrequested + upgrade url usage variants version work ) - _describe -t commands 'available ports' _port_list - ;; -esac + pseudo_common=(all current active inactive actinact installed uninstalled outdated + obsolete requested unrequested leaves) + + pseudo_advanced=('variants:' 'variant:' 'description:' 'depends:' + 'depends_lib:' 'depends_run:' 'depends_build:' 'depends_fetch:' 'depends_extract:' + 'portdir:' 'homepage:' 'epoch:' 'platforms:' 'platform:' 'name:' 'long_description:' + 'maintainers:' 'maintainer:' 'categories:' 'category:' 'version:' 'revision:' 'license:') + + select_options=( + '--list:List available versions for the group' + '--set:Select the given version for the group' + '--show:Show which version is currently selected for the group \(default if none given\)' + ) + + _arguments -s -C \ + '-v[verbose mode (generate verbose messages)]' \ + '-d[debug mode (generate debugging messages, implies -v)]' \ + '-q[quiet mode (suppress messages)]' \ + "-n[don't upgrade dependencies (affects upgrade and install)]" \ + "-R[also upgrade dependents (only affects upgrade) - note that this does not upgrade dependents' dependencies]" \ + '-u[uninstall non-active ports when upgrading and uninstalling]' \ + '-f[force mode (ignore state file)]' \ + '-o[honor state files even if the Portfile has been modified since (called -o because it used to mean "older")]' \ + '-s[source-only mode (build and install from source, do not attempt to fetch binary archives)]' \ + '-b[binary-only mode (build and install from binary archives, ignore source, abort if no archive available)]' \ + '-c[autoclean mode (execute clean after install)]' \ + "-k[keep mode (don't autoclean after install)]" \ + '-D[specify portdir]' \ + '-F[Read and process the file of commands specified by the argument.]' \ + '-p[Despite any errors encountered, proceed to process multiple ports and commands.]' \ + '-y[Perform a dry run.]' \ + '-t[enable trace mode debug facilities on platforms that support it (Mac OS X).]' \ + "1:Port actions:($actions)" \ + '*:extra:->extra' \ + && return 0 + + case "$state" in + extra) + case "$words[2]" in + provides) + _files + ;; + search) + _guard '^--*' 'pattern' + ;; + help) + _describe -t actions 'Port actions' actions + ;; + select) + _call_function - _port_select + ;; + contents|deactivate|setrequested|space|uninstall|unsetrequested) + # Cache the list of all ports. + if (( ! $+_installed_ports )); then + _installed_ports=$(_call_program path-installed "port installed | cut -d ' ' -f 3") + fi + _alternative \ + "ports:Installed ports:($_installed_ports)" \ + "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ + "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" + ;; + *) + # Cache the list of all ports. + if (( ! $+_all_ports )); then + _all_ports=$(_call_program path-all "port echo all") + fi + _alternative \ + "ports:Available ports:($_all_ports)" \ + "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ + "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" + ;; + esac + ;; + esac +} + +_port "$@" From 2224f3ae7191010126d0d56d55453d072b9604ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 24 Mar 2013 22:26:32 +0100 Subject: [PATCH 02/12] Moved port_select function to bottom --- src/_port | 67 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 43 insertions(+), 24 deletions(-) diff --git a/src/_port b/src/_port index db39c1f..064928a 100644 --- a/src/_port +++ b/src/_port @@ -15,23 +15,6 @@ # # ------------------------------------------------------------------------------ -_port_select() { - if (( CURRENT == 3 )); then - _describe 'Port select options' select_options - elif (( CURRENT == 4 )); then - local select_group - select_group=() - for f in $port_prefix/etc/select/*; do - select_group+=$(basename $f) - done - _describe "Port select groups" select_group - elif [[ $CURRENT -eq 5 && $words[3] == '--set' ]]; then - local select_variants - select_variants=("${(f)$(port select --list $words[4] | sed -e '1 d' -e 's/^[ \t]*//' -e 's/ (active)$//')}") - _describe "Port select group $words[4] variants" select_variants - fi -} - _port() { # Variables for _argument typeset -A opt_args @@ -87,6 +70,12 @@ _port() { '*:extra:->extra' \ && return 0 + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _port_caching_policy + fi + case "$state" in extra) case "$words[2]" in @@ -103,22 +92,28 @@ _port() { _call_function - _port_select ;; contents|deactivate|setrequested|space|uninstall|unsetrequested) - # Cache the list of all ports. - if (( ! $+_installed_ports )); then - _installed_ports=$(_call_program path-installed "port installed | cut -d ' ' -f 3") + # Cache the list of installed ports. + if ( [[ ${+_port_installed_packages} -eq 0 ]] || _cache_invalid PORT_INSTALLED_PACKAGES ) && + ! _retrieve_cache PORT_INSTALLED_PACKAGES; + then + _port_installed_packages=( $(_call_program path-all "port echo all") ) + _store_cache PORT_INSTALLED_PACKAGES _port_installed_packages fi _alternative \ - "ports:Installed ports:($_installed_ports)" \ + "ports:Installed ports:($_port_installed_packages)" \ "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" ;; *) # Cache the list of all ports. - if (( ! $+_all_ports )); then - _all_ports=$(_call_program path-all "port echo all") + if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) && + ! _retrieve_cache PORT_AVAILABLE_PACKAGES; + then + _port_available_packages=( $(_call_program path-all "port echo all") ) + _store_cache PORT_AVAILABLE_PACKAGES _port_available_packages fi _alternative \ - "ports:Available ports:($_all_ports)" \ + "ports:Available ports:($_port_available_packages)" \ "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" ;; @@ -127,4 +122,28 @@ _port() { esac } +_port_select() { + if (( CURRENT == 3 )); then + _describe 'Port select options' select_options + elif (( CURRENT == 4 )); then + local select_group + select_group=() + for f in $port_prefix/etc/select/*; do + select_group+=$(basename $f) + done + _describe "Port select groups" select_group + elif [[ $CURRENT -eq 5 && $words[3] == '--set' ]]; then + local select_variants + select_variants=("${(f)$(port select --list $words[4] | sed -e '1 d' -e 's/^[ \t]*//' -e 's/ (active)$//')}") + _describe "Port select group $words[4] variants" select_variants + fi +} + +_port_caching_policy() { + local reg_time comp_time + reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db) + comp_time=$(stat -c '%Z' $1) + return $(( reg_time < comp_time )) +} + _port "$@" From d8a2e94fa0ca36f89fccc1ef3750bc3bfe331060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 24 Mar 2013 22:28:20 +0100 Subject: [PATCH 03/12] Use native caching system --- src/_port | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/_port b/src/_port index 064928a..11e91dd 100644 --- a/src/_port +++ b/src/_port @@ -70,12 +70,6 @@ _port() { '*:extra:->extra' \ && return 0 - local cache_policy - zstyle -s ":completion:${curcontext}:" cache-policy cache_policy - if [[ -z "$cache_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy _port_caching_policy - fi - case "$state" in extra) case "$words[2]" in @@ -139,11 +133,4 @@ _port_select() { fi } -_port_caching_policy() { - local reg_time comp_time - reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db) - comp_time=$(stat -c '%Z' $1) - return $(( reg_time < comp_time )) -} - _port "$@" From f2cff3dbf37504945a586f364112a41dfb7060c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 24 Mar 2013 22:31:08 +0100 Subject: [PATCH 04/12] Use own cache policy This checks modification dates of the repository database and completion cache and refreshes the latter if it is older than the database. --- src/_port | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/_port b/src/_port index 11e91dd..064928a 100644 --- a/src/_port +++ b/src/_port @@ -70,6 +70,12 @@ _port() { '*:extra:->extra' \ && return 0 + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _port_caching_policy + fi + case "$state" in extra) case "$words[2]" in @@ -133,4 +139,11 @@ _port_select() { fi } +_port_caching_policy() { + local reg_time comp_time + reg_time=$(stat -c '%Z' $port_prefix/var/macports/registry/registry.db) + comp_time=$(stat -c '%Z' $1) + return $(( reg_time < comp_time )) +} + _port "$@" From ef8d5806c445d100e877c4f9c0210d9ba769aca4 Mon Sep 17 00:00:00 2001 From: Mark Cornick Date: Sat, 23 Mar 2013 10:20:43 -0400 Subject: [PATCH 05/12] Add completion for knife user commands These commands were added in Chef 11.0.0. --- src/_knife | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/_knife b/src/_knife index 8d51d99..be55e56 100644 --- a/src/_knife +++ b/src/_knife @@ -44,7 +44,7 @@ _knife() { case $state in knifecmd) - compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" environment exec index node recipe role search ssh status windows $cloudproviders + compadd -Q "$@" bootstrap client configure cookbook "cookbook site" "data bag" environment user exec index node recipe role search ssh status windows $cloudproviders ;; knifesubcmd) case $words[2] in @@ -63,6 +63,9 @@ _knife() { environment) compadd -Q "$@" create delete edit "from file" list show ;; + user) + compadd -Q "$@" create delete edit list reregister show + ;; node) compadd -Q "$@" "from file" create show edit delete list run_list "bulk delete" ;; @@ -186,6 +189,10 @@ _chef_environments_remote() { (knife environment list | awk '{print $1}') } +_chef_users_remote() { + (knife user list | awk '{print $1}') +} + # The chef_x_local functions use the knife config to find the paths of relevant objects x to be uploaded to the server _chef_cookbooks_local() { (for i in $( grep cookbook_path $HOME/.chef/knife.rb | awk 'BEGIN {FS = "[" }; {print $2}' | sed 's/\,//g' | sed "s/'//g" | sed 's/\(.*\)]/\1/' ); do ls $i; done) From 4aa41e226780725bf50e4f273834d0923ba8c4e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 31 Mar 2013 22:49:15 +0200 Subject: [PATCH 06/12] Use message instead of guard Use _message instead of _guard when completing the search pattern. --- src/_port | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_port b/src/_port index 064928a..806dd41 100644 --- a/src/_port +++ b/src/_port @@ -83,7 +83,7 @@ _port() { _files ;; search) - _guard '^--*' 'pattern' + _message 'pattern' ;; help) _describe -t actions 'Port actions' actions From 11685635242e5d49fd76c1fff96d93247e2de462 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 31 Mar 2013 22:52:26 +0200 Subject: [PATCH 07/12] _port: add upgrade completions Port upgrade completes only outdated ports. --- src/_port | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/_port b/src/_port index 806dd41..a028075 100644 --- a/src/_port +++ b/src/_port @@ -104,6 +104,11 @@ _port() { "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" ;; + upgrade) + local outdated_packages + outdated_packages=("${(f)$(port outdated | sed -e '1 d' -e 's/^\([[:graph:]]*\).*/\1/')}") + _describe "Outdated ports" outdated_packages + ;; *) # Cache the list of all ports. if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) && From 810840e0e045be40822d5c27092e44bfdd5190c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 31 Mar 2013 23:29:55 +0200 Subject: [PATCH 08/12] Remove unnecessary parenthesis escaping --- src/_port | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/_port b/src/_port index a028075..ab36f2d 100644 --- a/src/_port +++ b/src/_port @@ -45,7 +45,7 @@ _port() { select_options=( '--list:List available versions for the group' '--set:Select the given version for the group' - '--show:Show which version is currently selected for the group \(default if none given\)' + '--show:Show which version is currently selected for the group (default if none given)' ) _arguments -s -C \ From 54ed122d25dab95cacc2defb2d5601121bf1075a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 31 Mar 2013 23:29:55 +0200 Subject: [PATCH 09/12] Set cache-policy before calling _arguments --- src/_port | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/_port b/src/_port index ab36f2d..177691f 100644 --- a/src/_port +++ b/src/_port @@ -48,6 +48,12 @@ _port() { '--show:Show which version is currently selected for the group (default if none given)' ) + local cache_policy + zstyle -s ":completion:${curcontext}:" cache-policy cache_policy + if [[ -z "$cache_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _port_caching_policy + fi + _arguments -s -C \ '-v[verbose mode (generate verbose messages)]' \ '-d[debug mode (generate debugging messages, implies -v)]' \ @@ -70,12 +76,6 @@ _port() { '*:extra:->extra' \ && return 0 - local cache_policy - zstyle -s ":completion:${curcontext}:" cache-policy cache_policy - if [[ -z "$cache_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy _port_caching_policy - fi - case "$state" in extra) case "$words[2]" in From 3e6040e01d2f5c3fec4834adedac5b26551b5687 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Sun, 31 Mar 2013 23:29:55 +0200 Subject: [PATCH 10/12] Do not use state mechanism Call a dispatch function instead, simplifying the nested select case. --- src/_port | 94 +++++++++++++++++++++++++++---------------------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/src/_port b/src/_port index 177691f..f1d64ff 100644 --- a/src/_port +++ b/src/_port @@ -73,56 +73,54 @@ _port() { '-y[Perform a dry run.]' \ '-t[enable trace mode debug facilities on platforms that support it (Mac OS X).]' \ "1:Port actions:($actions)" \ - '*:extra:->extra' \ + '*:extra:_port_dispatch' \ && return 0 +} - case "$state" in - extra) - case "$words[2]" in - provides) - _files - ;; - search) - _message 'pattern' - ;; - help) - _describe -t actions 'Port actions' actions - ;; - select) - _call_function - _port_select - ;; - contents|deactivate|setrequested|space|uninstall|unsetrequested) - # Cache the list of installed ports. - if ( [[ ${+_port_installed_packages} -eq 0 ]] || _cache_invalid PORT_INSTALLED_PACKAGES ) && - ! _retrieve_cache PORT_INSTALLED_PACKAGES; - then - _port_installed_packages=( $(_call_program path-all "port echo all") ) - _store_cache PORT_INSTALLED_PACKAGES _port_installed_packages - fi - _alternative \ - "ports:Installed ports:($_port_installed_packages)" \ - "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ - "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" - ;; - upgrade) - local outdated_packages - outdated_packages=("${(f)$(port outdated | sed -e '1 d' -e 's/^\([[:graph:]]*\).*/\1/')}") - _describe "Outdated ports" outdated_packages - ;; - *) - # Cache the list of all ports. - if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) && - ! _retrieve_cache PORT_AVAILABLE_PACKAGES; - then - _port_available_packages=( $(_call_program path-all "port echo all") ) - _store_cache PORT_AVAILABLE_PACKAGES _port_available_packages - fi - _alternative \ - "ports:Available ports:($_port_available_packages)" \ - "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ - "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" - ;; - esac +_port_dispatch() { + case "$words[2]" in + provides) + _files + ;; + search) + _message 'pattern' + ;; + help) + _describe -t actions 'Port actions' actions + ;; + select) + _call_function - _port_select + ;; + contents|deactivate|setrequested|space|uninstall|unsetrequested) + # Cache the list of installed ports. + if ( [[ ${+_port_installed_packages} -eq 0 ]] || _cache_invalid PORT_INSTALLED_PACKAGES ) && + ! _retrieve_cache PORT_INSTALLED_PACKAGES; + then + _port_installed_packages=( $(_call_program path-all "port echo all") ) + _store_cache PORT_INSTALLED_PACKAGES _port_installed_packages + fi + _alternative \ + "ports:Installed ports:($_port_installed_packages)" \ + "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ + "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" + ;; + upgrade) + local outdated_packages + outdated_packages=("${(f)$(port outdated | sed -e '1 d' -e 's/^\([[:graph:]]*\).*/\1/')}") + _describe "Outdated ports" outdated_packages + ;; + *) + # Cache the list of all ports. + if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) && + ! _retrieve_cache PORT_AVAILABLE_PACKAGES; + then + _port_available_packages=( $(_call_program path-all "port echo all") ) + _store_cache PORT_AVAILABLE_PACKAGES _port_available_packages + fi + _alternative \ + "ports:Available ports:($_port_available_packages)" \ + "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \ + "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)" ;; esac } From 7b412ed1bae9d1e06180f2003b5b421f2b17eb0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Tue, 2 Apr 2013 21:41:40 +0200 Subject: [PATCH 11/12] Fix bug introduced in 3e6040e01 I can't call a function from _arguments --- src/_port | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/_port b/src/_port index f1d64ff..859d21a 100644 --- a/src/_port +++ b/src/_port @@ -73,8 +73,14 @@ _port() { '-y[Perform a dry run.]' \ '-t[enable trace mode debug facilities on platforms that support it (Mac OS X).]' \ "1:Port actions:($actions)" \ - '*:extra:_port_dispatch' \ + '*:extra:->extra' \ && return 0 + + case "$state" in + extra) + _port_dispatch + ;; + esac } _port_dispatch() { From 8d9cdfc58911ffc0d8b7591d6e47976d47398f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aljaz=CC=8C=20=22g5pw=22=20Srebrnic=CC=8C?= Date: Tue, 2 Apr 2013 21:56:07 +0200 Subject: [PATCH 12/12] Add completion for rev-upgrade subcommand --- src/_port | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/_port b/src/_port index 859d21a..173eb4f 100644 --- a/src/_port +++ b/src/_port @@ -48,6 +48,8 @@ _port() { '--show:Show which version is currently selected for the group (default if none given)' ) + revupgrade_options=('--id-loadcmd-check:Run more checks against a special loadcommand in Mach-O binaries') + local cache_policy zstyle -s ":completion:${curcontext}:" cache-policy cache_policy if [[ -z "$cache_policy" ]]; then @@ -115,6 +117,11 @@ _port_dispatch() { outdated_packages=("${(f)$(port outdated | sed -e '1 d' -e 's/^\([[:graph:]]*\).*/\1/')}") _describe "Outdated ports" outdated_packages ;; + rev-upgrade) + if (( CURRENT == 3 )); then + _describe 'Rev-upgrade options' revupgrade_options + fi + ;; *) # Cache the list of all ports. if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) &&