Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: update completions for FreeBSD 14.4 and 15.0



This covers utilities in the base system. Notably also included in this
is handling new things from openzfs 2.4 (and probably 2.3). Also for ps
and ls completions I happened to also check AIX and account for that in
the updates.

Oliver

diff --git a/Completion/BSD/Command/_ipfw b/Completion/BSD/Command/_ipfw
index b910aa34d..78dac206a 100644
--- a/Completion/BSD/Command/_ipfw
+++ b/Completion/BSD/Command/_ipfw
@@ -284,7 +284,7 @@ actions=(
         \| $'/port_range[ \t\0]/'
           '/[0-9]#-/' ': _message -e ports lower'
           $word ': _message -e ports upper'
-        \| $word ':parameters:config parameter:$ca ip if log deny_in same_ports unreg_only unreg_cgn reset reverse proxy_only skip_global redirect_port redirect_addr redirect_proto port_range'
+        \| $word ':parameters:config parameter:$ca ip if log deny_in same_ports unreg_only unreg_cgn udp_eim reset reverse proxy_only skip_global redirect_port redirect_addr redirect_proto port_range'
         \) \#
       \| $'/show[ \t\0]/' $word ':actions:action:(config log)'
       \| '/[]/' ':commands:command:$ca config show' \)
diff --git a/Completion/BSD/Command/_jail b/Completion/BSD/Command/_jail
index 26d0a6a87..1fbed6903 100644
--- a/Completion/BSD/Command/_jail
+++ b/Completion/BSD/Command/_jail
@@ -43,8 +43,8 @@ if [[ -n $state ]]; then
   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'
