Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: update option completion for openbsd
- X-seq: zsh-workers 41855
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: update option completion for openbsd
- Date: Wed, 11 Oct 2017 00:57:01 +0200
- Authentication-results: amavisd4.gkg.net (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.co.uk
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1507676232; bh=kOrb8d4Fqy9XtxQj8JgPfno8hrDdCaazWCDPbXIy8kA=; h=From:To:Subject:Date:From:Subject; b=KUa4Nrq7fwNv1ixw61cMii/GO8cwyLb10bgWPHVaK1En2Uwni0ecAFJnPueLGfqJXr4jcTp9GcIx9WgfPmuILkW82uafnMJPUXqlWmHHFChxNOhwHFU4WQJbO+cZysOjWz7nGbz9uRg4o5EvXNOjRkCv3Nwb1v3P7yTNXBh5jL4KGR2WVnLKurqwR4oVFgEZ/oq+jc3AuPwcrdz/2NVWC3a79ChcYVYjQGO6Fcuz60IJ0YzTDLnHvtU2v3gytvqtz9drUfirb/dpbjCc34aSdBxMG3Kyl0wCh9j9NfBshZDlXRrSGR/nE0/CyNQmoslCEdGZPEJ/ZqzBkUiCxMGD3A==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
In the newly released OpenBSD 6.2, id, rm and dhclient gained a new
option or two. I now keep a VM image for the purpose of detecting these
things easily. ping and cp also had differences but those were added
in other recent patches. pfctl also gained a couple of options but the
completion was missing some older changes and had some FreeBSD things
hardcoded so the changes to that function are somewhat bigger.
In the process, I also noticed that _rm had no handling for darwin so I've
updated that based on online manpages.
There may be other commands with changes that I don't cover in my diffs
and/or where the completion needs a lot more work besides. For example,
the pkg_add, pkg_delete stuff. Our existing completions for these were
written for FreeBSD which isn't a whole lot of use now given that FreeBSD
has moved on to a newer and much improved system.
Oliver
diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl
index f9cc9276a..23898882f 100644
--- a/Completion/BSD/Command/_pfctl
+++ b/Completion/BSD/Command/_pfctl
@@ -4,23 +4,20 @@ local pfctl_flush_modifiers pfctl_optimizer_level pfctl_show_modifiers pfctl_tab
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'
@@ -37,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'
@@ -49,65 +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)
}
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'
+ '-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'
+ '-S+[store pf state table in the specified file]:file:_files'
+ '-V+[select routing domain to be used to kill states]:routing domain'
)
;;
- freebsd*)
+ (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]'
- '-P[display ports numerically]'
'-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:_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[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:_tables' \
- '-v[produce more verbose output]' \
- '-x[set the debug level]:debug level:(($pfctl_debug_level))' \
- '-z[clear per-rule statistics]'
+ '-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/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient
index a9f06d81f..af38a28e6 100644
--- a/Completion/Unix/Command/_dhclient
+++ b/Completion/Unix/Command/_dhclient
@@ -7,13 +7,13 @@ case $OSTYPE in
args+=(
'-c+[specify configuration file]:file:_files'
'-l+[specify leases file]:file:_files'
- '-u[reject leases with unknown options]'
)
;|
freebsd*)
args+=(
'(-d)-b[immediately move to the background]'
'-p+[specify PID file]:file:_files'
+ '-u[reject leases with unknown options]'
)
;;
openbsd*)
diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id
index 74fe6d9e1..95580ba76 100644
--- a/Completion/Unix/Command/_id
+++ b/Completion/Unix/Command/_id
@@ -16,7 +16,7 @@ if _pick_variant gnu=GNU $OSTYPE --version; then
'(- :)--version[display version]' \
':user:_users'
else
- choices="-A -a -c -G -g -M -p -P -u"
+ choices="-A -a -c -G -g -M -p -P -R -u"
args=(
"($choices)-g[print only EGID]"
"($choices -r)-G[print all GIDs]"
@@ -31,6 +31,9 @@ else
'(-g -G -u -n -r)-p[show project membership]'
)
;;
+ openbsd*)
+ args+=( '(-)-R[display the routing table of the current process]' )
+ ;;
darwin*|dragonfly*|freebsd*)
args+=( '(-)-P[print id in the form of a password file entry]' )
;|
diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm
index 6d728b157..912b5eadf 100644
--- a/Completion/Unix/Command/_rm
+++ b/Completion/Unix/Command/_rm
@@ -24,16 +24,20 @@ if _pick_variant gnu=gnu unix --help; then
else
args=(${args:#*)--*\[*})
case $OSTYPE in
- dragonfly*|freebsd*|netbsd*|openbsd*)
+ darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
args+=(
'-d[remove directories as well]'
'-P[overwrite files before deleting them]'
+ '-v[explain what is being done]'
+ )
+ ;|
+ darwin*|dragonfly*|freebsd*|netbsd*)
+ args+=(
+ '-W[attempt to undelete named files]'
)
;|
dragonfly*|freebsd*|netbsd*)
args+=(
- '-v[explain what is being done]'
- '-W[attempt to undelete named files]'
"-x[don't cross file systems when removing a hierarchy]"
)
;|
Messages sorted by:
Reverse Date,
Date,
Thread,
Author