1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-04 10:41:11 +02:00

53325: cover newer BSD releases in completion

This commit is contained in:
Oliver Kiddle 2025-01-27 23:00:17 +01:00
parent db01c79cf8
commit 87aba4d437
23 changed files with 182 additions and 60 deletions

View file

@ -1,3 +1,18 @@
2025-01-27 Oliver Kiddle <opk@zsh.org>
* 53325: Completion/BSD/Command/_acpiconf,
Completion/BSD/Command/_bsdconfig, Completion/BSD/Command/_pkgin,
Completion/BSD/Command/_procstat, Completion/BSD/Command/_sockstat,
Completion/BSD/Command/_systat, Completion/Unix/Command/_date,
Completion/Unix/Command/_df, Completion/Unix/Command/_dhclient,
Completion/Unix/Command/_dmidecode, Completion/Unix/Command/_env,
Completion/Unix/Command/_iostat, Completion/Unix/Command/_last,
Completion/Unix/Command/_ls, Completion/Unix/Command/_mv,
Completion/Unix/Command/_ps, Completion/Unix/Command/_script,
Completion/Unix/Command/_sed, Completion/Unix/Command/_vmstat,
Completion/Unix/Command/_w, Completion/Unix/Command/_wc,
Completion/Unix/Command/_zfs: cover newer BSD releases in completion
2025-01-20 Bart Schaefer <schaefer@zsh.org> 2025-01-20 Bart Schaefer <schaefer@zsh.org>
* Julian Prein: 53309: Completion/Unix/Command/_uniq: remove * Julian Prein: 53309: Completion/Unix/Command/_uniq: remove

View file

