Compare commits

..

No commits in common. "684021f2a1eb3ba1735d86268c07bce8b0ea0588" and "4c84ebad534bdac3d2061db69082960c50856538" have entirely different histories.

1 changed files with 134 additions and 400 deletions

532
src/_port
View File

@ -3,7 +3,7 @@
# Description # Description
# ----------- # -----------
# #
# Completion script for MacPorts 2.12.1 (https://www.macports.org/). # Completion script for MacPorts (https://www.macports.org/).
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Authors # Authors
@ -43,309 +43,57 @@
# #
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# global variable
#_port_available_packages
#_port_installed_packages
_port() { _port() {
typeset -A opt_args local -a revupgrade_options select_options \
local context state line pseudo_common pseudo_advanced port_prefix
local curcontext="$curcontext"
local ret=1
local port_prefix=${commands[port]%/bin/port} local port_path=$(which port)
port_prefix=${port_path%/bin/port}
pseudo_common=(all current active inactive actinact installed uninstalled outdated
obsolete requested unrequested leaves rleaves)
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=(
'--summary:Display summary of selected 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)'
)
revupgrade_options=('--id-loadcmd-check:Run more checks against a special loadcommand in Mach-O binaries')
_arguments -s -C \ _arguments -s -C \
'-v[Verbose mode (generate verbose messages)]' \ '-v[Verbose mode (generate verbose messages)]' \
'-d[Debug mode (generate debugging messages, implies -v)]' \ '-d[Debug mode (generate debugging messages, implies -v)]' \
'-q[Quiet mode (suppress messages)]' \ '-q[Quiet mode (suppress messages)]' \
'-N[Non-interactive mode]' \ "-n[Don't upgrade dependencies (affects upgrade and install)]" \
"-n[Don't follow dependencies in upgrade (affects upgrade and install)]" \ "-R[Also upgrade dependents (only affects upgrade) - note that this does not upgrade dependents' dependencies]" \
"-R[Also upgrade dependents (only affects upgrade) ]" \ '-u[Uninstall non-active ports when upgrading and uninstalling]' \
'-u[Uninstall inactive ports when upgrading and uninstalling]' \ '-f[Force mode (ignore state file)]' \
'-y[Perform a dry run]' \ '-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)]' \ '-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)]' \ '-b[Binary-only mode (build and install from binary archives, ignore source, abort if no archive available)]' \
'-c[Autoclean mode (execute clean after install)]' \ '-c[Autoclean mode (execute clean after install)]' \
"-k[Keep mode (don't autoclean after install)]" \ "-k[Keep mode (don't autoclean after install)]" \
'-p[Despite any errors encountered, proceed to process multiple ports and commands]' \ '-D[Specify portdir]' \
'-o[Honor state files even if the Portfile has been modified since]' \ '-F[Read and process the file of commands specified by the argument.]' \
'-t[Enable trace mode debug facilities on platforms that support it]' \ '-p[Despite any errors encountered, proceed to process multiple ports and commands.]' \
'-f[Force mode, ignore state file]' \ '-y[Perform a dry run.]' \
'-D[Specify portdir]:dir:_files -/' \ '-t[Enable trace mode debug facilities on platforms that support it (macOS).]' \
'-F[Read and process the file of commands specified by the argument]:file:_files' \
"1:Port actions:_port_actions" \ "1:Port actions:_port_actions" \
'*::arg:->args' \ '::Per-action arguments:_port_dispatch' \
&& ret=0 && return 0
case "$state" in
(args)
local subcmd=$words[1]
local cache_policy
zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
zstyle ":completion:${curcontext}:" cache-policy ${cache_policy:-_port_caching_policy}
local -a log_phases=('fetch' 'checksum' 'extract' 'patch' 'configure' 'build' 'destroot')
local -a no_portname_commands=(
'help' 'diagnose' 'migrate' 'outdated' 'platform' 'provides' 'reclaim' 'restore'
'rev-upgrade' 'search' 'select' 'selfupdate' 'snapshot' 'sync' 'usage'
)
local -a show_installed_package_commands=(
contents deactivate setrequested space unsetrequested uninstall
)
local -a options=()
case $subcmd in
(activate|deactivate)
options+=('--no-exec[Do not execute any stored pre- or post-uninstall procedures]')
;;
(archivefetch)
options+=('-p[Proceed even if a port fails to fetch]')
;;
(fetch|checksum|extract|patch|configure|build|destroot|test)
options+=('--no-mirrors[Only fetch files from URLs in master_sites]')
;;
(bump)
options+=('--patch[Create a Portfile.patch file instead of directly overwriting the Portfile]')
;;
(clean)
options+=(
'--archive[Remove partially downloaded binary archives]'
'--dist[Delete source code archives, the so-called distfiles]'
'--logs[Delete log files]'
'--work[Delete the work directory of a port]'
'--all[Remove all temporary files]'
)
;;
(contents)
options+=(
"--size[Enable printing a human-readable representation of the files' size]"
'--units[Used in conjunction with --size to choose the unit in which the size is given]:units:_port_units'
)
;;
(deps|rdeps)
options+=(
'--index[Do not read Portfiles, but instead rely solely on the PortIndex information]'
'--no-build[Exclude dependencies only required at build time]'
'--no-test[Exclude test dependencies]'
)
if [[ $subcmd == "rdeps" ]]; then
options+=('--full[Display all branches of the dependency tree instead of listing each dependency only once]')
fi
;;
(diagnose)
options+=('--quiet[Only display warnings or errors]')
;;
(edit)
options+=('--editor[Use the specified editor]:editor')
;;
(help)
options+=('1:action:_port_actions')
;;
(info)
options+=(
'--index[Do not read the Portfile, but rely solely on the port index information]'
'--line[Print a single line for each port]'
'--pretty[Format the output in a convenient, human-readable fashion]'
'(--category --categories)'{--category,--categories}'[List the categories of a port]'
'--conflicts[List other ports that cannot be activate at the same time as the given port]'
'--depends_fetch[List the fetch dependencies of a port]'
'--depends_extract[List the extract dependencies of a port]'
'--depends_build[List the build dependencies of a port]'
'--depends_lib[List the lib dependencies of a port]'
'--depends_run[List the run dependencies of a port]'
'--depends[List the all dependencies of a port]'
'(--description --long_description)--description[Print the short description of a port]'
'(--description --long_description)--long_description[Print the long description of a port]'
'--epoch[List the epoch components of a MacPorts]'
'--version[List the version components of a MacPorts]'
'--revision[List the revision components of a MacPorts]'
'--fullname[Print name and the full MacPorts version tuple]'
'--heading[Like --fullname but including the categories]'
'--homepage[List the homepage of a port]'
'--license[Print the license that applies to the source code of a port]'
'(--maintainer --maintainers)'{--maintainer,--maintainers}"[List the email address(es) of a port's maintainer(s)]"
'--name[Print the name of a port]'
'--pathfiles[List the patches that will be applied to the port]'
'(--platform --platforms)'{--platform,--platforms}'[List the platforms supported by a port]'
"--portdir[Print the path to a port's directory]"
'--replaced_by[List the name of the port that replaces a port]'
"--subports[Print a list of subports defined by this port's Portfile]"
'(--variant --variants)'{--variant,--variants}'[List the variants defined by a port by name]'
)
;;
(install)
options+=(
'--allow-failing[Attempt installation even if the specified port is known to fail]'
'--no-replace[Attempt to install specified port even if it is replaced by another port]'
'--no-rev-upgrade[Do not run rev-upgrade after installation]'
'--unrequested[Do not mark the installed ports as requested]'
)
;;
(lint)
options+=('--nitpick[Enable additional checks that are mostly whitespace-related and best practices]')
;;
(log)
options+=(
'--level[Log level]:level:(error warn msg info debug)'
'--phase[Only print messages that were generated in the given installation phase]:phase:($log_phases)'
)
;;
(migrate)
options+=(
'--all[Migrate all ports including unrequested ones]'
'--continue[Continue with migration of ports]'
)
;;
(mirror)
options+=('--new[Delete the existing database of mirrored files and re-create it from scratch]')
;;
(provides)
options+=('*::file:_files')
;;
(reclaim)
options+=(
'--keep-build-deps[Consider build-time dependency ports to be considered needed]'
'(--enable-reminders --disable-reminders)--enable-reminders[Enable regular reminders to run "port reclaim"]'
'(--enable-reminders --disable-reminders)--disable-reminders[Disable reminders to run "port reclaim"]'
)
;;
(restore)
options+=(
'--snapshot-id[Restore the snapshot with the specified ID]:id:_port_snapshot_ids'
'--last[Restore the last created snapshot]'
'--all[Restore all ports in the snapshot including unrequested ones]'
)
;;
(rev-upgrade)
options+=('--id-loadcmd-check[Check the ID load command in each library installed by MacPorts]')
;;
(search)
options+=(
'--case-sensitive[Do not ignore case when searching for the given keyword]'
'(--exact --glob --regex)--exact[Search for the given string exactly]'
'(--exact --glob --regex)--glob[Treat the keyword(s) as wildcard]'
'(--exact --glob --regex)--regex[Treat the given string as a Tcl regular expression]'
'--line[Print one match per line]'
'(--category --categories)'{--category,--categories}'[Search the category]'
'--depends_fetch[Search the fetch dependencies of a port]'
'--depends_extract[Search the extract dependencies of a port]'
'--depends_build[Search the build dependencies of a port]'
'--depends_lib[Search the lib dependencies of a port]'
'--depends_run[Search the run dependencies of a port]'
'--depends[Search the all dependencies of a port]'
'(--description --long_description)--description[Test the search string against the description]'
'(--description --long_description)--long_description[Test the search string against the long description]'
'--homepage[Search for the keyword(s) in the homepage property]'
'(--maintainer --maintainers)'{--maintainer,--maintainers}"[Search for maintainers]"
'--name[Search in ports name]'
"--portdir[Test the search string against the path of the directory that contains the port]"
'(--variant --variants)'{--variant,--variants}'[Search for variant names]'
)
;;
(select)
options+=(
'--summary:Display summary of selected 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)'
'1:group:_port_select_groups'
'2:variant:_port_select_variants'
)
;;
(selfupdate)
options+=(
'--no-sync[Only check for updates and install if available]'
'--migrate[Rebuild even if no new version is available]'
'--rsync[Use the older rsync method for downloading the new version of MacPorts]'
)
;;
(snapshot)
options+=(
'--create[Create a new snapshot that records the current active ports]'
'--note[Label with the given note when creating a snapshot]:note'
'--list[Display a list of all snapshots that currently exist]'
'--diff[Display the differences between the given snapshot ID and currently installed ports]:id:_port_snapshot_ids'
'--all[Consider all ports when displaying diffs]'
'--delete[Delete the snapshot with the given ID number]:id:_port_snapshot_ids'
'--export[Generate a JSON representation of the snapshot with the given ID number]:id:_port_snapshot_ids'
'--import[Create a new snapshot from the information in the given file]:file:_files'
'(- *)--help[Display brief usage information]'
)
;;
(space)
options+=(
'--total[Only print the total amount of space used by all given ports]'
'--units[Choose the unit in which the size is given]:unit:_port_units'
)
;;
(uninstall)
options+=(
'--follow-dependents[Also uninstall all ports recursively depending directly or indirectly]'
'--follow-dependencies[Also recursively uninstall all ports that the given port depends on]'
'--no-exec[Do not execute any stored pre- or post-uninstall procedures]'
)
;;
(upgrade)
options+=(
'--enforce-variants[Upgrade all given ports and their dependencies]'
'--force[Ignore circumstances that would normally cause ports to be skipped]'
'--no-replace[Do not automatically install ports that replace a new-obsolete port you have installed]'
'--no-rev-upgrade[Do not run rev-upgrade after upgrading]'
)
;;
(variants)
options+=('--index[Do not read the Portfile]')
;;
esac
if (( $no_portname_commands[(Ie)$subcmd] )); then
_arguments \
$options[@] \
&& ret=0
else
local -a pseudo_port_names=(
all current active inactive actinact installed uninstalled outdated
obsolete requested unrequested leaves rleaves
)
local -a selectors=(
'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:'
'depof:' 'rdepof:' 'rdepends:' 'dependentof:' 'rdependentof:'
)
if (( $show_installed_package_commands[(Ie)$subcmd] )); then
_port_update_cache "installed"
_arguments \
$options[@] \
'1: :_port_installed_ports' \
'*: :_port_options' \
&& ret=0
else
_port_update_cache "all"
_arguments \
$options[@] \
'1: :_port_available_ports' \
'*: :_port_options' \
&& ret=0
fi
fi
;;
esac
return ret
} }
(( $+functions[_port_actions] )) || (( $+functions[_port_actions] )) ||
_port_actions() { _port_actions() {
local -a actions=( local -a actions
actions=(
'activate:Activate the given ports' 'activate:Activate the given ports'
'archive:Archive the given ports, i.e. install the port image but do not activate' 'archive:Archive the given ports, i.e. install the port image but do not activate'
'archivefetch:Fetch archive for the given ports' 'archivefetch:Fetch archive for the given ports'
@ -365,6 +113,7 @@ _port_actions() {
'distcheck:Checks if the given ports can be fetched from all of its master_sites' 'distcheck:Checks if the given ports can be fetched from all of its master_sites'
'distfiles:Returns a list of distfiles for the given port' 'distfiles:Returns a list of distfiles for the given port'
'dmg:Creates a dmg for each of the given ports' 'dmg:Creates a dmg for each of the given ports'
'dpkg:Creates a dpkg for each of the given ports'
'echo:Returns the list of ports the argument expands to' 'echo:Returns the list of ports the argument expands to'
'edit:Edit given ports' 'edit:Edit given ports'
'extract:Extract the downloaded files of the given ports' 'extract:Extract the downloaded files of the given ports'
@ -383,7 +132,6 @@ _port_actions() {
'log:Shows main log for given ports' 'log:Shows main log for given ports'
'logfile:Returns the log file path for each of the given ports' 'logfile:Returns the log file path for each of the given ports'
'mdmg:Creates a dmg containing an mpkg for each of the given ports and their dependencies' 'mdmg:Creates a dmg containing an mpkg for each of the given ports and their dependencies'
'migrate:Update MacPorts for a new platform'
'mirror:Fetches distfiles for the given ports' 'mirror:Fetches distfiles for the given ports'
'mpkg:Creates an mpkg for each of the given ports and their dependencies' 'mpkg:Creates an mpkg for each of the given ports and their dependencies'
'notes:Displays informational notes for each of the given ports' 'notes:Displays informational notes for each of the given ports'
@ -395,16 +143,14 @@ _port_actions() {
'rdependents:Recursive version of dependents' 'rdependents:Recursive version of dependents'
'rdeps:Display a recursive dependency listing for the given ports' 'rdeps:Display a recursive dependency listing for the given ports'
'reclaim:Reclaims disk space' 'reclaim:Reclaims disk space'
'reload:Restart daemon'
'restore:Restore snapshots of installed ports'
'rev-upgrade:Scan for broken binaries in the installed ports and rebuild them as needed' 'rev-upgrade:Scan for broken binaries in the installed ports and rebuild them as needed'
'rpm:Creates a rpm for each of the given ports'
'search:Search for a port' 'search:Search for a port'
'select:Select between multiple versions of a versioned port' 'select:Select between multiple versions of a versioned port'
'selfupdate:Upgrade MacPorts itself and run the sync target' 'selfupdate:Upgrade MacPorts itself and run the sync target'
'setrequested:Marks each of the given ports as requested' 'setrequested:Marks each of the given ports as requested'
'setunrequested:Marks each of the given ports as unrequested'
'snapshot:Create and manage snapshots of installed ports'
'space:Show the disk space used by the given ports' 'space:Show the disk space used by the given ports'
'srpm:Creates a srpm for each of the given ports'
'sync:Synchronize the set of Portfiles' 'sync:Synchronize the set of Portfiles'
'test:Run tests on each of the given ports' 'test:Run tests on each of the given ports'
'unarchive:Unarchive the destroot of the given ports from installed images' 'unarchive:Unarchive the destroot of the given ports from installed images'
@ -422,59 +168,60 @@ _port_actions() {
_describe -t actions 'actions' actions _describe -t actions 'actions' actions
} }
(( $+functions[_port_options] )) || _port_dispatch() {
_port_options() { local cache_policy
local current_arg=$words[CURRENT] zstyle -s ":completion:${curcontext}:" cache-policy cache_policy
zstyle ":completion:${curcontext}:" cache-policy ${cache_policy:-_port_caching_policy}
# complete variants case "$words[2]" in
if [[ $current_arg == +* || $current_arg == -* ]]; then provides)
IPREFIX=$current_arg[1] _files
PREFIX=$current_arg[2,-1] ;;
_port_variants $words[2] search)
_message 'pattern'
;;
help)
_port_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 -q echo installed") )
_store_cache PORT_INSTALLED_PACKAGES _port_installed_packages
fi fi
}
(( $+functions[_port_available_ports] )) ||
_port_available_ports() {
_alternative \
'ports:Available ports:($_port_available_packages)' \
'pseudo-common:Common Pseudo-portnames:($pseudo_port_names)' \
'selectors:Pseudo portname selectors:($selectors)'
}
(( $+functions[_port_installed_ports] )) ||
_port_installed_ports() {
_alternative \ _alternative \
"ports:Installed ports:($_port_installed_packages)" \ "ports:Installed ports:($_port_installed_packages)" \
"pseudo-common:Common Pseudo-portnames:($pseudo_port_names)" \ "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \
"selectors:Pseudo portname selectors:($selectors)" "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)"
}
(( $+functions[_port_caching_policy] )) ||
_port_caching_policy() {
local reg_time comp_time check_file
zmodload -F zsh/stat b:zstat 2> /dev/null
case "${1##*/}" in
(PORT_INSTALLED_PACKAGES)
check_file=$port_prefix/var/macports/registry/registry.db
;; ;;
(PORT_AVAILABLE_PACKAGES) upgrade)
check_file=${$(port dir MacPorts)%/*/*}/PortIndex # No good reason to actually cache outdated ports list
local outdated_packages
outdated_packages=( $(_call_program path-outdated "port -q echo outdated") )
_alternative -- \
"upgrade-options:Upgrade options:_port_upgrade_options" \
"ports:Outdated ports:($outdated_packages)" \
"pseudo-common:Common Pseudo-portnames:($pseudo_common)" \
"pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)"
;; ;;
esac rev-upgrade)
if (( CURRENT == 3 )); then
reg_time=$(zstat +mtime $check_file) _describe 'Rev-upgrade options' revupgrade_options
comp_time=$(zstat +mtime $1) fi
return $(( reg_time < comp_time )) ;;
} outdated|sync)
# No need to complete anything more here.
(( $+functions[_port_update_cache] )) || return 0;
_port_update_cache() { ;;
local cache_type=$1 selfupdate)
_all_labels 'Selfupdate options' '--nosync'
case "$cache_type" in ;;
(all) *)
# Cache the list of all ports. # Cache the list of all ports.
if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) && if ( [[ ${+_port_available_packages} -eq 0 ]] || _cache_invalid PORT_AVAILABLE_PACKAGES ) &&
! _retrieve_cache PORT_AVAILABLE_PACKAGES; ! _retrieve_cache PORT_AVAILABLE_PACKAGES;
@ -482,68 +229,55 @@ _port_update_cache() {
_port_available_packages=( $(_call_program path-all "port -q echo all") ) _port_available_packages=( $(_call_program path-all "port -q echo all") )
_store_cache PORT_AVAILABLE_PACKAGES _port_available_packages _store_cache PORT_AVAILABLE_PACKAGES _port_available_packages
fi fi
;; _alternative \
(installed) "ports:Available ports:($_port_available_packages)" \
if ( [[ ${+_port_installed_packages} -eq 0 ]] || _cache_invalid PORT_INSTALLED_PACKAGES ) && "pseudo-common:Common Pseudo-portnames:($pseudo_common)" \
! _retrieve_cache PORT_INSTALLED_PACKAGES; "pseudo-advanced:Advanced Pseudo-portnames:($pseudo_advanced)"
then
_port_installed_packages=( $(_call_program path-all "port -q echo installed") )
_store_cache PORT_INSTALLED_PACKAGES _port_installed_packages
fi
;; ;;
esac esac
} }
(( $+functions[_port_select_groups] )) || (( $+functions[_port_upgrade_options] )) ||
_port_select_groups() { _port_upgrade_options() {
local -a groups=($port_prefix/etc/select/*(N:t)) local -a options
_describe "Port select groups" groups options=(
} '--enforce-variants:Upgrade all given ports and their dependencies'
'--force:Ignore circumstances that would normally cause ports to be skipped'
(( $+functions[_port_select_variants] )) || '--no-replace:Do not automatically install ports that replace a new-obsolete port you have installed'
_port_select_variants() { '--no-rev-upgrade:Do not run rev-upgrade after upgrading'
local group=$words[2]
local -a variants=("${(f)$(port select --list $group | awk '/^[ \t]+/{print $1}')}")
_describe "Port select group $words[4] variants" variants
}
(( $+functions[_port_snapshot_ids] )) ||
_port_snapshot_ids() {
local -a snapshot_ids=()
if (( $+commands[perl] )); then
local perl_expr='m{^\s+(\d+)\s+(.*)$} and printf "%s:%s\n", $1, $2'
snapshot_ids=("${(f)$(port snapshot --list | perl -wln -e $perl_expr)}")
else
local awk_expr='NR > 2 { printf("%s:%s %s\n", $1, $2, $3) }'
snapshot_ids=("${(f)$(port snapshot --list | awk $awk_expr)}")
fi
_describe "Port snapshot IDs" snapshot_ids
}
(( $+functions[_port_variants] )) ||
_port_variants() {
local name=$1
if (( $+commands[perl] )); then
local -a variants=($(port variants $name | perl -wln -e 'm{^(?:\s+|\[\+\])([^:]+):} and print $1'))
if [[ ${#variants} != 0 ]]; then
_values 'variant' $variants
fi
fi
}
(( $+functions[_port_units] )) ||
_port_units() {
local -a units=(
"B[List sizes in bytes]"
{K,Ki,KiB}"[List sizes in KiB, 1024 bytes]"
{Mi,MiB}'[List sizes in MiB, 1024 * 1024 bytes]'
{Gi,GiB}'[List sizes in GiB, 1024 * 1024 * 1024 bytes]'
{k,kB}'[List sizes in kB, 1000 bytes]'
{M,MB}'[List sizes in kB, 1000 * 1000 bytes]'
{G,GB}'[List sizes in kB, 1000 * 1000 * 1000 bytes]'
) )
_values 'unit' $units
_describe -t options 'options' options
}
_port_select() {
if (( CURRENT == 3 )); then
_describe 'Port select options' select_options
elif (( CURRENT == 4 )); then
local select_group=($port_prefix/etc/select/*(N:t))
_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 check_file
zmodload -F zsh/stat b:zstat 2> /dev/null
case "${1##*/}" in
PORT_INSTALLED_PACKAGES)
check_file=$port_prefix/var/macports/registry/registry.db
;;
PORT_AVAILABLE_PACKAGES)
check_file=${$(port dir MacPorts)%/*/*}/PortIndex
;;
esac
reg_time=$(zstat +mtime $check_file)
comp_time=$(zstat +mtime $1)
return $(( reg_time < comp_time ))
} }
_port "$@" _port "$@"