| |
}
|
| |
|
| |
_pkg_config_opts() {
|
| - |
local -a _pkg_opts
|
| - |
_pkg_opts=(
|
| - |
'ABI[ABI of the package you want to install]:string:'
|
| - |
'ALIAS[Define local aliases for various pkg(8) standard command lines]:key/value list:'
|
| - |
'DEFAULT_ALWAYS_YES[Default to "yes" for all questions requiring user confirmation]:boolean:(yes no)'
|
| - |
'ASSUME_ALWAYS_YES[Assumes "yes" to all questions requiring user confirmation]:boolean:(yes no)'
|
| - |
'CONSERVATIVE_UPGRADE[Give priority to the repo where a package was first installed from]:boolean:(yes no)'
|
| - |
'CUDF_SOLVER[Experimental\: use an external CUDF solver]:CUDF solver:_files'
|
| - |
'CASE_SENSITIVE_MATCH[Case sensitive package matching]:boolean:(yes no)'
|
| - |
'DEBUG_LEVEL[Debugging level]:debug level:( {0..4} )'
|
| - |
'DEVELOPER_MODE[Makes certain errors immediately fatal, adds warnings and suggestions]:boolean:(yes no)'
|
| - |
'EVENT_PIPE[Send all event messages to specified FIFO or UNIX socket]:event pipe:_files'
|
| - |
'FETCH_RETRY[Number of times to retry a failed fetch of a file]:number of retries:'
|
| - |
'FETCH_TIMEOUT[Number of seconds to wait for a file to download]:timeout (seconds):'
|
| - |
'HANDLE_RC_SCRIPTS[Automatically perform start/stop of service on install/removal]:boolean:(yes no)'
|
| - |
'INDEXDIR[The directory to search for INDEXFILE in]: : _files -/'
|
| - |
'INDEXFILE[The ports index file]: : _files'
|
| - |
'IP_VERSION[Restrict network access to specified IP version]:IP version:((0\:"system default" 4\:IPv4 6\:IPv6 ))'
|
| - |
'LOCK_RETRIES[Number of retries to obtain a lock]:retries:'
|
| - |
'LOCK_WAIT[Wait time in seconds to regain a lock]:wait time (seconds):'
|
| - |
'NAMESERVER[Hostname or IPv\[46\] address of a nameserver for DNS resolution]: : _hosts'
|
| - |
'PERMISSIVE[Ignore conflicts while registering a package]:boolean:(yes no)'
|
| - |
'PKG_CACHEDIR[Specifies the cache directory for packages]: : _files -/'
|
| - |
'PKG_CREATE_VERBOSE[Make pkg_create(8) use verbose mode]:boolean:(yes no)'
|
| - |
'PKG_DBDIR[Specifies the directory to use for storing the package database files]: : _files -/'
|
| - |
'PKG_ENABLE_PLUGINS[Activate plugin support]:boolean:(yes no)'
|
| - |
'PKG_ENV[key/value pair of environment variables]:key/value list:'
|
| - |
'PKG_PLUGINS_DIR[Specific directory for plugins]: : _files -/'
|
| - |
'PKG_SSH_ARGS[Extra arguments for ssh(1)]:ssh(1) arguments:'
|
| - |
'PLIST_KEYWORDS_DIR[Directory containing definitions of plist keywords]: : _files -/'
|
| - |
'PLIST_ACCEPT_DIRECTORIES[Accept directories listed like plain files in plist]:boolean:(yes no)'
|
| - |
'PLUGINS[List of plugins pkg(8) should load]:plugins:'
|
| - |
'PLUGINS_CONF_DIR[Directory containing per-plugin configurations files]: : _files -/'
|
| - |
'PORTSDIR[Specifies the location to the Ports directory]: : _files -/'
|
| - |
'REPOS_DIR[List of directories to search for repository configuration files]: : _files -/' # completing one directory is better than nothing.
|
| - |
'REPO_AUTOUPDATE[Automatically check for repo.sqlsite updates]:boolean:(yes no)'
|
| - |
'RUN_SCRIPTS[Run pre-/post-installation action scripts]:boolean:(yes no)'
|
| - |
'SAT_SOLVER[Experimental\: use an external SAT solver]:SAT solver:_files'
|
| - |
'SQLITE_PROFILE[Profile SQLite queries]:boolean:(yes no)'
|
| - |
'SSH_RESTRICT_DIR[Directory which the ssh subsystem will be restricted to]:chroot:_files -/'
|
| - |
'SYSLOG[Log install/deinstall/upgrade operations to syslog(3)]:boolean:(yes no)'
|
| - |
'UNSET_TIMESTAMP[Do not include timestamps in the package tar(1) archive]:boolean:(yes no)'
|
| - |
'VERSION_SOURCE[Default database for comparing version numbers in pkg-version(8)]:database:(( I\:index P\:ports R\:remote ))'
|
| - |
'VULNXML_SITE[Specifies the URL to fetch the vuln.xml vulnerability database from]: : _urls -F "( gopher:* file:* ftp:* )"'
|
| - |
'WORKERS_COUNT[How many workers are used for pkg-repo]:workers:( {0..$(sysctl -n hw.ncpu)} )'
|
| - |
)
|
| - |
_values 'configuration option' "$_pkg_opts[@]"
|
| + |
_values 'configuration option' \
|
| + |
'ABI[ABI of package you want to install]:string' \
|
| + |
'ALIAS[define local aliases for various pkg(8) standard command lines]:key/value list' \
|
| + |
'AUTOCLEAN[cleanout content of cache directory after upgrades or installations]:boolean:(yes no)' \
|
| + |
'DEFAULT_ALWAYS_YES[default to "yes" for all questions requiring user confirmation]:boolean:(yes no)' \
|
| + |
'ASSUME_ALWAYS_YES[assume "yes" to all questions requiring user confirmation]:boolean:(yes no)' \
|
| + |
'CONSERVATIVE_UPGRADE[give priority to repo where a package was first installed from]:boolean:(yes no)' \
|
| + |
'CUDF_SOLVER[experimental\: use an external CUDF solver]:CUDF solver:_files' \
|
| + |
'CASE_SENSITIVE_MATCH[case-sensitive package matching]:boolean:(yes no)' \
|
| + |
'DEBUG_LEVEL[debugging level]:debug level:( {0..4} )' \
|
| + |
'DEBUG_SCRIPTS[activate debug mode (set -x) for scripts]:boolean:(yes no)' \
|
| + |
'DEVELOPER_MODE[make certain errors immediately fatal, adds warnings and suggestions]:boolean:(yes no)' \
|
| + |
'EVENT_PIPE[send all event messages to specified FIFO or UNIX socket]:event pipe:_files' \
|
| + |
'FETCH_RETRY[number of times to retry a failed fetch of a file]:number of retries' \
|
| + |
'FETCH_TIMEOUT[time to wait for a file to download]:timeout (seconds)' \
|
| + |
'HANDLE_RC_SCRIPTS[automatically perform start/stop of service on install/removal]:boolean:(yes no)' \
|
| + |
'HTTP_USER_AGENT[define User-agent HTTP header to send]:user agent' \
|
| + |
'INDEXDIR[directory to search for ports index file in]:directory:_files -/' \
|
| + |
'INDEXFILE[ports index file]:index file:_files' \
|
| + |
'IP_VERSION[restrict network access to specified IP version]:IP version:((0\:"system default" 4\:IPv4 6\:IPv6 ))' \
|
| + |
'LOCK_RETRIES[number of retries to obtain a lock]:retries' \
|
| + |
'LOCK_WAIT[wait time to regain a lock]:wait time (seconds):' \
|
| + |
'NAMESERVER[hostname or IPv\[46\] address of a nameserver for DNS resolution]:name server:_hosts' \
|
| + |
'PERMISSIVE[ignore conflicts while registering a package]:boolean:(yes no)' \
|
| + |
'PKG_CACHEDIR[specify cache directory for packages]:directory:_files -/' \
|
| + |
'PKG_CREATE_VERBOSE[make pkg_create(8) use verbose mode]:boolean:(yes no)' \
|
| + |
'PKG_DBDIR[specify directory to use for storing package database files]:directory:_files -/' \
|
| + |
'PKG_ENABLE_PLUGINS[activate plugin support]:boolean:(yes no)' \
|
| + |
'PKG_ENV[key/value pair of environment variables]:key/value list' \
|
| + |
'PKG_PLUGINS_DIR[specify directory for plugins]:directory:_files -/' \
|
| + |
'PKG_SSH_ARGS[extra arguments for ssh(1)]:ssh(1) arguments' \
|
| + |
'PLIST_KEYWORDS_DIR[directory containing definitions of plist keywords]:directory:_files -/' \
|
| + |
'PLIST_ACCEPT_DIRECTORIES[accept directories listed like plain files in plist]:boolean:(yes no)' \
|
| + |
'PLUGINS[list of plugins pkg(8) should load]:plugins' \
|
| + |
'PLUGINS_CONF_DIR[directory containing per-plugin configurations files]:directory:_files -/' \
|
| + |
'PORTSDIR[specify location of ports directory]:directory:_files -/' \
|
| + |
'READ_LOCK[use read locking for query database]:boolean:(yes no)' \
|
| + |
'REPOS_DIR[list of directories to search for repository configuration files]: : _sequence _directories' \
|
| + |
'REPO_AUTOUPDATE[automatically check for repo.sqlsite updates]:boolean:(yes no)' \
|
| + |
'RUN_SCRIPTS[run pre-/post-installation action scripts]:boolean:(yes no)' \
|
| + |
'SAT_SOLVER[experimental\: use an external SAT solver]:SAT solver:_files' \
|
| + |
'SQLITE_PROFILE[profile SQLite queries]:boolean:(yes no)' \
|
| + |
'SSH_RESTRICT_DIR[directory which ssh subsystem will be restricted to]:chroot:_files -/' \
|
| + |
'SYSLOG[log install/deinstall/upgrade operations to syslog(3)]:boolean:(yes no)' \
|
| + |
"UNSET_TIMESTAMP[don't include timestamps in package tar(1) archive]:boolean:(yes no)" \
|
| + |
'VERSION_SOURCE[default database for comparing version numbers in pkg-version(8)]:database:(( I\:index P\:ports R\:remote ))' \
|
| + |
'VULNXML_SITE[specify URL to fetch vuln.xml vulnerability database from]: : _urls -F "( gopher:* file:* ftp:* )"' \
|
| + |
'WORKERS_COUNT[how many workers are used for pkg-repo]:workers:( {0..$(sysctl -n hw.ncpu)} )'
|
| |
}
|
| |
|
| |
_pkg() {
|
| - |
local curcontext="$curcontext" state state_descr line ret=1
|
| - |
local earlyargs subcmd
|
| - |
local subcmd_list cmd
|
| - |
earlyargs=(
|
| - |
'(-d --debug)'{-d,--debug}'[increment debug level]'
|
| - |
'(-j --jail)'{-j,--jail}'[execute pkg(8) inside a jail(8)]:jail:_jails'
|
| - |
'(-c --chroot)'{-c,--chroot}'[execute pkg(8) inside a chroot(8)]:chroot:_files -/'
|
| - |
\*{-o,--option}'[set configuration option]:option:_pkg_config_opts'
|
| - |
'(-C --config)'{-C,--config}'[use the specified configuration file]:configuration file:_files'
|
| - |
'(-l --list)'{-l,--list}'[list available command and exit]'
|
| - |
'(-v --version)'{-v,--version}'[display pkg(8) version]'
|
| - |
'-N[test if pkg(8) is activated and avoid auto-activation]'
|
| - |
'(-R --repo-conf-dir)'{-R,--repo-conf-dir}'[specify directory for per-repository configuration files]: : _files'
|
| - |
'-4[use IPv4 for fetching repository and packages]'
|
| - |
'-6[use IPv6 for fetching repository and packages]'
|
| - |
)
|
| + |
local curcontext="$curcontext" state state_descr line expl ret=1
|
| + |
local subcmd
|
| |
|
| |
subcmd=(
|
| |
'add[compatibility interface to install a package]'
|
| |
'which[display which package installed a specific file]'
|
| |
)
|
| |
|
| - |
if [[ $service = "pkg" ]]; then
|
| + |
_arguments -C \
|
| + |
'(-d --debug)'{-d,--debug}'[increment debug level]' \
|
| + |
'(-j --jail)'{-j,--jail}'[execute pkg(8) inside a jail(8)]:jail:_jails' \
|
| + |
'(-c --chroot)'{-c,--chroot}'[execute pkg(8) inside a chroot(8)]:chroot:_files -/' \
|
| + |
\*{-o,--option}'[set configuration option]:option:_pkg_config_opts' \
|
| + |
'(-C --config)'{-C,--config}'[use the specified configuration file]:configuration file:_files' \
|
| + |
'(-l --list)'{-l,--list}'[list available command and exit]' \
|
| + |
'(-v --version)'{-v,--version}'[display pkg(8) version]' \
|
| + |
'-N[test if pkg(8) is activated and avoid auto-activation]' \
|
| + |
'(-R --repo-conf-dir)'{-R,--repo-conf-dir}'[specify directory for per-repository configuration files]: : _files' \
|
| + |
'-4[use IPv4 for fetching repository and packages]' \
|
| + |
'-6[use IPv6 for fetching repository and packages]' \
|
| + |
'1:sub command:_values "pkg subcommand" $subcmd' \
|
| + |
'*::command:->subcmd' && return
|
| |
|
| - |
_arguments -C -A "-*" \
|
| - |
$earlyargs \
|
| - |
'*::command:->subcmd' && return
|
| - |
|
| - |
if (( CURRENT == 1 )); then
|
| - |
_values 'pkg subcommands' \
|
| - |
$subcmd
|
| - |
return
|
| - |
fi
|
| - |
service="$words[1]"
|
| - |
curcontext="${curcontext%:*}-$service:"
|
| - |
fi
|
| + |
state=()
|
| + |
service="$words[1]"
|
| + |
curcontext="${curcontext%:*}-$service:"
|
| |
|
| |
case $service in
|
| |
(add)
|
| - |
_arguments -C -A 'package' \
|
| - |
'(-A --automatic)'{-A,--automatic}'[Mark the installed packages as automatic]' \
|
| - |
'(-f --force)'{-f,--force}'[Force the reinstallation of package]' \
|
| - |
'(-I --no-scripts)'{-I,--no-scripts}'[Ignore pre-/post-install scripts]' \
|
| - |
'(-M --accept-missing)'{-M,--accept-missing}'[Ignore missing dependencies when installing]' \
|
| - |
'(-q --quiet)'{-q,--quiet}'[Force quiet output]' \
|
| - |
'*:package:->packages'
|
| + |
_arguments -C -A '-*' -s \
|
| + |
'(-A --automatic)'{-A,--automatic}'[mark the installed packages as automatic]' \
|
| + |
'(-f --force)'{-f,--force}'[force the reinstallation of package]' \
|
| + |
'(-I --no-scripts)'{-I,--no-scripts}'[ignore pre-/post-install scripts]' \
|
| + |
'(-M --accept-missing)'{-M,--accept-missing}'[ignore missing dependencies when installing]' \
|
| + |
'(-q --quiet)'{-q,--quiet}'[force quiet output]' \
|
| + |
'*:package:->packages' && ret=0
|
| |
|
| |
if [[ $state[1] == packages ]]; then
|
| - |
local ret=1
|
| - |
_tags packages urls
|
| - |
while _tags; do
|
| - |
if _requested packages; then
|
| - |
_files -g "*.t?z" && ret=0
|
| - |
fi
|
| - |
if _requested urls; then
|
| - |
_urls -F "( gopher:* file:* )" && ret=0
|
| - |
fi
|
| - |
(( ret )) || break
|
| - |
done
|
| - |
return
|
| + |
_alternative \
|
| + |
'packages:file:_files -f "*.t?z(-.)"' \
|
| + |
'urls: : _urls -F "( gopher:* file:* )"' && ret=0
|
| |
fi
|
| - |
return
|
| + |
return ret
|
| |
;;
|
| |
(alias)
|
| |
_arguments -A '-*' -s \
|
| |
_arguments -A '-*' -s \
|
| |
'(-B --shlibs)'{-B,--shlibs}'[reanalyze the shared libraries]' \
|
| |
'(-d --dependencies)'{-d,--dependencies}'[check for and install missing dependencies]' \
|
| - |
'(-r --recompute)'{-r,--recompute}'[recompute sizes and checksums of installed]' \
|
| + |
'(-r --recompute)'{-r,--recompute}'[recompute sizes and checksums of installed packages]' \
|
| |
'(-s --checksums)'{-s,--checksums}'[find invalid checksums]' \
|
| |
'(-v --verbose)'{-v,--verbose}'[be verbose]' \
|
| - |
'(-n --dry-run)'{-n,--dry-run}'[check for missing dependencies but do not install them]' \
|
| + |
'(-n --dry-run)'{-n,--dry-run}"[check for missing dependencies but don't install them]" \
|
| |
'(-y --yes)'{-y,--yes}'[assume yes for confirmations]' \
|
| |
'(-q --quiet)'{-q,--quiet}'[force quiet output]' \
|
| |
'(-a --all -i --case-insensitive -C --case-sensitive)'{-i,--case-insensitive}'[case insensitive pattern matching]' \
|
| |
'(-a --all -i --case-insensitive -C --case-sensitive)'{-C,--case-sensitive}'[case sensitive pattern matching]' \
|
| - |
${words[(r)(-*a*|--all)]+!}'*:available package:_pkg_installed' \
|
| + |
'*:available package:_pkg_installed' \
|
| |
- '(all)' \
|
| - |
'(-i --case-insensitive -C --case-sensitive)'{-a,--all}'[process all packages]' \
|
| + |
'(* -i --case-insensitive -C --case-sensitive)'{-a,--all}'[process all packages]' \
|
| |
- '(patterns)' \
|
| |
{-x,--regex}'[process packages that match the regex pattern]' \
|
| |
{-g,--glob}'[process packages that match the glob pattern]'
|