+      'parameters:parameter:compadd -r "\n\t\- =" - persist allow.{set_hostname,sysvipc,raw_sockets,chflags,mount{,.devfs,.fdescfs,.fusefs,.nullfs,.procfs,.linprocfs,.linsysfs,.tmpfs,.zfs},vmm,quotas,read_msgbuf,socket_af,mlock,nfsd,reserved_ports,unprivileged_{parent_tampering,proc_debug},suser,extattr,adjtime,settime,routing,setaudit} linux linux.{osrelease,oss_version} mount.{devfs,fdescfs,procfs}'
+      'parameters:parameter:compadd $suf - jid name path ip{4,6}{,.addr,saddrsel} vnet host.hostname host securelevel devfs_ruleset children.{max,cur} enforce_statfs cpuset.id osrelease osreldate meta env command exec.{{,pre,post}{start,stop},clean,jail_user,system{,_jail}_user,timeout,consolelog,fib} stop.timeout {vnet.,}interface ip_hostname mount{,.fstab} depend zfs.dataset'
     )
   fi
   (( $#alts )) && _alternative $alts && ret=0
diff --git a/Completion/BSD/Command/_jls b/Completion/BSD/Command/_jls
index a6f8a7eb6..f9ae10253 100644
--- a/Completion/BSD/Command/_jls
+++ b/Completion/BSD/Command/_jls
@@ -4,13 +4,14 @@ local curcontext=$curcontext state state_descr line
 typeset -A opt_args
 
 _arguments -C -s -w -A '-*' : \
-  '-d[include diying jails]' \
-  '-h[print header line]' \
-  "-N[print jail's name instead of numeric ID]" \
-  '-n[print parameters in ``name=value'\'\'' format]' \
-  '-q[quote parameter value when it contains whitespace, quotes or empty string]' \
-  '-s[print parameters suitable for passing to jail(8)]' \
-  '-v[print a multiple-line summary per jail]' \
+  "(-h -N -n -q -s -v *)-c[only check for the jail's existence]" \
+  '-d[include dying jails]' \
+  '(-c)-h[print header line]' \
+  "(-c)-N[print jail's name instead of numeric ID]" \
+  '(-c)-n[print parameters in ``name=value'\'\'' format]' \
+  '(-c)-q[quote parameter value when it contains whitespace, quotes or empty string]' \
+  '(-c)-s[print parameters suitable for passing to jail(8)]' \
+  '(-c)-v[print a multiple-line summary per jail]' \
   '-j[the jid or name of the jail to list]:jail:_jails' \
   '*: :->parameters'
 
diff --git a/Completion/BSD/Command/_mdo b/Completion/BSD/Command/_mdo
new file mode 100644
index 000000000..9bb5224e8
--- /dev/null
+++ b/Completion/BSD/Command/_mdo
@@ -0,0 +1,48 @@
+#compdef mdo
+
+local environ e cmd cpp sep
+local -a _comp_priv_prefix suf reset
+local curcontext="$curcontext" state line expl
+local -A opt_args
+
+zstyle -a ":completion:${curcontext}:" environ environ
+
+for e in "${environ[@]}"
+do local -x "$e"
+done
+
+cmd="$words[1]"
+cpp='_comp_priv_prefix=( $cmd ${(kv)opt_args} )'
+_arguments -s -S -A '-*' : \
+  '(- *)-h[display usage information]' \
+  '--euid=[override effective user]:user:_users' \
+  '--egid=[override effective group]:group:_groups' \
+  '-G+[set supplementary groups]:group:_sequence _groups' \
+  '-g+[set primary group]:group:_groups' \
+  '-i[keep current primary and supplementary groups]' \
+  '(-u -i)-k[use current credentials as baseline]' \
+  '--ruid=[override real user]:user:_users' \
+  '--rgid=[override real group]:group:_groups' \
+  '-s+[incrementally modify the supplementary groups set]: :->group-mods' \
+  '--svuid=[override saved user]:user:_users' \
+  '--svgid=[override saved group]:group:_groups' \
+  '-u+[run command as specified user]: :_users' \
+  "(-)1: :{ $cpp; _command_names -e }" \
+  "*:: :{ $cpp; _normal }" && return
+
+if [[ $state = group-mods ]]; then
+  line=(
+    $opt_args[-g] ${(s.,.)opt_args[-G]}
+    ${${(s.,.)${(M)PREFIX##*,}}#[-+@]}
+    ${${(s.,.)${(M)SUFFIX%%,*}}#[-+@]}
+  )
+  compset -P '*,' || reset=( @ )
+  compset -S ',*' || suf=( -qS, )
+  if ! compset -P '[-+@]'; then
+    zstyle -s ":completion:${curcontext}:modifiers" list-separator sep || sep=--
+    _wanted modifiers expl 'group modifier' compadd -S "" -d \
+        "(-\ $sep\ exclude +\ $sep\ include @\ $sep\ reset)" - - + $reset
+  else
+    _wanted groups expl group _groups $suf -F line
+  fi
+fi
diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl
index 8063eb504..7756239d8 100644
--- a/Completion/BSD/Command/_pfctl
+++ b/Completion/BSD/Command/_pfctl
@@ -94,6 +94,7 @@ case $OSTYPE in
     args+=(
       '-M[kill matching states in the opposite direction]'
       '-P[display ports numerically]'
+      "-S[don't perform domain name resolution]"
     )
   ;;
 esac
diff --git a/Completion/BSD/Command/_sockstat b/Completion/BSD/Command/_sockstat
index 953072429..a5c29e116 100644
--- a/Completion/BSD/Command/_sockstat
+++ b/Completion/BSD/Command/_sockstat
@@ -31,10 +31,16 @@ case $OSTYPE in
   ;|
   freebsd<14->.*)
     args+=(
+      '-b[show TCP black box logging socket state]'
       '-I[show local address of socket to which the current socket is spliced]'
       '-f[show the FIB number of each socket]'
     )
   ;|
+  freebsd<15->.*)
+    args+=(
+      '-A[show address of associated protocol control block (PCB)]'
+    )
+  ;|
   freebsd*)
     for proto in ${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}}; do
       case $proto in
diff --git a/Completion/Unix/Command/_column b/Completion/Unix/Command/_column
index 687d7620f..737bb4561 100644
--- a/Completion/Unix/Command/_column
+++ b/Completion/Unix/Command/_column
@@ -18,6 +18,12 @@ _pick_variant -r variant \
 --version
 
 case $variant in
+  freebsd*)
+    args=(
+      '-l+[specify maximum number of input columns]:columns'
+    )
+  ;|
+
   util-linux)
     aopts=()
     args=(
diff --git a/Completion/Unix/Command/_id b/Completion/Unix/Command/_id
index 64b8c9b37..e6bfeafc8 100644
--- a/Completion/Unix/Command/_id
+++ b/Completion/Unix/Command/_id
@@ -44,8 +44,10 @@ else
     freebsd*)
       args+=(
 	'(-)-A[print process audit user ID]'
-	'(-)-M[print MAC label of the current process]'
+	'(- 1)-M[print MAC label of the current process]'
         '(-)-c[print current login class]'
+        '(-)-d[print home directory]'
+        '(-)-s[print shell]'
       )
     ;|
     darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls
index a92b91b31..5cd2e7f54 100644
--- a/Completion/Unix/Command/_ls
+++ b/Completion/Unix/Command/_ls
@@ -108,6 +108,12 @@ if ! _pick_variant gnu='(GNU|uutils)' unix --version; then
       '-Z[display MAC label]'
     )
   fi
+  if [[ $OSTYPE = freebsd<15->.* ]]; then
+    arguments+=(
+      '(--group-directories-first)--group-directories=:order:(first last)'
+      '(--group-directories)--group-directories-first'
+    )
+  fi
   if [[ $OSTYPE = darwin* ]]; then
     arguments+=(
       '-@[display extended attribute keys and sizes in long listing]'
@@ -118,14 +124,18 @@ if ! _pick_variant gnu='(GNU|uutils)' unix --version; then
       '-%[distinguish dataless files and directories with a %]'
     )
   fi
-  if [[ $OSTYPE = solaris* ]]; then
+  if [[ $OSTYPE = (aix|solaris)* ]]; then
     arguments+=(
       '(-q)-b[print octal escapes for control characters]'
       '(-l -1 -C -m -x)-o[long listing but without group information]'
       '(-l -t -s -r -a)-f[interpret each argument as a directory]'
+      '-H[follow symlinks on the command line]'
+    )
+  fi
+  if [[ $OSTYPE = solaris* ]]; then
+    arguments+=(
       '(-E -l)-e[long listing with full and consistent date/time]'
       '(-e -l)-E[long listing with ISO format date/time]'
-      '-H[follow symlinks on the command line]'
       '-v[long listing with verbose ACL information]'
       '-V[long listing with compact ACL information]'
       '-@[long listing with marker for extended attribute information]'
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
index 7d83f90ea..57fee983c 100644
--- a/Completion/Unix/Command/_ps
+++ b/Completion/Unix/Command/_ps
@@ -36,12 +36,8 @@ args=(
   '*-U+[select processes by real user]:user:_sequence -s , _users'
   '-o+[specify output format]:property:_sequence -s , _ps_props -'
 
-  '-c[show scheduler properties]'
   '-f[full listing]'
-  '-j[show session ID and process group ID]'
   '-l[long listing]'
-  '-L[show information about each light weight process]'
-  '-y[show RSS in place of ADDR (used with -l)]'
 )
 
 bsd=(
@@ -51,15 +47,10 @@ bsd=(
   'x[include processes with no controlling terminal]'
   '(j l s u X)v[output in virtual memory format]'
   '*w[wide output]'
-  'L[display all format specifiers]'
-  'S[include child process data with the parent]'
-  'T[select processes attached to current terminal]'
 )
 bsdarg=(
   '*p[select processes by ID]'
   '*t[select processes by attached terminal]'
-  'O[specify additional output fields]'
-  'o[specify output format]'
 )
 
 case $OSTYPE in
@@ -76,11 +67,30 @@ case $OSTYPE in
       '-Z[show zone with which process is associated]'
     )
   ;;
-  linux-gnu|dragonfly*|freebsd*|netbsd*|openbsd*)
+  ^aix*)
+    args+=(
+      '-L[show information about each light weight process]'
+      '-c[show scheduler properties]'
+      '-j[show session ID and process group ID]'
+      '-y[show RSS in place of ADDR (used with -l)]'
+    )
+    bsd+=(
+      'L[display all format specifiers]'
+      'S[include child process data with the parent]'
+      'T[select processes attached to current terminal]'
+    )
+    bsdarg+=(
+      'O[specify additional output fields]'
+      'o[specify output format]'
+    )
+  ;|
+  linux-gnu|aix*|dragonfly*|freebsd*|netbsd*|openbsd*)
     bsd+=(
       'e[show environment after command]'
       '(j l s v X)u[output in resource usage format]'
     )