@ -0,0 +1,28 @@
#compdef acpiconf
local curcontext="$curcontext" sep ret=1
local -a state line modes desc
local -A opt_args
_arguments -s \
'(-)-h[display usage information]' \
'(-)-i[get battery information]:battery' \
'(-)-k[ack or abort a pending suspend]:ack' \
'(-)-s[enter specified sleep mode]: :->modes' && ret=0
if [[ -n $state ]]; then
modes=( $(_call_program modes sysctl -n hw.acpi.supported_sleep_state) )
zstyle -s ":completion:${curcontext}:modes" list-separator sep || sep=--
(( $#modes )) || modes=( S3 S4 )
desc=(
"S1 $sep stop the processor clock"
"S2 $sep low wake latency sleep state"
"S3 $sep suspend to RAM"
"S4 $sep suspend to disk"
"S5 $sep soft off state"
)
desc=( ${(M)desc:#(${(~j.|.)modes}) *} )
_wanted modes expl 'mode' compadd -M 'B:S=' -ld desc - ${modes#S} && ret=0
fi
return ret

View file

@ -51,6 +51,7 @@ shortcuts=(
vt_saver vt_saver
vt_screenmap vt_screenmap
vt_ttys vt_ttys
wifi wireless wlan
) )
_arguments -s -w -A '-*' : \ _arguments -s -w -A '-*' : \

View file

@ -5,6 +5,8 @@ local -a state state_descr line expl cmds short pkgs
local -A opt_args local -A opt_args
_arguments -s -S -C \ _arguments -s -S -C \
'(-6)-4[only use IPv4 addresses]' \
'(-4)-6[only use IPv6 addresses]' \
'-c+[enable chrooting pkgin in the given repository]:chroot path:_directories' \ '-c+[enable chrooting pkgin in the given repository]:chroot path:_directories' \
'-d[download only]' \ '-d[download only]' \
'-f[force database update]' \ '-f[force database update]' \

View file

@ -1,26 +1,27 @@
#compdef procstat #compdef procstat
_arguments -s -A "-*" -S \ _arguments -s -A "-*" -S \
'-b[show binary information]' \ '(1)-b[show binary information]' \
'-c[show command line arguments]' \ '(1)-c[show command line arguments]' \
'-e[show environment variables]' \ '(1)-e[show environment variables]' \
'-f[show file descriptor information]' \ '(1)-f[show file descriptor information]' \
'-i[show signal pending and disposition]' \ '(1)-i[show signal pending and disposition]' \
'-j[show signal pending and blocked information for process threads]' \ '(1)-j[show signal pending and blocked information for process threads]' \
'-k[show stacks of kernel threads]' \ '(1)-k[show stacks of kernel threads]' \
'-l[show resource limits]' \ '(1)-l[show resource limits]' \
"-L[show LWP info for the process pertaining to it's signal driven exit]" \ "(1)-L[show LWP info for the process pertaining to it's signal driven exit]" \
'-r[show resource usage]' \ '(1)-r[show resource usage]' \
'-s[show security credential information]' \ '(1)-s[show security credential information]' \
'-S[show cpuset information]' \ '(1)-S[show cpuset information]' \
'-t[show thread information]' \ '(1)-t[show thread information]' \
'-v[show virtual memory mappings]' \ '(1)-v[show virtual memory mappings]' \
'-x[show ELF auxiliary vector]' \ '(1)-x[show ELF auxiliary vector]' \
'-h[suppress table headers]' \ '-h[suppress table headers]' \
'(1)-a[all processes]' \ '(2 *)-a[all processes]' \
'-w+[repeat information after specified interval]:delay (seconds)' \ '-w+[repeat information after specified interval]:delay (seconds)' \
'-C[print additional capability information for file descriptors]' \ '-C[print additional capability information for file descriptors]' \
'-H[statistics per-thread rather than per-process]' \ '-H[statistics per-thread rather than per-process]' \
'-n[numeric form for signals]' \ '-n[numeric form for signals]' \
'1::core file:_path_files -g "*core*(-.)"' \ '1::command:(advlock argument auxv basic binary cpuset credential environment fd file kstack pargs ptlwpinfo pwdx rlimit rlimitusage rusage sigfastblock signal thread tsignal vm)' \
'2::core file:_path_files -g "*core*(-.)"' \
'*:process id:_pids' '*:process id:_pids'

View file

@ -29,6 +29,11 @@ case $OSTYPE in
'-q[quiet mode, do not print the header line]' '-q[quiet mode, do not print the header line]'
) )
;| ;|
freebsd<14->.*)
args+=(
'-I[show local address of socket to which the current socket is spliced]'
)
;|
freebsd*) freebsd*)
for proto in ${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}}; do for proto in ${${(M)${(f)"$(</etc/protocols)"}##[a-z0-9]*}}; do
case $proto in case $proto in

View file

@ -79,6 +79,7 @@ case $OSTYPE in
"-n[don't resolve IP addresses]" "-n[don't resolve IP addresses]"
'(-b)-w[refresh interval]:refresh interval' '(-b)-w[refresh interval]:refresh interval'
"(-b)-t[specify amount of refreshes for each screen in 'all' display mode]:turns" "(-b)-t[specify amount of refreshes for each screen in 'all' display mode]:turns"
'-z[display 0 instead of space when there is no data]'
) )
esac esac

View file

@ -37,7 +37,10 @@ else
) )
;| ;|
freebsd*|dragonfly*|darwin*|netbsd*) freebsd*|dragonfly*|darwin*|netbsd*)
args+=( '-n[only set time on current machine]' ) args+=(
'-n[only set time on current machine]'
'-R[display in RFC2822 format]'
)
;| ;|
freebsd*|dragonfly*|darwin*|openbsd*) freebsd*|dragonfly*|darwin*|openbsd*)
args+=( args+=(
@ -61,11 +64,14 @@ else
;| ;|
freebsd*|dragonfly*|darwin*) freebsd*|dragonfly*|darwin*)
args+=( args+=(
'-R[display in RFC2822 format]'
'(-R)-I-[display in ISO 8601 format]::precision [date]:(date hours minutes seconds)'
"*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]"
) )
;| ;|
dragonfly*|darwin*)
args+=(
'(-R)-I-[display in ISO 8601 format]::precision [date]:(date hours minutes seconds)'
)
;|
freebsd<-12>.*) freebsd<-12>.*)
args+=( args+=(
'-d+:daylight saving time value' '-d+:daylight saving time value'
@ -77,6 +83,11 @@ else
freebsd<14->.*|openbsd*) freebsd<14->.*|openbsd*)
args+=( '-z+[specify timezone for output]:time zone:_time_zone') args+=( '-z+[specify timezone for output]:time zone:_time_zone')
;| ;|
freebsd*)
args+=(
'(-R)-I-[display in ISO 8601 format]::precision [date]:(date hours minutes seconds ns)'
)
;|
netbsd*) netbsd*)
args+=( '-d[output date specified by string]:time string:' ) args+=( '-d[output date specified by string]:time string:' )
;; ;;

