Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: update completions for FreeBSD 13
- X-seq: zsh-workers 48618
- From: Oliver Kiddle <opk@xxxxxxx>
- To: Zsh workers <zsh-workers@xxxxxxx>
- Subject: PATCH: update completions for FreeBSD 13
- Date: Mon, 19 Apr 2021 01:13:37 +0200
- Archived-at: <https://zsh.org/workers/48618>
- List-id: <zsh-workers.zsh.org>
This makes completion updates corresponding to changes in FreeBSD 13.
In general, I was able to update patterns matched against $OSTYPE so
on FreeBSD 12 and earlier, completions continue to work as before.
The ancient GPL2 GNU grep was replaced with BSD licenced code so
there was quite a few changes for that. It is fairly compatible but
_pick_variants was selecting the minimal option sets for it. I've added
rgrep to the list of commands _grep completes for.
ping is the other big change because it appears to have been merged
with ping6 and the options made more consistent.
date, netstat, readelf (from elftoolchain) and uname all saw very minor
option changes.
Oliver
diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date
index dc447e06d..97c272830 100644
--- a/Completion/Unix/Command/_date
+++ b/Completion/Unix/Command/_date
@@ -64,7 +64,7 @@ else
"*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]"
)
;|
- freebsd*|darwin*)
+ freebsd<-12>.*|darwin*)
args+=(
'-d+:daylight saving time value'
'-t+:minutes west of GMT'
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 81516b08a..2dcbff4a3 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -1,6 +1,7 @@
-#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default-
+#compdef grep egrep fgrep bsdgrep rgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default-
-local arguments matchers command variant
+local command variant
+local -a arguments matchers
if [[ $service = *GREP_OPT* ]]; then
compset -q
@@ -27,6 +28,10 @@ if [[ $service != (|g|z|gz|bz)[ef]grep ]]; then
$matchers{--basic-regexp,-G}'[use basic regular expression]'
)
fi
+[[ $service = rgrep ]] || arguments+=(
+ '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)'
+ '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]'
+)
arguments+=(
'(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines'
@@ -37,7 +42,6 @@ arguments+=(
'(--byte-offset -b -c)'{--byte-offset,-b}'[print the byte offset with output lines]'
'(--text -a -I)--binary-files=[specify type to assume for binary files]:file type:(binary without-match text)'
'(--count -c --byte-offset -b --line-number -n)'{--count,-c}'[only print a count of matching lines]'
- '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)'
'(--devices -D)'{--devices=,-D+}'[specify handling of devices, FIFOs and sockets]:action on device:(read skip)'
'(1)*'{--regexp=,-e+}'[specify pattern]:pattern'
'(1)*'{--file=,-f+}'[specify pattern file]:file:_files'
@@ -53,11 +57,10 @@ arguments+=(
'(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]'
'(--only-matching -o --files-with-matches -l --files-without-match -L)'{--only-matching,-o}'[show only matching part of line]'
'(--quiet --silent -q)'{--quiet,--silent,-q}'[suppress normal output]'
- '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]'
'*--include=[examine files matching specified pattern]:file pattern'
'*--exclude=[skip files matching specified pattern]:file pattern'
'*--exclude-dir=[skip directories matching specified pattern]:directory pattern'
- '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable]'
+ '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable or non-existent files]'
'(--version -V)'{--version,-V}'[display version info]'
'(--invert-match -v)'{--invert-match,-v}'[select non-matching lines]'
'(--word-regexp -w --line-regexp -x)'{--word-regexp,-w}'[force pattern to match only whole words]'
@@ -72,6 +75,12 @@ case $variant:$OSTYPE in
$matchers{--perl-regexp,-P}'[use perl regular expression]'
)
;|
+ *:openbsd*|unix:freebsd*)
+ arguments=( # argument to context is optional and after = only
+ ${arguments:#((#s)|*\))-(C|-context)*}
+ '(--context -C)'{--context=-,-C-}'[specify lines of context]::lines'
+ )
+ ;|
(gnu:*|gpl2:(free|net)bsd*))
arguments+=(
'*--exclude-from=[skip files matching pattern in specified file]:file:_files'
@@ -85,15 +94,15 @@ case $variant:$OSTYPE in
'(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]"
)
;|
- gpl2:darwin*)
+ (gpl2:darwin*|unix:freebsd*))
arguments+=(
- '(-p -S)-O[follow symlinks on the command line]'
- '(-O -S)-p[do not follow symlinks]'
- '(-O -p)-S[follow all symlinks]'
+ '(-p -S)-O[recurse symlinks on the command line]'
+ "!(-O -S)-p[don't recurse symlinks]"
+ '(-O -p)-S[recurse all symlinks]'
'*--include-dir=[only search directories matching specified pattern]:directory pattern'
)
;|
- (gnu:*|gpl2:netbsd*))
+ (gnu:*|gpl2:netbsd*|unix:freebsd*))
arguments+=(
'(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after each filename]'
)
@@ -106,6 +115,15 @@ case $variant:$OSTYPE in
'(--recursive -r --dereference-recursive -R -d --directories)'{--dereference-recursive,-R}'[recurse subdirectories, following symlinks]'
)
;;
+ unix:freebsd*)
+ arguments+=(
+ '!(-U --binary --binary-files)'{-U,--binary}
+ '--mmap[use mmap(2) instead of read(2) to read input]'
+ )
+ [[ $service = rgrep ]] || arguments+=(
+ '(--recursive -r -d --directories)-R[recurse subdirectories]'
+ )
+ ;;
gpl2:*) arguments=( ${${arguments:#*\)-r}/\)-r/\)-R} ) ;;
*:openbsd*)
arguments=(
@@ -122,4 +140,3 @@ case $variant:$OSTYPE in
esac
_arguments -S -s $arguments[@]
-
diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat
index 84d5dc2f2..aa6c92fde 100644
--- a/Completion/Unix/Command/_netstat
+++ b/Completion/Unix/Command/_netstat
@@ -303,6 +303,12 @@ case $OSTYPE in
memory+=( $Xopt) statistics+=( $Xopt )
pcb+=( $Mopts $popt )
;;
+ freebsd<13->.*)
+ sockets+=(
+ '-c[show TCP stack used for each session]'
+ '-C[show TCP congestion control algorithm and diagnostic]'
+ )
+ ;&
freebsd<11->.*)
routing+=( '-F+[show specified routing table]:routing table' )
bpf=( '-z[reset statistic counters after displaying them]' )
diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping
index 274204264..e69173430 100644
--- a/Completion/Unix/Command/_ping
+++ b/Completion/Unix/Command/_ping
@@ -11,7 +11,6 @@ case ${variant}:${${service#ping}:-4} in
args+=(
'-d[set SO_DEBUG on the socket]'
'-n[show network addresses as numbers]'
- '-M+[define mtu discovery]:mtu discovery:(do dont want)'
'-v[verbose output]'
)
;|
@@ -35,7 +34,7 @@ case ${variant}:${${service#ping}:-4} in
iputils:*|solaris:*|((free|net)bsd|darwin|dragonfly)*:4)
args+=( '-r[bypass normal routing tables]' )
;|
- iputils:*|((free|net)bsd|darwin|dragonfly)*:4)
+ (iputils|freebsd<13->.*):*|(freebsd<-12>.|netbsd|darwin|dragonfly)*:4)
args+=( '-a[audible bell for each packet]' )
;|
iputils:*|netbsd*:4|openbsd*)
@@ -49,6 +48,9 @@ case ${variant}:${${service#ping}:-4} in
(*bsd|darwin|dragonfly)*)
args+=( '-I+[specify source interface for multicast packets]:interface:_net_interfaces' )
;|
+ freebsd<13->.*|openbsd*)
+ args+=( '-H[try reverse-lookups of addresses]' )
+ ;|
freebsd*|darwin*|dragonfly*|netbsd*:6)
args+=( '-S+[specify source address]:source address' )
;|
@@ -58,10 +60,13 @@ case ${variant}:${${service#ping}:-4} in
(*bsd|darwin|dragonfly)*:4)
args+=( "-D[set the don't fragment bit]" )
;|
+ (freebsd|openbsd|darwin)*:6)
+ args+=( '-D[disable IPv6 fragmentation]' )
+ ;|
((free|net)bsd|darwin|dragonfly)*:4)
args+=( '-Q[somewhat quiet]')
;|
- freebsd*:6|darwin*:6|solaris*|netbsd*)
+ freebsd<-12>.*:6|darwin*:6|solaris*|netbsd*)
args+=(
'*-g+[specify gateway to use as the next hop to the destination]:gateway:_hosts'
)
@@ -71,10 +76,14 @@ case ${variant}:${${service#ping}:-4} in
;|
((free|net)bsd|darwin|dragonfly)*:6)
args+=(
- '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
'-b+[set socket buffer size]:buffer size'
- '-H[try reverse-lookups of IPv6 addresses]'
'-N[probe node information multicast group address]'
+ )
+ ;|
+ (freebsd<-12>.|netbsd|darwin|dragonfly)*:6)
+ args+=(
+ '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
+ '-H[try reverse-lookups of IPv6 addresses]'
'(-s)-t[generate ICMPv6 Node Information supported query types query]'
'(-s)-w[generate ICMPv6 Node Information DNS Name query]' '!(-s)-W'
)
@@ -91,30 +100,54 @@ case ${variant}:${${service#ping}:-4} in
'-N+[specify a next-hop router that the probe packet should go through]:router:_hosts'
)
;|
- (freebsd|darwin|dragonfly)*:4)
+ freebsd<13->.*:6|(freebsd|darwin|dragonfly)*:4)
args+=(
'-A[audible bell for no packet]'
+ '-t+[specify timeout after which ping exits]:deadline (seconds)'
+ '-W+[specify time to wait for a response]:wait time (ms)'
+ )
+ ;|
+ (freebsd|darwin|dragonfly)*:4)
+ args+=(
'-G+[specify maximum size for ICMP payload for sweeping pings]:size'
'-g+[specify minimum size for ICMP payload for sweeping pings]:size [0]'
'-h+[specify size increment for ICMP payload for sweeping pings]:size [1]'
'-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)'
'-m+[set IP Time to Live for outgoing packets]:ttl'
'-T+[set IP Time to Live for multicasted packets]:ttl'
- '-t+[specify timeout after which ping exits]:deadline (seconds)'
- '-W+[specify time to wait for a response]:wait time (ms)'
'-z+[specify type of service]:type of service'
)
;|
- (freebsd|openbsd|darwin)*:6)
- args+=( '-D[disable IPv6 fragmentation]' )
- ;|
- (freebsd|darwin)*:6)
+ (freebsd<-12>.*|darwin*):6)
args+=(
'-R[audible bell for no packet]'
'-r[audible bell for each packet]'
)
;|
- freebsd*:6)
+ (iputils|freebsd<13->.*):4)
+ args+=(
+ '(-F -N)-4[use IPv4 only]'
+ '-6[use IPv6 only]'
+ )
+ ;|
+ freebsd<13->.*:4)
+ args+=(
+ '-C+[add an 802.1p Ethernet Priority Code Point when sending a packet]:pcp:(-1 0 1 2 3 4 5 6 7)'
+ )
+ ;|
+ freebsd<13->.*:6)
+ args+=(
+ '*-e+[specify gateway to use as the next hop to the destination]:gateway:_hosts'
+ '-k+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)'
+ '(-s)-O[generate ICMPv6 Node Information supported query types query]'
+ '*-u[suppress fragmentation to minimum MTU]'
+ '(-s)-Y[generate ICMPv6 Node Information DNS Name query with old packet format]'
+ '(-s)-y[generate ICMPv6 Node Information DNS Name query]'
+ '-E[enable transport-mode IPsec encapsulated security payload]'
+ '-Z[enables transport-mode IPsec authentication header]'
+ )
+ ;|
+ freebsd<-12>.*:6)
args+=(
'-x+[specify time to wait for a response]:wait time (ms)'
'-X+[specify timeout after which ping exits]:deadline (seconds)'
@@ -154,19 +187,12 @@ case ${variant}:${${service#ping}:-4} in
;;
openbsd*)
args+=(
- '-H[try reverse-lookups of addresses]'
'-E[audible bell for no packet]'
'-e[audible bell for each packet]'
'-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)'
'-V+[specify routing table to be used]:routing table'
)
;;
- iputils:4)
- args+=(
- '(-F -N)-4[use IPv4 only]'
- '-6[use IPv6 only]'
- )
- ;|
iputils:*)
args+=(
'-A[adaptive]'
diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf
index 42094742e..edabc3da1 100644
--- a/Completion/Unix/Command/_readelf
+++ b/Completion/Unix/Command/_readelf
@@ -43,6 +43,11 @@ case $variant in
'--dyn-syms[show dynamic symbol table]'
)
;|
+ elfutils|elftoolchain)
+ args+=(
+ '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]'
+ )
+ ;|
binutils)
args+=(
\*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)"
@@ -60,7 +65,6 @@ case $variant in
'--elf-section[used specified section as ELF input data]::section'
'(-e --exception)'{-e,--exception}'[show sections for exception handling]'
'(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]"
- '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]'
'(--symbols)-s[show symbol table]'
'(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)'
'(--notes)-n[show core notes (if present)]'
diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname
index 31af91eb7..0e55ba1c3 100644
--- a/Completion/Unix/Command/_uname
+++ b/Completion/Unix/Command/_uname
@@ -68,6 +68,9 @@ else
'-K[print FreeBSD kernel version]'
'-U[print FreeBSD user environment version]'
)
+ ;|
+ freebsd<13->.*)
+ args+=( "-b[print kernel's linker-generated build-id]" )
;;
solaris*)
args+=(
Messages sorted by:
Reverse Date,
Date,
Thread,
Author