+  ;|
+  linux-gnu|dragonfly*|freebsd*|netbsd*|openbsd*)
     bsdarg+=(
       'N[set namelist file for WCHAN display]'
       '*U[select processes by effective user]'
@@ -89,10 +99,14 @@ case $OSTYPE in
   linux-gnu|dragonfly*|freebsd*|openbsd*)
     bsd+=( 'H[show threads as if they were processes]' )
   ;|
+  aix*|darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
+    bsd+=(
+      'c[show just executable name for command]'
+    )
+  ;|
   darwin*|dragonfly*|freebsd*|netbsd*|openbsd*)
     bsd+=(
       'A[select every process]'
-      'c[show just executable name for command]'
       'h[repeat header lines, one per page of output]'
       '(r)m[sort by memory usage]'
       '(m)r[sort by CPU usage]'
@@ -110,9 +124,6 @@ case $OSTYPE in
   darwin*|freebsd*)
     bsd+=( 'X[skip processes with no controlling terminal]' )
   ;|
-  freebsd*|dragonfly*)
-    bsd+=( 'f[show command and environment for swapped out processes]' )
-  ;|
   netbsd*|openbsd*)
     bsdarg+=( 'W[extract swap information from specified file]' )
   ;|
@@ -121,6 +132,26 @@ case $OSTYPE in
       'd[show process hierarchy]'
     )
   ;|
+  aix*)
+    args+=(
+      '-M[list 64 bit processes]'
+      "-N[don't gather thread statistics]"
+      '-L+[show process descendants]:pid list:_sequence _pids'
+      '-T+[show process tree rooted at given pid]:pid:_pids'
+      '-P[display project info]'
+      "-X[don't truncate user and group names]"
+      '-Z[display page size settings]'
+      '-k[list kernel processes]'
+      '-c+[filter by workload management class]:class list'
+      '-m[list kernel threads]'
+    )
+    bsd+=(
+      'g[display all processes]'
+      'n[numerical output]'
+      's[display kernel stack size of each process]'
+      "X[don't truncate user and group names]"
+    )
+  ;|
   darwin*)
     bsd+=(
       'd[select all processes except session leaders]'
@@ -143,13 +174,19 @@ case $OSTYPE in
     fi
   ;;
   dragonfly*)
-    bsd+=( 'R[subsort by parent/child chain]' )
+    bsd+=(
+      'R[subsort by parent/child chain]'
+      'f[show command and environment for swapped out processes]'
+    )
   ;;
   freebsd*)
     bsd+=(
-      '*J[select processes by jail ID]'
       'Z[show mac label]'
     )
+    bsdarg+=(
+      'D[expand list of selected processes based on process tree]'
+      '*J[select processes by jail ID]'
+    )
   ;;
   netbsd*) bsd+=( '(j l u v)s[output in thread format]' ) ;;
   openbsd*)
@@ -205,8 +242,9 @@ case $OSTYPE in
   ;;
 esac
 
-if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) ||
-              ( $OSTYPE = linux-gnu && $words[CURRENT-1] != -* ) ]]; then
+if (( CURRENT > 1 )) && [[ $OSTYPE != (aix*|solaris*|linux-gnu) ||
+      ( $OSTYPE = (aix*|linux-gnu) && $words[CURRENT-1] != -* ) ]]
+then
   case $words[CURRENT-1] in
     *k)
       local sopt
@@ -215,6 +253,7 @@ if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) ||
 		_sequence -s , _ps_props $sopt - && return ;;
     *g) [[ $OSTYPE = darwin* ]] && _wanted -C option-g-1 processes \
 		expl 'process ID' _sequence -s , _pids && return ;;
+    *D) _wanted directions expl direction compadd up down both && return ;;
     *G) _sequence -s , _groups && return ;;
     *J) _sequence _jails -0 && return ;;
     *[MNW]) _files && return ;;
diff --git a/Completion/Unix/Command/_service b/Completion/Unix/Command/_service
index 28563429b..5f9ca0d67 100644
--- a/Completion/Unix/Command/_service
+++ b/Completion/Unix/Command/_service
@@ -11,14 +11,18 @@ zstyle -T  ":completion:${ctx}" tag-order && \
 
 case $OSTYPE in
   freebsd<14->.*)