View file

@ -45,21 +45,25 @@ elif [[ "$OSTYPE" == (darwin|dragonfly|freebsd|netbsd*|openbsd)* ]]; then
'-a[show all mount points]' '-a[show all mount points]'
'(-b -g -H -h -k -m --si)-g[use 1024^3-byte blocks]' '(-b -g -H -h -k -m --si)-g[use 1024^3-byte blocks]'
'(-b -g -H -h -k -m --si)-m[use 1024*1024-byte blocks]' '(-b -g -H -h -k -m --si)-m[use 1024*1024-byte blocks]'
)
;|
(darwin*|dragonfly*|freebsd*)
args+=(
'(-b -g -H -h -k -m --si)-b[use 512-byte blocks (default)]' '(-b -g -H -h -k -m --si)-b[use 512-byte blocks (default)]'
'(-b -g -H -h -k -m --si)-H[human-readable output (base 10)]' '(-b -g -H -h -k -m --si)-H[human-readable output (base 10)]'
) )
;| ;|
(darwin*|freebsd*) (darwin*|freebsd*|netbsd*)
args+=( args+=(
'-c[display a grand total]' '-c[display a grand total]'
) )
;|
(darwin*|freebsd*)
args+=(
'--libxo[generate output via libxo]'
'-,[separate thousands]'
)
;| ;|
(darwin*) (darwin*)
args+=( args+=(
'-I[suppress inode counts]'
'-Y[include file system type]'
"-T+$spec" "-T+$spec"
"!-t+$spec" # obsolete "!-t+$spec" # obsolete
) )
@ -76,14 +80,15 @@ elif [[ "$OSTYPE" == (darwin|dragonfly|freebsd|netbsd*|openbsd)* ]]; then
;| ;|
(freebsd*) (freebsd*)
args+=( args+=(
'--libxo[generate output via libxo]'
'(-b -g -H -h -k -m --si)--si[human-readable output (base 10)]' '(-b -g -H -h -k -m --si)--si[human-readable output (base 10)]'
'-,[separate thousands]'
) )
;; ;;
(netbsd*) (netbsd*)
args+=( args+=(
'(-P -G -N)-f[display only the available free]'
'(-G -i -P)-G[display all fields in statvfs]' '(-G -i -P)-G[display all fields in statvfs]'
'(-G -P)-N[suppress the header line normally output]'
'-W[print widge name instead of the device]'
) )
;; ;;
esac esac

View file

