summaryrefslogtreecommitdiff
path: root/Completion/BSD
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/BSD')
-rw-r--r--Completion/BSD/Command/_bsd_pkg250
-rw-r--r--Completion/BSD/Command/_chflags66
-rw-r--r--Completion/BSD/Command/_jail53
-rw-r--r--Completion/BSD/Command/_jexec2
-rw-r--r--Completion/BSD/Command/_pfctl135
-rw-r--r--Completion/BSD/Command/_portsnap2
-rw-r--r--Completion/BSD/Command/_sysrc10
-rw-r--r--Completion/BSD/Type/_fbsd_architectures6
-rw-r--r--Completion/BSD/Type/_file_flags70
-rw-r--r--Completion/BSD/Type/_nbsd_architectures11
-rw-r--r--Completion/BSD/Type/_obsd_architectures6
11 files changed, 381 insertions, 230 deletions
diff --git a/Completion/BSD/Command/_bsd_pkg b/Completion/BSD/Command/_bsd_pkg
index 9f4b0f11a..d8928afaf 100644
--- a/Completion/BSD/Command/_bsd_pkg
+++ b/Completion/BSD/Command/_bsd_pkg
@@ -7,14 +7,20 @@ _bsd_pkg_pkgfiles() {
case $OSTYPE in
netbsd*)
portsdir=/usr/pkgsrc
+ pkgsdir=${PACKAGES:-$portsdir/packages}/All
+ ;;
+ openbsd*)
+ portsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PORTSDIR*}#*=[[:blank:]]#}
+ portsdir=${${portsdir:-$PORTSDIR}:-/usr/ports}
+ pkgsdir=${${(M)${(f)"$(</etc/mk.conf)"}:#PACKAGE_REPOSITORY*}#*=[[:blank:]]#}
+ pkgsdir=${${pkgsdir:-$PACKAGE_REPOSITORY}:-$portsdir/packages/}/$(make -V MACHINE_ARCH)/All
;;
*)
portsdir=${PORTSDIR:-/usr/ports}
+ pkgsdir=${PACKAGES:-$portsdir/packages}/All
;;
esac
- pkgsdir=${PACKAGES:-$portsdir/packages}/All
-
paths=( "${(@)${(@s.:.)PKG_PATH}:#}" )
_files "$@" -g '*.t[bg]z(-.)' && ret=0
(( $#path )) && _files "$@" -W paths -g '*.t[bg]z(-.)' && ret=0
@@ -47,171 +53,197 @@ _bsd_pkg() {
case "$service" in
pkg_add)
flags=(
- '-f[force installation]'
- '-I[don'\''t execute installation scripts]'
- '-M[run in master mode]'
- '-n[don'\''t really install packages]'
- '-p[specify prefix]:prefix directory:_files -/'
- '-R[don'\''t record]'
- '-S[run in slave mode]'
- '-t[specify mktemp template]:mktemp template:_files -/'
+ "-n[don't really install packages]"
'-v[be verbose]'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '-r[fetch from remote site]'
- )
- ;;
netbsd*)
- flags=(
- $flags[@]
- '-u[update]'
- '-V[show version and exit]'
+ flags+=(
+ '-A[do not record packages as installed manually]'
+ '-C[specify configuration file]:config file:_files'
+ '-D[force updating even if dependencies are not satisfied]'
+ '-f[force installation]'
+ "-I[don't execute installation scripts]"
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-m[specify machine architecture]:architecture:_netbsd_architectures'
+ '-P[specify destdir prefix]:destdir directory:_files -/'
+ '-p[specify prefix]:prefix directory:_files -/'
+ "-R[don't record]"
+ '-U[replace an already installed version]'
+ '-u[update]'
+ '-V[show version and exit]'
+ '*:package to install:_bsd_pkg_pkgfiles'
)
;;
+ openbsd*)
+ flags+=(
+ '-A[arch to assume for any package tests]:architecture:_obsd_architectures'
+ '-a[do not record packages as installed manually]'
+ '-aa[force already installed packages to be tagged as installed automatically]'
+ '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-c[while replacing packages, delete extra configuration file in the old package]'
+ '-D[specify failsafe to waive]:failsafe:((
+ allversions\:"do not trim older p* variants of packages for updates"
+ arch\:"architecture recorded in package may not match"
+ checksum\:"verify checksums before deleting or tying old files"
+ dontmerge\:"do not merge updates together if dependencies are too strict"
+ donttie\:"do not try to find new files in old packages by comparing the stored sha256"
+ downgrade\:"do not filter out package versions older than what is currently installed"
+ installed\:"in update mode, reinstall an existing package with the same update signature"
+ libdepends\:"library specifications may not be fulfilled"
+ nonroot\:"install even if not running as root"
+ paranoid\:"do not run any @exec/@unexec"
+ repair\:"attempt to repair installed packages with missing registration data"
+ scripts\:"external scripts may fail"
+ SIGNER\:"list of trusted signers, separated by commas"
+ snap\:"force %c and %m to expand to snapshots"
+ unsigned\:"allow the installation of unsigned packages without warnings/errors"
+ updatedepends\:"force update even if forward dependencies no longer match"
+ ))'
+ '-I[force non-interactive mode]'
+ '-i[force interactive mode]'
+ '-L[specify a localbase]:localbase:_files -/'
+ '-l[specify pkg_info output file to install]:pkg_info file:_files'
+ '-m[always display progress meter]'
+ '-P[check distribution permissions]:permission type:(cdrom ftp)'
+ "-qq[don't check checksums]"
+ '-r[replace existing packages]'
+ "-s[don't install; just report disk size changes]"
+ '-U[update dependencies before installing]'
+ '-u[update the specified package or all if none given]'
+ '-V[turn on statistics output]'
+ '-x[disable progress meter]'
+ '-z[fuzzy package matching]'
+ )
esac
- _arguments -s \
- $flags[@] \
- '*:package to install:_bsd_pkg_pkgfiles'
+ _arguments -s $flags[@]
;;
pkg_create)
case "$OSTYPE" in
- freebsd*)
- flags=(
- '-f[specify plist file]:plist file:_files'
- '(-b)-c[specify comment file]:comment file:_files'
- '(-b)-d[specify descr file]:descr file:_files'
- '-Y[assume YES for any questions asked]'
- '-N[assume NO for any questions asked]'
- '(-b)-O[packing list only mode]'
- '-v[be verbose]'
- '-h[force tar to follow symlinks]'
- '(-b)-i[specify pre-install script]:pre-install script:_files'
- '(-b)-I[specify post-install script]:post-install script:_files'
- '(-b)-P[specify initial dependencies]:dependencies:_bsd_pkg_pkgs'
- '(-b)-p[specify prefix]:prefix directory:_files -/'
- '(-b)-k[specify deinstall script]:deinstall script:_files'
- '(-b)-K[specify post-deinstall script]:post-deinstall script:_files'
- '(-b)-r[specify req script]:req script:_files'
- '(-b)-s[specify source directory]:source directory:_files -/'
- '(-b)-t[specify mktemp template]:mktemp template:_files'
- '(-b)-X[specify exclude file]:exclude file for tar:_files'
- '(-b)-D[specify message file]:message file:_files'
- '(-b)-m[specify mtree file]:mtree file:_files'
- '(-b)-o[specify origin]:origin:_files -W ${PORTSDIR\:-/usr/ports} -/'
- '-j[use bzip2]'
- '-z[use gzip]'
- '(-c -d -O -i -I -P -p -k -K -r -s -t -X -D -m -o)-b[specify pkgname]:pkgname:_bsd_pkg_pkgs'
- '*:package file name:_files'
- )
- ;;
netbsd*)
# NetBSD users, improve me!
flags=(
- '*:package name:_bsd_pkg_pkgs'
+ '*:package name:_bsd_pkg_pkgs'
)
;;
esac
- _arguments -s \
- $flags[@]
- ;;
+ _arguments -s $flags[@]
+ ;;
pkg_delete)
flags=(
- '-D[don'\''t execute deinstallation scripts]'
- '-d[remove empty directories]'
- '-f[force deinstallation]'
- '-n[don'\''t really deinstall packages]'
- '-p[specify prefix]:prefix directory:_files -/'
+ "-n[don't really deinstall packages]"
'-v[be verbose]'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '(:)-a[delete all installed packages]'
- '-G[do not expand glob patterns]'
- '-i[be interactive]'
- '-r[delete recursively]'
- '-x[use regular expression]'
- )
- ;;
netbsd*)
- flags=(
- $flags[@]
- '(:)-a[delete all installed packages]'
- '-F[specify each package by an installed file]'
- '-i[be interactive]'
- '-O[only delete the package'\''s entries]'
+ flags+=(
+ '(:)-a[delete all installed packages]'
+ "-D[don't execute deinstallation scripts]"
+ '-F[specify each package by an installed file]'
+ '-f[force deinstallation]'
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ "-O[only delete the package's entries]"
+ '-P[specify destdir prefix]:destdir directory:_files -/'
+ '-p[specify prefix]:prefix directory:_files -/'
'-R[delete upward recursively]'
'-r[delete recursively]'
- '-V[show version and exit]'
+ '-V[show version and exit]'
+ '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ )
+ ;;
+ openbsd*)
+ flags+=(
+ '-a[delete unused dependencies]'
+ '-B[specify destdir prefix]:destdir directory:_files -/'
+ '-D[specify failsafe to waive]:failsafe:((
+ baddepend\:"force deletion of packages even if they reference nonexistent dependencies"
+ checksum\:"verify checksums before deleting or tying old files"
+ dependencies\:"delete the set of packages that depend upon the requested packages"
+ nonroot\:"install even if not running as root"
+ scripts\:"external scripts may fail"
+ ))'
+ '-I[force non-interactive mode]'
+ '-i[force interactive mode]'
+ '-m[always display progress meter]'
+ "-qq[don't check checksums]"
+ "-s[don't install; just report disk size changes]"
+ '-V[turn on statistics output]'
+ '-X[delete everything, except the specified packages]'
+ '-x[disable progress meter]'
+ '*:package name:_bsd_pkg_pkgs_and_files'
)
;;
esac
- _arguments -s \
- $flags[@] \
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ _arguments -s $flags[@]
;;
pkg_info)
flags=(
'(:)-a[show all installed packages]'
'-c[show comment fields]'
- '-D[show install-message files]'
'-d[show long descriptions]'
'-e[test if package is installed]:package name:_bsd_pkg_pkgs'
'-f[show packing list instructions]'
'-I[show index lines]'
- '-i[show install scripts]'
- '-k[show deinstall scripts]'
'-L[show full pathnames of files]'
'-l[specify prefix string]:prefix string:'
- '-m[show mtree files]'
- '-p[show installation prefixes]'
'-q[be quiet]'
'-R[show list of installed requiring packages]'
- '-r[show requirements scripts]'
+ '-s[show total size occupied by each package]'
'-v[be verbose]'
+ '(-a -A)*:package name:_bsd_pkg_pkgs_and_files'
)
case "$OSTYPE" in
- freebsd*)
- flags=(
- $flags[@]
- '-G[do not expand glob patterns]'
- '-g[show files that'\''s modified]'
- '-o[show origin]'
- '-s[show total size occupied by each package]'
- '-t[specify mktemp template]:mktemp template:_files -/'
- '*-W[show which package the file belongs to]:file:_files'
- '-x[use regular expression]'
+ netbsd*)
+ flags+=(
+ '-B[show build information]'
+ '-b[show RCS Id strings]'
+ '-D[show install-message files]'
+ '-F[specify each package by an installed file]'
+ '-i[show install scripts]'
+ '-K[override PKG_DBDIR]:pkg_dbdir:_files -/'
+ '-k[show deinstall scripts]'
+ '-m[show mtree files]'
+ '-N[show which packages each package was built with]'
+ '-n[show which packages each package needs]'
+ '-p[show installation prefixes]'
+ '-Q[show the definition of the speficied variable from the build information]:variable:'
+ '-r[show list of installed requiring packages recursively]'
+ '-S[show total size occupied by each package and its dependents]'
+ '-u[show information for all user-installed packages]'
+ '-V[show version and exit]'
+ '-X[print summary information]'
)
;;
- netbsd*)
- flags=(
- $flags[@]
- '-B[show build information]'
- '-b[show RCS Id strings]'
- '-F[specify each package by an installed file]'
- '-S[show total size occupied by each package and its dependents]'
- '-s[show total size occupied by each package]'
- '-V[show version and exit]'
+ openbsd*)
+ flags+=(
+ '(:)-A[show all installed packages, including internal packages]'
+ '-C[show certificate information]'
+ '-E[show the package that contains the speficied file]:file:_files'
+ # XXX only with -L
+ '-K[prefix filenames with category keywords]'
+ '-M[show the install-message file]'
+ '-m[only show manual installations]'
+ '-P[show the pkgpath]'
+ '-Q[show packages matching the specified query]:query:'
+ '-r[check the list of packages for a specified pkgspec]:pkgspec:'
+ '-S[show the update signature]'
+ '-t[show packages not required by any other]'
+ '-U[show the deinstall-message file]'
+ '-z[fuzzy package matching]'
)
;;
esac
- _arguments -s \
- $flags[@] \
- '(-a)*:package name:_bsd_pkg_pkgs_and_files'
+ _arguments -s $flags[@]
;;
esac
}
diff --git a/Completion/BSD/Command/_chflags b/Completion/BSD/Command/_chflags
index 075782cd9..924b09acd 100644
--- a/Completion/BSD/Command/_chflags
+++ b/Completion/BSD/Command/_chflags
@@ -1,64 +1,8 @@
#compdef chflags
-local flags args own='-g *(-u$EUID)'
+local args own='-g *(-u$EUID)'
-addflags() {
- for 1 2; do
- if [[ $1 = no* ]]; then
- flags+=("(${1#no})$1[set the $2 flag]"
- "($1)${1#no}[unset the $2 flag]")
- else
- flags+=("(no$1)$1[set the $2 flag]"
- "($1)no$1[unset the $2 flag]")
- fi
- done
-}
-
-addflags \
- uappnd 'user append-only' \
- uchg 'user immutable'
-
-if (( ! EUID )); then
- addflags \
- arch archived \
- nodump nodump \
- sappnd 'system append-only' \
- schg 'system immutable'
- unset own
-fi
-
-if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then
- addflags opaque opaque
-
- if [[ $OSTYPE = darwin* ]]; then
- addflags hidden hidden
- fi
-
- if [[ $OSTYPE = (dragonfly|freebsd)* ]]; then
- addflags uunlnk 'user undeletable'
- (( EUID )) || addflags sunlnk 'system undeletable'
- fi
-
- [[ $OSTYPE = dragonflybsd* ]] && {
- addflags \
- cache XXX \
- nouhistory 'user nohistory'
-
- (( EUID )) || addflags \
- noscache XXX \
- noshistory 'system nohistory'
- }
-
- [[ $OSTYPE = freebsd* ]] && addflags \
- uarch archive \
- uhidden hidden \
- uoffline offline \
- urdonly 'DOS, Windows and CIFS readonly' \
- ureparse 'Windows reparse point' \
- usparse 'sparse file' \
- usystem 'DOS, Windows and CIFS system'
-
-fi
+(( ! EUID || $+_comp_priv_prefix )) && own=
if [[ $OSTYPE = (darwin|dragonfly|freebsd)* ]]; then
args=(
@@ -68,12 +12,12 @@ if [[ $OSTYPE = (darwin|dragonfly|freebsd)* ]]; then
fi
_arguments -s -A "-*" : $args \
+ ': :_file_flags' \
+ '*:file:_files "$own"' \
- opth \
'-h[act on symlinks]' \
- optR \
'-R[recurse directories]' \
'(-L -P)-H[follow symlinks on the command line (specify with -R)]' \
'(-H -P)-L[follow all symlinks (specify with -R)]' \
- '(-L -H)-P[do not follow symlinks (specify with -R)]' \
- ':file flag:_values -s , "file flags" $flags[@]' \
- '*:file:_files "$own"'
+ '(-L -H)-P[do not follow symlinks (specify with -R)]'
diff --git a/Completion/BSD/Command/_jail b/Completion/BSD/Command/_jail
new file mode 100644
index 000000000..26d0a6a87
--- /dev/null
+++ b/Completion/BSD/Command/_jail
@@ -0,0 +1,53 @@
+#compdef jail
+
+local curcontext="$curcontext" ret=1
+local -a state state_descr line jails running alts suf
+local -A opt_args
+
+_arguments -C -s \
+ '-c[create a new jail]' \
+ '-m[modify an existing jail]' \
+ '-r[remove specified jail]' \
+ '-d[allow changes to a dying jail]' \
+ '-f+[specify configuration file]:config file [/etc/jail.conf]:_files' \
+ '-h[resolve host.hostname and use IP addresses for the jail]' \
+ '(-q)-i[output jail ID of new jails]' \
+ '-J+[write a file containing parameters used to start the jail]:file:_files' \
+ '-p+[limit the number of commands from exec.* that can run simultaneously]:limit' \
+ '(-i -v)-q[suppress the message printed when a jail is created, modified or removed]' \
+ '-R[remove jail without using the configuration file]' \
+ '(-q)-v[print a message on every operation]' \
+ '!-n+:name' '!-l' '!-s+:secure level' \!-{u,U}'+:user:_users' \
+ '*:: :->args' && ret=0
+
+if [[ -n $state ]]; then
+ if compset -P 1 '(^name)='; then
+ case ${IPREFIX%=} in
+ command|exec.*st(art|op)*) _cmdstring && ret=0 ;;
+ depend) _jails && ret=0 ;;
+ path) _directories && ret=0 ;;
+ host|vnet) alts=( 'values:value:(inherit new)' ) ;;
+ ip[46]) alts=( 'values:value:(inherit new disable)' ) ;;
+ *_user) _users && ret=0 ;;
+ *) _message -e values 'value' ;;
+ esac
+ elif compset -P name= || [[ $#line = 1 ]]; then
+ if (( $+opt_args[-r] || $+opt_args[-m] )); then
+ alts=( 'jails:jail:_jails' )
+ elif (( $+opt_args[-c] )); then
+ running=( ${${(f)"$(_call_program jails jls name)"}/ /:} )
+ jails=( ${${(M)${(f)"$(<${opt_args[-f]:-/etc/jail.conf})"}:#[a-z]# #\{#(#e)}%% *} )
+ alts=( "jails:jail:compadd - ${jails:|running}" )
+ fi
+ fi
+ if [[ -z $IPREFIX ]]; then
+ compset -S '=*' || suf=( -qS = )
+ alts+=(
+ 'parameters:parameter:compadd -r "\n\t\- =" - persist allow.{set_hostname,sysvipc,raw_sockets,chflags,mount{,.devfs,.fdescfs,.nullfs,.procfs,.linprocfs,.linsysfs,.tmpfs,.zfs},quotas,socket_af} mount.{devfs,fdescfs,procfs}'
+ 'parameters:parameter:compadd $suf - jid name path ip{4,6}{,.addr{,sel}} vnet host.hostname host securelevel devfs_ruleset children.{max,cur} enforce_statfs cpuset.id osrelease osreldate command exec.{{,pre,post}{start,stop},clean,jail_user,system{,_jail}_user,timeout,consolelog,fib} stop.timeout {vnet.,}interface ip_hostname mount{,.fstab} depend'
+ )
+ fi
+ (( $#alts )) && _alternative $alts && ret=0
+fi
+
+return ret
diff --git a/Completion/BSD/Command/_jexec b/Completion/BSD/Command/_jexec
index 85829d10e..6a2d05a81 100644
--- a/Completion/BSD/Command/_jexec
+++ b/Completion/BSD/Command/_jexec
@@ -4,7 +4,7 @@ _jexec_normal() {
local PATH=$PATH
local -a _comp_priv_prefix
# relative paths are relative to the jail's root
- path=( "$(command jls -j $words[1] path)"/$^path )
+ path=( "$(_call_program paths jls -j $words[1] path)"/$^path )
shift 1 words; (( CURRENT-- ))
_normal
}
diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl
index 1a2345b66..23898882f 100644
--- a/Completion/BSD/Command/_pfctl
+++ b/Completion/BSD/Command/_pfctl
@@ -1,25 +1,23 @@
#compdef pfctl
local pfctl_flush_modifiers pfctl_optimizer_level pfctl_show_modifiers pfctl_tables_command pfctl_debug_level
+local -a args
pfctl_flush_modifiers=(
- 'all:flush all'
- 'info:flush the filter information'
- 'nat:flush the NAT rules'
- 'osfp:flush the passive operating system fingerprints'
- 'queue:flush the queue rules'
- 'rules:flush the filter rules'
- 'state:flush the stable table'
- 'Sources:flush the source tracking table'
- 'Tables:flush the tables'
+ 'rules:flush the filter rules'
+ 'states:flush the stable table'
+ 'Sources:flush the source tracking table'
+ 'info:flush the filter information'
+ 'Tables:flush the tables'
+ 'osfp:flush the passive operating system fingerprints'
+ 'all:flush all'
)
pfctl_show_modifiers=(
- 'nat:show the currently loaded NAT rules'
'queue:show the currently loaded queue rules'
'rules:show the currently loaded filter rules'
'Anchors:show the currently loaded anchors directly attached to the main ruleset'
- 'state:show the contents of the state table'
+ 'states:show the contents of the state table'
'Sources:show the contents of the source tracking table'
'info:show filter information'
'labels:show per-rule statistics of filter rules with labels'
@@ -36,6 +34,7 @@ pfctl_optimizer_level=(
'basic:enable basic ruleset optimizations'
'profile:enable basic ruleset optimizations with profiling'
)
+
pfctl_tables_command=(
'kill:kill a table'
'flush:flush all addresses of a table'
@@ -48,49 +47,75 @@ pfctl_tables_command=(
'zero:clear all the statistics of a table'
'load:load only the table definitions from pf.conf(5)'
)
-pfctl_debug_level=(
- "none:don\'t generate debug messages"
- 'urgent:generate debug messages only for serious errors'
- 'misc:generate debug messages for various errors'
- 'loud:generate debug messages for common conditions'
-)
-_iface() {
- local pfctl_iface
- pfctl_iface=($(pfctl -s Interfaces))
- compadd $pfctl_iface
+
+_pf_ifaces() {
+ compadd "$@" - $(_call_program tables pfctl -s Interfaces)
}
-_tables() {
- local pfctl_tables
- pfctl_tables=($(pfctl -s Tables))
- compadd $pfctl_tables
+
+_pf_tables() {
+ compadd "$@" - $(_call_program tables pfctl -s Tables)
}
-# TODO:
-# Missing -a
-#
-_arguments -s \
- '-F[flush the filter parameters specified by modifier]:modifier:(($pfctl_flush_modifiers))' \
- '-A[load only the queue rules present in the rule file]' \
- '-D[define macro to be set to value]:macro:' \
- '-d[disable the packet filter]' \
- '-e[enable the packet filter]' \
- '-f[load the rules contained in a file]:configuration file:_files' \
- '-g[include output helpful for debugging]' \
- '-h[help]' \
- '-i[restrict the operation to the given interface]:interface:_iface' \
- '-K[kill all of the source tracking entries originating from the specified host or network]:host or network:_hosts' \
- '-k[kill all of the state entries originating from the specified host or network]:host or network:_hosts' \
- '-m[merge in explicitly given options]' \
- '-N[load only the NAT rules present in the rule file]' \
- '-n[do not actually load rules, just parse them]' \
- '-O[load only the options present in the rule file]' \
- '-o[control the ruleset optimizer]:level:(($pfctl_optimizer_level))' \
- '-p[use the device file device instead of the default /dev/pf]:device:_files' \
- '-q[only print errors and warnings]' \
- '-R[load only the filter rules present in the rule file]' \
- '-r[perform reverse DNS lookups on states when displaying them]' \
- '-s[show the filter parameters specified by modifier]:modifier:(($pfctl_show_modifiers ))' \
- '-T[specify the command to apply to the table]:command:(($pfctl_tables_command))' \
- '-t[specify the name of the table]:table:_tables' \
- '-v[produce more verbose output]' \
- '-x[set the debug level]:debug level:(($pfctl_debug_level))' \
- '-z[clear per-rule statistics]'
+
+case $OSTYPE in
+ openbsd*)
+ pfctl_debug_level=(
+ emerg alert crit err warning notice info debug
+ )
+ args=(
+ '-L+[load pf states from specified state file]:file:_files'
+ "-N[don't perform domain name resolution]"
+ '-P[display ports using service names]'
+ '-S+[store pf state table in the specified file]:file:_files'
+ '-V+[select routing domain to be used to kill states]:routing domain'
+ )
+ ;;
+ (free|net)bsd*)
+ pfctl_debug_level=(
+ "none:don\'t generate debug messages"
+ 'urgent:generate debug messages only for serious errors'
+ 'misc:generate debug messages for various errors'
+ 'loud:generate debug messages for common conditions'
+ )
+ pfctl_flush_modifiers+=(
+ 'nat:flush the NAT rules'
+ 'queue:flush the queue rules'
+ )
+ pfctl_show_modifiers+=(
+ 'nat:show the currently loaded NAT rules'
+ )
+ args=(
+ '-A[load only the queue rules present in the rule file]'
+ '-N[load only the NAT rules present in the rule file]'
+ '-O[load only the options present in the rule file]'
+ '-R[load only the filter rules present in the rule file]'
+ )
+ ;|
+ freebsd*)
+ args+=( '-P[display ports numerically]' )
+ ;;
+esac
+
+_arguments -s $args \
+ '-a[apply flags -f, -F, and -s only to the rules in the specified anchor]:anchor' \
+ '-F+[flush the filter parameters specified by modifier]:modifier:(($pfctl_flush_modifiers))' \
+ '-D+[define macro to be set to value]:macro' \
+ '(-e)-d[disable the packet filter]' \
+ '(-D)-e[enable the packet filter]' \
+ '-f+[load the rules contained in a file]:configuration file:_files' \
+ '-g[include output helpful for debugging]' \
+ '(-)-h[display help information]' \
+ '-i[restrict the operation to the given interface]:interface:_pf_ifaces' \
+ '*-K[kill all of the source tracking entries originating from the specified host or network]:host or network:_hosts' \
+ '*-k[kill all of the state entries originating from the specified host or network]:host or network:_hosts' \
+ '-m[merge in explicitly given options without disturbing others]' \
+ "-n[don't actually load rules, just parse them]" \
+ '-o+[control the ruleset optimizer]:level:(($pfctl_optimizer_level))' \
+ '-p+[use the device file device instead of the default /dev/pf]:device:_files' \
+ '-q[only print errors and warnings]' \
+ '-r[perform reverse DNS lookups on states when displaying them]' \
+ '-s+[show the filter parameters specified by modifier]:modifier:(($pfctl_show_modifiers))' \
+ '-T+[specify the command to apply to the table]:command:(($pfctl_tables_command))' \
+ '-t[specify the name of the table]:table:_pf_tables' \
+ '-v[produce more verbose output]' \
+ '-x+[set the debug level]:debug level:(($pfctl_debug_level))' \
+ '-z[clear per-rule statistics]'
diff --git a/Completion/BSD/Command/_portsnap b/Completion/BSD/Command/_portsnap
index 0803a842e..b8e1c2555 100644
--- a/Completion/BSD/Command/_portsnap
+++ b/Completion/BSD/Command/_portsnap
@@ -1,6 +1,6 @@
#compdef portsnap
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line flags
typeset -A opt_args
flags=(
diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc
index 246d73bd3..f0c12a2be 100644
--- a/Completion/BSD/Command/_sysrc
+++ b/Completion/BSD/Command/_sysrc
@@ -44,9 +44,13 @@ _sysrc() {
local k v opt
if (( $+opt_args[lista--L] )); then
_services && ret=0
- elif [[ -prefix *=* ]]; then
- # do you really want to go down this hole?
- _message -e values value
+ elif compset -P 1 '*='; then
+ case $IPREFIX in
+ *_enable=) _wanted values expl value compadd YES NO && ret=0 ;;
+ *_program=) _files -g "*(-*)" && ret=0 ;;
+ *_interface(|s)=) _net_interfaces && ret=0 ;;
+ *) _message -e values value ;;
+ esac
else
if zstyle -T ":completion:${curcontext%:*}:values" verbose; then
opt=d
diff --git a/Completion/BSD/Type/_fbsd_architectures b/Completion/BSD/Type/_fbsd_architectures
new file mode 100644
index 000000000..24bdf4620
--- /dev/null
+++ b/Completion/BSD/Type/_fbsd_architectures
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" amd64 arm arm64 i386 mips ppc sparc xbox
diff --git a/Completion/BSD/Type/_file_flags b/Completion/BSD/Type/_file_flags
new file mode 100644
index 000000000..95044121c
--- /dev/null
+++ b/Completion/BSD/Type/_file_flags
@@ -0,0 +1,70 @@
+#autoload
+
+# Provides completion for file flags (formerly part of _chflags)
+
+local curcontext=$curcontext su=$(( ! EUID || $+_comp_priv_prefix ))
+local -a context line state state_descr copts=( "${@}" ) flags flag_descs
+local -A val_args
+
+flag_descs+=(
+ uappnd 'user append-only'
+ uchg 'user immutable'
+)
+
+if (( su )); then
+ flag_descs+=(
+ arch archived
+ nodump nodump
+ sappnd 'system append-only'
+ schg 'system immutable'
+ )
+fi
+
+if [[ $OSTYPE = (darwin|dragonfly|freebsd|netbsd)* ]]; then
+ flag_descs+=(opaque opaque)
+
+ if [[ $OSTYPE = darwin* ]]; then
+ flag_descs+=(hidden hidden)
+ fi
+
+ if [[ $OSTYPE = (dragonfly|freebsd)* ]]; then
+ flag_descs+=(uunlnk 'user undeletable')
+
+ (( su )) &&
+ flag_descs+=(sunlnk 'system undeletable')
+ fi
+
+ if [[ $OSTYPE = dragonfly* ]]; then
+ flag_descs+=(
+ cache XXX
+ nouhistory 'user nohistory'
+ )
+
+ (( su )) && flag_descs+=(
+ noscache XXX
+ noshistory 'system nohistory'
+ )
+ fi
+
+ [[ $OSTYPE = freebsd* ]] && flag_descs+=(
+ uarch archive
+ uhidden hidden
+ uoffline offline
+ urdonly 'DOS, Windows and CIFS readonly'
+ ureparse 'Windows reparse point'
+ usparse 'sparse file'
+ usystem 'DOS, Windows and CIFS system'
+ )
+fi
+
+for 1 2 in $flag_descs; do
+ if [[ $1 = no* ]]; then
+ flags+=("(${1#no})$1[set the $2 flag]"
+ "($1)${1#no}[unset the $2 flag]")
+ else
+ flags+=("(no$1)$1[set the $2 flag]"
+ "($1)no$1[unset the $2 flag]")
+ fi
+done
+
+_values -O copts -s , 'file flags' $flags
diff --git a/Completion/BSD/Type/_nbsd_architectures b/Completion/BSD/Type/_nbsd_architectures
new file mode 100644
index 000000000..441b874da
--- /dev/null
+++ b/Completion/BSD/Type/_nbsd_architectures
@@ -0,0 +1,11 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" amd64 evbarm evbmips evbppc hpcarm i386 sparc64 xen \
+ acorn32 algor alpha amiga amigappc arc atari bebox cats cesfic cobalt dreamcast \
+ emips epoc32 evbsh3 ews4800mips hp300 hppa hpcmips hpcsh ia64 ibmnws iyonix \
+ landisk luna68k mac68k macppc mipsco mmeye mvme68k mvmeppc netwinder news68k \
+ newsmips next68k ofppc pmax prep rs6000 sandpoint sbmips sgimips shark sparc \
+ sun2 sun3 vax x68k zaurus
diff --git a/Completion/BSD/Type/_obsd_architectures b/Completion/BSD/Type/_obsd_architectures
new file mode 100644
index 000000000..ca3e0e12f
--- /dev/null
+++ b/Completion/BSD/Type/_obsd_architectures
@@ -0,0 +1,6 @@
+#autoload
+
+local expl
+
+_description architectures expl 'architecture'
+compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk longson luna88k macppc octeon sgi sparc64