-    args=( '-E+[set environment variable before executing the rc.d script]:variable:_parameters -g "*export*~*readonly*" -S=' )
+    args=(
+      '(-l -r)-d[enable debugging of rc.d scripts]'
+      '-E+[set environment variable before executing the rc.d script]:variable:_parameters -g "*export*~*readonly*" -S='
+      '(-l -r)-q[quiet]'
+    )
   ;&
   freebsd<11->.*)
     args+=( '-j+[perform actions in specified jail]:jail:_jails' )
   ;&
   freebsd*|dragonfly*)
     actions=(
-      '(*)-r[show the results of boot time rcorder]'
+      '(* -q -d)-r[show the results of boot time rcorder]'
       '(*)-R[restart all enabled local services]'
     )
   ;&
@@ -28,7 +32,7 @@ case $OSTYPE in
       '*::service argument:_init_d' \
       + '(actions)' $actions \
       '(*)-e[show services that are enabled]' \
-      '(*)-l[list all scripts in /etc/rc.d and the local startup directory]' \
+      '(* -q -d)-l[list all scripts in /etc/rc.d and the local startup directory]' \
       ':service name:_services'
   ;;
   *)
diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout
index f1961012d..676f8e8cd 100644
--- a/Completion/Unix/Command/_timeout
+++ b/Completion/Unix/Command/_timeout
@@ -11,9 +11,9 @@ local args
 )
 
 _arguments -S -A "-" $args \
-  '--preserve-status[always exit with the same status as command even if it times out]' \
-  "--foreground[don't propagate timeout to the command children]" \
+  '(-p --preserve-status)'{-p,--preserve-status}'[always exit with the same status as command even if it times out]' \
+  '(-f --foreground)'{-f,--foreground}"[don't propagate timeout to the command children]" \
   '(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \
-  '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time' \
+  '(-k --kill-after)'{-k+,--kill-after=}'[followup first signal with SIGKILL if command persists after specified time]: :_numbers -f -u seconds duration \:s\:seconds m\:minutes h\:hours d\:days' \
   '1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \
   '*:::command: _normal -p $service'
diff --git a/Completion/Unix/Command/_zdump b/Completion/Unix/Command/_zdump
index f96bdd764..9e71a5f53 100644
--- a/Completion/Unix/Command/_zdump
+++ b/Completion/Unix/Command/_zdump
@@ -1,6 +1,26 @@
 #compdef zdump
 
-_arguments \
-  '-v[lowest possible]' \
-  '-c[cutoff]:cutoff year:' \
+local -a args
+
+case $OSTYPE in
+  aix*|(net|free)bsd*|linux*|solaris*)
+    args+=( '(-)--version[display version information]' )
+  ;|
+  aix*|(net|free)bsd*|linux*)
+    args+=( '(-)--help[display usage information]' )
+  ;|
+  (net|free)bsd*|linux*)
+    args+=( '-i[output a description of time intervals]' )
+  ;|
+  aix*|(free|net|open)bsd*|linux*)
+    args+=(
+      '(-c)-t[cut off interval output at the given times]:cut off (seconds since epoch)'
+      '(-v)-V[like -v, but omit times relative to the extreme time values]'
+    )
+  ;|
+esac
+
+_arguments -S $args \
+  '(-V)-v[print time at lowest possible time value]' \
+  '(-t)-c[cut off interval output at the given years]:cutoff years [-500,2500]' \
   '*:time zone:_time_zone'
diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs
index dd67ea767..3a884439b 100644
--- a/Completion/Unix/Command/_zfs
+++ b/Completion/Unix/Command/_zfs
@@ -69,6 +69,8 @@ rw_ds_props=(
   'compression:value:($comp_algorithms)'
   'copies:value:(1 2 3)'
   'dedup:value:($dedup_algorithms)'
+  'defaultuserquota:->quotas'
+  'defaultgroupquota: :->quotas'
   'devices:value:(on off)'
   'encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)'
   'exec:value:(on off)'
@@ -79,7 +81,7 @@ rw_ds_props=(
       'paths:mountpoint:_directories -W / -P /'"
   'multilevel:value:(on off)'
   'nbmand:value:(on off)'
-  {prefetch,primarycache}':value:(all none metadata)'
+  {prefetch,primarycache,secondarycache}':value:(all none metadata)'
   'quota: :->quotas'
   'readonly:value:(on off)'
   'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)'
@@ -89,7 +91,6 @@ rw_ds_props=(
       'properties:property:(auto none)'"
   'reservation: :->quotas'
   'rstchown:value:(on off)'
-  'secondarycache:value:(all none metadata)'
   'setuid:value:(on off)'
   'shadow:value' # TODO: complete URI|none
   'share:share properties'
@@ -128,9 +129,11 @@ case $service:$implementation in
       'bcloneused[amount of storage used by cloned blocks]'
       'dedup_table_size[size of dedup table on-disk]'
       'dedupcached[size of dedup table in arc]'
+      'encryptionroot'
       'expandsize[uninitialized space within the pool]'
       'fragmentation[amount of fragmentation in the pool]'
       'freeing[amount of space remaining to be reclaimed]'
+      'last_scrubbed_txg[transaction group (TXG) up to which the most recent scrub operated]'
       'load_guid[unique identifier generated when pool is loaded]'
       'used[amount of storage space used within the pool]'
     )
@@ -150,8 +153,20 @@ case $service:$implementation in
     rw_ds_props+=(
       'aclmode:value:(discard groupmask passthrough restricted)'
       'acltype:value:(off noacl nfsv4 posix posixacl)'
+      'defaultprojectquota:->quotas'
+      'defaultprojectobjquota:->quotas'
+      'defaultgroupobjquota:->quotas'
+      'defaultuserobjquota:->quotas'
+      'dnodesize:value:(legacy auto 1k 2k 4k 8k 16k)'
+      'direct:value:(disabled standard always)'
+      'groupobjquota@'
       'mlslabel:value:(none)' # TODO: list sensitivity labels
-      'redundant_metadata:value:(all most)'
+      'overlay:value:(on off)'
+      'projectquota@' 'projectobjquota@'
+      'redundant_metadata:value:(all most some none)'
+      'snapdev:value:(hidden visible)'
+      'special_small_blocks:size [0]'
+      'userobjquota@'
       'vscan:value:(on off)'
       'xattr:value:(on off dir sa)'
       "filesystem_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}"
@@ -166,8 +181,8 @@ case $service:$implementation in
     )
     ro_ds_props+=(
       createtxg clones filesystem_count guid logicalreferenced logicalused
-      receive_resume_token refcompressratio snapshot_count snapshots_changed
-      volblocksize written
+      objsetid receive_resume_token redact_snaps refcompressratio
+      snapshot_count snapshots_changed volblocksize written
     )
     delegatable_perms=(
       bookmark load-key change-key userobjquota userobjused groupobjquota
@@ -240,8 +255,6 @@ case $service:$implementation in
       "defaultwritelimit: : _alternative \
           'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \
           'properties:property:(none)'"
-      'defaultuserquota:->quotas'
-      'defaultgroupquota: :->quotas'
       'keysource:value:->keysources'
     )
     ci_ds_props+=(
@@ -256,13 +269,13 @@ case $service:$implementation in
   zfs:openzfs)
     subcmds+=(
       bookmark change-key load-key program project projectspace redact
-      unload-key wait
+      rewrite unload-key wait version
     )
   ;|
   zpool:openzfs)
     subcmds+=(
-      checkpoint events labelclear initialize reopen resilver sync trim wait
-      version
+      checkpoint events labelclear initialize reopen resilver sync prefetch
+      trim wait version
     )
   ;|
   zfs:solaris)
@@ -282,8 +295,9 @@ case $service:$implementation in
   ;;
   zpool:*)
     subcmds+=(
-      add attach clear create destroy detach export get history import iostat
-      list offline online reguid remove replace scrub set split status upgrade
+      add attach clear create destroy ddtprune detach export get history
+      import iostat list offline online reguid remove replace scrub set
+      split status upgrade
     )
   ;;
   zstream:*)
@@ -292,15 +306,18 @@ case $service:$implementation in
 esac
 
 case $OSTYPE in
-  solaris*)
+  solaris*|linux-gnu)
     rw_ds_props+=( 'zoned:value:(on off)' )