@ -12,6 +12,7 @@ case $OSTYPE in
args+=( args+=(
'(-d)-b[immediately move to the background]' '(-d)-b[immediately move to the background]'
'-l+[specify leases file]:file:_files' '-l+[specify leases file]:file:_files'
"-n[don't wait for ARP resolution]"
'-p+[specify PID file]:file:_files' '-p+[specify PID file]:file:_files'
'-u[reject leases with unknown options]' '-u[reject leases with unknown options]'
'-q[quiet]' '-q[quiet]'

View file

@ -5,8 +5,10 @@ _arguments -s \
'(-)'{-h,--help}'[display usage information]' \ '(-)'{-h,--help}'[display usage information]' \
'(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \ '(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \
'--no-quirks[decode everything without quirks]' \ '--no-quirks[decode everything without quirks]' \
'(-t --type -H --handle -u --dump --dump-bin -s --string)'{-s+,--string=}'[only display value of specified DMI string]:DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ '(-t --type -H --handle -u --dump --dump-bin -s --string)'{-s+,--string=}'[only display value of specified DMI string]:DMI string:compadd -M "r\:|-=* r\:|=*" - $(_call_program strings dmidecode --list-strings)' \
'(-s --string -H --handle --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \ '--list-strings[list available string keywords]' \
'(-s --string -H --handle --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:compadd - $(_call_program types dmidecode --list-types)' \
'--list-types[list available type keywords]' \
'(-s --string -t --type -H --handle --dump-bin)'{-H,--handle=}'[only display the entry of specified handle]:handle' \ '(-s --string -t --type -H --handle --dump-bin)'{-H,--handle=}'[only display the entry of specified handle]:handle' \
'(-q --quiet -u --dump -s --string)'{-u,--dump}"[don't decode entries]" \ '(-q --quiet -u --dump -s --string)'{-u,--dump}"[don't decode entries]" \
'(-s --string -t --type -H --handle)--dump-bin=[dump DMI data to a binary file]:file:_files' \ '(-s --string -t --type -H --handle)--dump-bin=[dump DMI data to a binary file]:file:_files' \

View file

@ -8,6 +8,7 @@ case $variant in
gnu) gnu)
(( $#words > 2 )) && ign='!' (( $#words > 2 )) && ign='!'
args=( args=(
'(-a --argv0)'{-a+,--argv0=}'[pass argument as the zeroth argument of command]:argument'
'(-)'{-i,--ignore-environment}'[start with empty environment]' '(-)'{-i,--ignore-environment}'[start with empty environment]'
'(* -0 --null)'{-0,--null}'[end each output line with NUL, not newline]' '(* -0 --null)'{-0,--null}'[end each output line with NUL, not newline]'
'(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"' '(--ignore-environment -i --help --version)*'{-u+,--unset=}'[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
@ -28,12 +29,19 @@ case $variant in
'-U[add variables from user and system login.conf(5)]: :->user-class' '-U[add variables from user and system login.conf(5)]: :->user-class'
) )
;| ;|
freebsd*|darwin*) freebsd*|netbsd*)
args=( '-0[use NUL, not newline after each variable in output]' ) args+=( '-C+[change working directory]:directory:_directories' )
;|
freebsd*|darwin*|netbsd*)
args+=( '-0[use NUL, not newline after each variable in output]' )
;|
freebsd*|darwin*|dragonfly*|netbsd*|openbsd*)
args+=(
'(-i)*-u+[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
)
;| ;|
freebsd*|darwin*|dragonfly*) freebsd*|darwin*|dragonfly*)
args+=( args+=(
'(-i)*-u+[remove variable from the environment]:env var to remove:_parameters -g "*export*"'
'-P+[specify alternate executable search PATH]:path:_dir_list' '-P+[specify alternate executable search PATH]:path:_dir_list'
'-S+[perform word splitting]:string to split' '-S+[perform word splitting]:string to split'
'*-v[verbose output]' '*-v[verbose output]'

View file

@ -50,6 +50,9 @@ case $OSTYPE:l in
args+=( args+=(
'-x[show extended disk statistics]' '-x[show extended disk statistics]'
'-y[report data on waiting and active requests]' '-y[report data on waiting and active requests]'
'-z[replace drive and CPU statistics that are zero with spaces]'
"-H+[set page height explicitly]:height [$LINES]"
"-W+[set page width explicitly]:width [$COLUMNS]"
) )
;; ;;
aix*) aix*)

View file