-  ;;
+  ;|
   freebsd*)
     [[ $OSTYPE = freebsd<-12>.* ]] && subcmds+=( remap )
     rw_ds_props+=( 'jailed:value:(on off)' )
   ;;
   linux-gnu)
-    rw_ds_props+=( 'relatime:value:(on off)' )
+    rw_ds_props+=(
+      'relatime:value:(on off)'
+      'volthreading:value:(on off)'
+    )
     ci_ds_props+=(
       {,fs,def,root}'context:SELinux context:_selinux_contexts -a file_type'
     )
@@ -508,7 +525,11 @@ case $service:$words[1] in
     if [[ $implementation = solaris ]]; then
       args=( '-I+[specify dataset states to display instead of normal datasets]:dataset state:_sequence compadd - receiving resumable hidden all' )
     else
-      args=( '-p[use exact (parsable) numeric output]' )
+      args=(
+        '(-j --json)'{-j,--json}'[output in JSON format]'
+        '--json-int[output numbers in integer format instead of strings]'
+        '-p[use exact (parsable) numeric output]'
+      )
     fi
     _arguments -A "-*" -S $args \
       '(-d)-r[recursively display children]' \
@@ -604,6 +625,17 @@ case $service:$words[1] in
       '*:file:_files'
   ;;
 
+  zfs:rewrite)
+    _arguments -A "-*" -S -s \
+      '-P[rewrite physical blocks only so snapshots and incremental streams are unaffected]' \
+      '-l+[specify maximum number of bytes to write]:maximum (bytes)' \
+      '-o+[specify starting offset]:offset (bytes)' \
+      '-r[recurse into directories]' \
+      '-v[print names of all successfully rewritten files]' \
+      "-x[don't cross file system boundaries]" \
+      '*:file or directory:_files'
+  ;;
+
   zfs:mount)
     [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' )
     [[ $implementation = openzfs ]] && args+=(
@@ -611,6 +643,7 @@ case $service:$words[1] in
       '(-a)-R[mount filesystems along with all their children]'
     )
     _arguments -A "-*" -S $args \
+      '(- :)'{-j,--json}'[show all mounted file systems in JSON format]' \
       '-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \
       '-v[report mount progress]' \
       '-f[force mount]' \
@@ -898,6 +931,11 @@ case $service:$words[1] in
       ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})'
   ;;
 
+  (zfs|zpool):version)
+    _arguments -A "-*" -S \
+      '-j[output in JSON format]'
+  ;;
+
   zpool:(clear|online))
     [[ $OSTYPE = linux* ]] && args=(
       "--power[power on the device's slot in the storage enclosure]"
@@ -991,6 +1029,13 @@ case $service:$words[1] in
       '*: :->virtual-devices'
   ;;
 
+  zpool:ddtprune)
+    _arguments -A "-*" -S \
+      '(-p)-d[prune entries based on age]:age (days)' \
+      '(-d)-p[prune to target percentage of unique entries]:target (percentage)' \
+      ':pool:_zfs_pool'
+  ;;
+
   zpool:destroy)
     _arguments -A "-*" -S \
       '-f[force active datasets to be unmounted]' \
@@ -1020,9 +1065,17 @@ case $service:$words[1] in
   ;;
 
   zpool:get)
-    [[ $implementation = solaris ]] && args=(
-      '-s+[specify sources to display]: :_values -s , "source" local default none'
-    )
+    if [[ $implementation = openzfs ]]; then
+      args=(
+        '(-j --json)'{-j,--json}'[output in JSON format]'
+        '--json-int[output numbers in integer format instead of strings]'
+        --json-pool-key-guid
+      )
+    else
+      args=(
+        '-s+[specify sources to display]: :_values -s , "source" local default none'
+      )
+    fi
     _arguments -A "-*" -S $args \
       '-H[suppress headers and tab-delimit fields]' \
       '-p[display numbers in parseable (exact) values]' \
@@ -1076,6 +1129,7 @@ case $service:$words[1] in
 
   zpool:initialize)
     _arguments -A "-*" -S \