@ -8,17 +8,16 @@ ttys=( ${ttys#/dev/} )
for pattern arg in \ for pattern arg in \
'(solaris*|linux-gnu)' '(--hostlast)-a[display hostname in last column]' \ '(solaris*|linux-gnu)' '(--hostlast)-a[display hostname in last column]' \
'((free|net|open)bsd*|darwin*|dragonfly*)' '-h+[limit sessions by hostname]:host:_hosts' \ '((free|net|open)bsd*|darwin*|dragonfly*)' '-h+[limit sessions by hostname]:host:_hosts' \
'((free|open)bsd*)' '-s[report duration in seconds]' \ '((free|open)bsd*|darwin*)' '-s[report duration in seconds]' \
'(freebsd*|openbsd*)' '-d+[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \ '((free|open)bsd*|darwin*)' '-d+[limit sessions to those active at snapshot time]:time ([[CC]YY][MMDD]hhmm[.SS])' \
'((net|free|open)bsd*|darwin*|dragonfly*)' '-t+[limit sessions by tty]:tty:_ttys -D' \ '((net|free|open)bsd*|darwin*|dragonfly*)' '-t+[limit sessions by tty]:tty:_ttys -D' \
'openbsd*' '-c[calculate total time]' \ 'openbsd*' '-c[calculate total time]' \
'^darwin*' '(--file)-f+[specify account file]:file:_files' \ '(solaris*|darwin*|linux-gnu|freebsd*|openbsd*)' '(--limit)-n+[specify number of lines to show]:number' \
'(solaris*|linux-gnu|freebsd*|openbsd*)' '(--limit)-n+[specify number of lines to show]:number' \
'((open|net)bsd*|dragonfly*)' '-T[show more detailed time information including year and seconds]' \ '((open|net)bsd*|dragonfly*)' '-T[show more detailed time information including year and seconds]' \
'netbsd*' '-x[assume file is in wtmpx(5) format]' \ 'netbsd*' '-x[assume file is in wtmpx(5) format]' \
'netbsd*' '-n[show IP of remote hosts]' \ 'netbsd*' '-n[show IP of remote hosts]' \
'freebsd*' '-w[show seconds in duration field]' \ '(freebsd*|darwin*)' '-w[show seconds in duration field]' \
'freebsd*' '-y[show year in session start time]' '(freebsd*|darwin*)' '-y[show year in session start time]'
do do
[[ $OSTYPE = $~pattern ]] && args+=( $arg ) [[ $OSTYPE = $~pattern ]] && args+=( $arg )
done done
@ -58,4 +57,5 @@ else
args+=( '*:user:_users' ) args+=( '*:user:_users' )
fi fi
_arguments -s -S $args _arguments -s -S $args \
'(--file)-f+[specify account file]:file:_files'

View file

@ -61,12 +61,16 @@ if ! _pick_variant gnu=gnu unix --help; then
'(-l -1 -C -m -x)-g[long listing but without owner information]' '(-l -1 -C -m -x)-g[long listing but without owner information]'
) )
fi fi
if [[ $OSTYPE = (netbsd*|darwin*) ]]; then
arguments+=(
"-X[don't cross mount points when recursing]"
)
fi
if [[ $OSTYPE = netbsd* ]]; then if [[ $OSTYPE = netbsd* ]]; then
arguments+=( arguments+=(
'-M[output file sizes in comma-separated form]' '-M[output file sizes in comma-separated form]'
'-O[output only leaf (non-directory) files]' '-O[output only leaf (non-directory) files]'
'-P[print full pathname for each file]' '-P[print full pathname for each file]'
"-X[don't cross mount points when recursing]"
) )
fi fi
if [[ $OSTYPE = (dragonfly*|freebsd*|openbsd*|darwin*) ]]; then if [[ $OSTYPE = (dragonfly*|freebsd*|openbsd*|darwin*) ]]; then

View file

@ -38,11 +38,11 @@ case $variant; in
'(-f -n)-i[prompt before overwriting existing file]' '(-f -n)-i[prompt before overwriting existing file]'
) )
;| ;|
darwin*|dragonfly*|freebsd*|netbsd*)
args+=( "-h[if target is a symlink to a directory, don't follow it]" )
;|
darwin*|dragonfly*|freebsd*) darwin*|dragonfly*|freebsd*)
args+=( args+=( "(-f -i)-n[don't overwrite existing file]" )
"(-f -i)-n[don't overwrite existing file]"
"-h[if target is a symlink to a directory, don't follow it]"
)
;| ;|
darwin*|dragonfly*|*bsd*) darwin*|dragonfly*|*bsd*)
args+=( args+=(

View file

@ -106,9 +106,9 @@ case $OSTYPE in
;| ;|
linux-gnu|netbsd*) bsdarg+=( 'k[specify sort order]' ) ;| linux-gnu|netbsd*) bsdarg+=( 'k[specify sort order]' ) ;|
linux-gnu|openbsd*) bsd+=( 'f[show process hierarchy]' ) ;| linux-gnu|openbsd*) bsd+=( 'f[show process hierarchy]' ) ;|
darwin*|freebsd*|netbsd*) bsdarg+=( '*G[select processes by real group]' ) ;|
darwin*|freebsd*) darwin*|freebsd*)
bsd+=( 'X[skip processes with no controlling terminal]' ) bsd+=( 'X[skip processes with no controlling terminal]' )
bsdarg+=( '*G[select processes by real group]' )
;| ;|
freebsd*|dragonfly*) freebsd*|dragonfly*)
bsd+=( 'f[show command and environment for swapped out processes]' ) bsd+=( 'f[show command and environment for swapped out processes]' )

View file

@ -50,19 +50,28 @@ case $OSTYPE in
'(-d -p -T)-r[record a session with input, output and timing data]' '(-d -p -T)-r[record a session with input, output and timing data]'
) )
;| ;|
darwin*|netbsd*|freebsd*)
args+=(
'-e[return exit status of the child process]'
)
;|
netbsd*|openbsd*) netbsd*|openbsd*)
args+=( args+=(
'-c[run specified command instead of a shell]:command:_cmdstring' '-c[run specified command instead of a shell]:command:_cmdstring'
) )
;| ;|
darwin*|freebsd*)
args+=(
'(-a -r -k -t)-T[play back a recorded session, reporting only timestamps]: :_date_formats'
)
;|
netbsd*) netbsd*)
args+=( '-f[flush output after each write]' ) args+=( '-f[flush output after each write]' )
;| ;|
freebsd*) freebsd*)
args+=( args+=(
'-e[return exit status of the child process]'
'-f[use filemon(4)]' '-f[use filemon(4)]'
'(-a -r -k -t)-T[play back a recorded session, reporting only timestamps]: :_date_formats' '-w[forward terminal size changes on SIGWINCH]'
) )
;| ;|
darwin*|dragonfly*|freebsd*) darwin*|dragonfly*|freebsd*)

View file

@ -104,7 +104,7 @@ else
case $OSTYPE in case $OSTYPE in
openbsd*|freebsd*|netbsd*|darwin*|dragonfly*) openbsd*|freebsd*|netbsd*|darwin*|dragonfly*)
args+=( args+=(
'(-r -E)'{-E,-r}$extended '(-r -E -H)'{-E,-r}$extended
'-a[delay opening files listed with w function]' '-a[delay opening files listed with w function]'
) )
;| ;|
@ -115,8 +115,10 @@ else
args+=( args+=(
'-I+[edit files in-place, treating all files as a single input stream]:: :_guard "^(*[@/; \\\]*|?(#c6,)|-*)" "suffix for backup"' '-I+[edit files in-place, treating all files as a single input stream]:: :_guard "^(*[@/; \\\]*|?(#c6,)|-*)" "suffix for backup"'
) )
;; ;|
openbsd*) args+=( '-u[make output line buffered]' ) ;; openbsd*) args+=( '-u[make output line buffered]' ) ;;
darwin*) args+=( '(-r -E)-H[use enhanced regular expressions]' ) ;;
netbsd*) args+=( '(-r -E)-g[use GNU regular expressions]' '!(-r -E -g)-G' ) ;;
esac esac
fi fi

View file