+      '(-a --all : *)'{-a,--all}'[begin, cancel, suspend initializing on all pools]' \
       '(-s --suspend -c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \
       '(-s --suspend -c --cancel)'{-s,--suspend}'[suspend initializing on specified devices]' \
       '(-u --uninit)'{-u,--uninit}'[clear initialization state on specified devices]' \
@@ -1130,6 +1184,9 @@ case $service:$words[1] in
   zpool:list)
     [[ $implementation = openzfs ]] && args=(
       '-g[display vdev GUIDs instead of normal device names]'
+      '(-j --json)'{-j,--json}'[output in JSON format]'
+      '--json-int[output numbers in integer format instead of strings]'
+      --json-pool-key-guid
       '-L[display real paths for vdevs resolving all symbolic links]'
       '-p[display numbers in parsable (exact) values]'
       '-P[display full paths for vdevs instead of only the last component of the path]'
@@ -1167,12 +1224,21 @@ case $service:$words[1] in
   ;;
 
   zpool:online)
-    _arguments -C -A "-*" -S $args \
+    _arguments -C -A "-*" -S \
       '-e[expand device to use all available space]' \
       ':pool:_zfs_pool' \
       '*:virtual device:->pool-devices'
   ;;
 
+  zpool:prefetch)
+    _arguments -A "-*" -S \
+      '-t+[metadata type]:metadata type:((
+        brt\:block\ reference\ table
+        ddt\:deduplication\ table
+      ))' \
+      ':pool:_zfs_pool'
+  ;;
+
   zpool:reopen)
     _arguments -A "-*" -S \
       "-n[don't restart an in-progress scrub operation]" \
@@ -1180,7 +1246,9 @@ case $service:$words[1] in
   ;;
 
   zpool:reguid)
-    _zfs_pool
+    _arguments -A "-*" -S \
+      '-g+[set pool guid]:guid (64-bit decimal)' \
+      ':pool:_zfs_pool'
   ;;
 
   zpool:remove)
@@ -1215,6 +1283,10 @@ case $service:$words[1] in
 
   zpool:scrub)
     [[ $implementation = openzfs ]] && args=(
+      '(-a --all *)'{-a,--all}'[begin, pause, stop scrub on all pools]'
+      '-C[continue scrub from last saved txg]'
+      '-S+[specify start date for transactions]:date (YYYY-MM-DD HH\:MM):_dates'
+      '-E+[specify end date for transactions]:date (YYYY-MM-DD HH\:MM):_dates'
       '(-s)-p[pause scrubbing]'
       '-w[wait until scrub has completed before returning]'
       '-e[only scrub files with known data errors]'
@@ -1259,6 +1331,9 @@ case $service:$words[1] in
         '-c+[run scripts on each vdev]:script:_sequence _files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"'
         '-e[only show unhealthy vdevs]'
         '-i[display vdev initialization status]'
+        '(-j --json)'{-j,--json}'[output in JSON format]'
+        '--json-int[output numbers in integer format instead of strings]'
+        --json-flat-vdevs --json-pool-key-guid
         '-g[display vdev GUIDs instead of the normal device names]'
         '-L[display real paths for vdevs resolving all symbolic links]'
         '-p[display numbers in parsable (exact) values and times in nanoseconds]'
@@ -1280,6 +1355,7 @@ case $service:$words[1] in
 
   zpool:trim)
     _arguments -C -A "-*" -S \
+      '(-a --all 1 *)'{-a,--all}'[perform TRIM on all pools]' \
       '(-d --secure)'{-d,--secure}'[initiate a secure TRIM]' \
       '(-r --rate)'{-r,--rate}'[set rate at which the TRIM operation progresses]:rate (bytes per second)' \
       '(-c --cancel)'{-c,--cancel}'[cancel trimming]' \
diff --git a/Completion/Unix/Type/_date_formats b/Completion/Unix/Type/_date_formats
index 55af7c591..0527d706c 100644
--- a/Completion/Unix/Type/_date_formats
+++ b/Completion/Unix/Type/_date_formats
@@ -59,7 +59,7 @@ specs=(
 )
 
 case $OSTYPE in
-  linux-gnu)
+  freebsd*|linux-gnu)
     [[ $1 == zsh ]] || # %N is handled below in this case
     specs+=( 'N:fractional part of seconds since epoch, in nanoseconds' )
   ;|




Messages sorted by: Reverse Date, Date, Thread, Author