@ -37,10 +37,14 @@ case $OSTYPE in
'-f[report on the number fork syscalls since boot and pages of virtual memory for each]' '-f[report on the number fork syscalls since boot and pages of virtual memory for each]'
) )
;| ;|
freebsd*|dragonfly*|netbsd*)
specs+=(
'-n+[change the maximum number of disks to display]:number of disks to display [2]'
)
;|
freebsd*|dragonfly*) freebsd*|dragonfly*)
specs+=( specs+=(
'-m[report on the usage of kernel dynamic memory allocated using malloc(9) by type]' '-m[report on the usage of kernel dynamic memory allocated using malloc(9) by type]'
'-n+[change the maximum number of disks to display]:number of disks to display [2]'
'*-p+[specify which types of devices to display]: :->devices' '*-p+[specify which types of devices to display]: :->devices'
'-s[display the contents of the SUM structure]' '-s[display the contents of the SUM structure]'
'-z[report on memory used by the kernel zone allocator, uma(9), by zone]' '-z[report on memory used by the kernel zone allocator, uma(9), by zone]'

View file

@ -23,7 +23,7 @@ case $OSTYPE in
openbsd*) openbsd*)
args+=( '-a[translate network addresses into names]' ) args+=( '-a[translate network addresses into names]' )
;| ;|
(free|net)bsd*|dragonfly*) (free|net)bsd*|dragonfly*|darwin*)
args+=( '-n[show network addresses as numbers]' ) args+=( '-n[show network addresses as numbers]' )
;| ;|
*bsd*|dragonfly*) *bsd*|dragonfly*)
@ -35,6 +35,11 @@ case $OSTYPE in
freebsd*|dragonfly*) freebsd*|dragonfly*)
args+=( '-d[dump process list on a per controlling tty basis]' ) args+=( '-d[dump process list on a per controlling tty basis]' )
;| ;|
netbsd*)
args+=(
'-A[sort tty names alphabetically instead of utmp or utmpx order]'
)
;|
solaris*) solaris*)
args+=( '!(-s -w -l)'{-l,-w} args+=( '!(-s -w -l)'{-l,-w}
'-s[short output form]' '-s[short output form]'

View file

@ -18,7 +18,7 @@ if _pick_variant gnu=GNU unix --version; then
else else
args=( -A "-*" "${(@)args:#(|\(*\))(|\*)--*}" ) args=( -A "-*" "${(@)args:#(|\(*\))(|\*)--*}" )
case $OSTYPE in case $OSTYPE in
freebsd*|netbsd*) args+=( '-L[print longest line lengths]' ) ;; freebsd*|netbsd*|darwin*) args+=( '-L[print longest line lengths]' ) ;;
openbsd*) args+=( '-h[human readable: use unit suffixes]' ) ;; openbsd*) args+=( '-h[human readable: use unit suffixes]' ) ;;
solaris*) args+=( ${${(M)args:#*-m\[*}//-m\[/-C\[} ) ;; solaris*) args+=( ${${(M)args:#*-m\[*}//-m\[/-C\[} ) ;;
esac esac

View file

@ -79,7 +79,7 @@ rw_ds_props=(
'paths:mountpoint:_directories -W / -P /'" 'paths:mountpoint:_directories -W / -P /'"
'multilevel:value:(on off)' 'multilevel:value:(on off)'
'nbmand:value:(on off)' 'nbmand:value:(on off)'
'primarycache:value:(all none metadata)' {prefetch,primarycache}':value:(all none metadata)'
'quota: :->quotas' 'quota: :->quotas'
'readonly:value:(on off)' 'readonly:value:(on off)'
'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)' 'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)'
@ -515,9 +515,11 @@ case $service:$words[1] in
;; ;;
zfs:set) zfs:set)
[[ $implementation = solaris ]] && args=( if [[ $implementation = solaris ]]; then
'-r[recursively apply value]' \ args=( '-r[recursively apply value]' )
) else
args=( "-u[update property but don't mount or share dataset]" )
fi
_arguments -C -A "-*" -S $args \ _arguments -C -A "-*" -S $args \
':property:->set-properties' \ ':property:->set-properties' \
'*:filesystem/volume:_zfs_dataset -t fs -t vol' '*:filesystem/volume:_zfs_dataset -t fs -t vol'
@ -598,13 +600,14 @@ case $service:$words[1] in
zfs:mount) zfs:mount)
[[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' ) [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' )
[[ $implementation = openzfs ]] && args+=( [[ $implementation = openzfs ]] && args+=(
'-l[load keys for encrypted filesystems as they are being mounted]' '-l[load keys for encrypted filesystems as they are being mounted]'
'(-a)-R[mount filesystems along with all their children]'
) )
_arguments -A "-*" -S $args \ _arguments -A "-*" -S $args \
'-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \ '-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \
'-v[report mount progress]' \ '-v[report mount progress]' \
'-f[force mount]' \ '-f[force mount]' \
'(:)-a[mount all available ZFS filesystems]' \ '(: -R)-a[mount all available ZFS filesystems]' \
'(-a):filesystem:_zfs_dataset -t fs' '(-a):filesystem:_zfs_dataset -t fs'
;; ;;
@ -888,6 +891,12 @@ case $service:$words[1] in
':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})' ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})'
;; ;;
zpool:(clear|online))
[[ $OSTYPE = linux* ]] && args=(
"--power[power on the device's slot in the storage enclosure]"
)
;|
zpool:help) zpool:help)
_arguments -A "-*" -S \ _arguments -A "-*" -S \
- commands \ - commands \
@ -905,6 +914,7 @@ case $service:$words[1] in
'-L[display real paths for vdevs resolving all symbolic links]' '-L[display real paths for vdevs resolving all symbolic links]'
'-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' \ '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' \
'-P[display real paths for vdevs instead of only the last component of the path]' '-P[display real paths for vdevs instead of only the last component of the path]'
--allow-ashift-mismatch --allow-in-use --allow-replication-mismatch
) )
elif [[ $implementation = solaris ]]; then elif [[ $implementation = solaris ]]; then
args=( '-l[display configuration in /dev/chassis location form]' ) args=( '-l[display configuration in /dev/chassis location form]' )
@ -1004,7 +1014,7 @@ case $service:$words[1] in
zpool:get) zpool:get)
[[ $implementation = solaris ]] && args=( [[ $implementation = solaris ]] && args=(
'-s+[specify sources to display]: :_values -s "source" local default none' '-s+[specify sources to display]: :_values -s , "source" local default none'
) )
_arguments -A "-*" -S $args \ _arguments -A "-*" -S $args \
'-H[suppress headers and tab-delimit fields]' \ '-H[suppress headers and tab-delimit fields]' \
@ -1140,6 +1150,9 @@ case $service:$words[1] in
[[ $implementation = openzfs ]] && args=( [[ $implementation = openzfs ]] && args=(
'-f[force disk into faulted state]' '-f[force disk into faulted state]'
) )
[[ $OSTYPE = linux* ]] && args=(
"--power[power off the device's slot in the storage enclosure]"
)
_arguments -C -A "-*" -S $args \ _arguments -C -A "-*" -S $args \
'-t[offline until next reboot]' \ '-t[offline until next reboot]' \
':pool:_zfs_pool' \ ':pool:_zfs_pool' \
@ -1147,7 +1160,7 @@ case $service:$words[1] in
;; ;;
zpool:online) zpool:online)
_arguments -C -A "-*" -S \ _arguments -C -A "-*" -S $args \
'-e[expand device to use all available space]' \ '-e[expand device to use all available space]' \
':pool:_zfs_pool' \ ':pool:_zfs_pool' \
'*:virtual device:->pool-devices' '*:virtual device:->pool-devices'
@ -1234,8 +1247,10 @@ case $service:$words[1] in
zpool:status) zpool:status)
if [[ $implementation = openzfs ]]; then if [[ $implementation = openzfs ]]; then
args=( args=(
'--power[display vdev enclosure slot power status]'
'-D[display a histogram of deduplication statistics]' '-D[display a histogram of deduplication statistics]'
'-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"' '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"'
'-e[only show unhealthy vdevs]'
'-i[display vdev initialization status]' '-i[display vdev initialization status]'
'-g[display vdev GUIDs instead of the normal device names]' '-g[display vdev GUIDs instead of the normal device names]'
'-L[display real paths for vdevs resolving all symbolic links]' '-L[display real paths for vdevs resolving all symbolic links]'