1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-11-17 11:41:07 +01:00

github #131: add missing options

This commit is contained in:
Christopher Bock 2025-04-12 13:20:15 +02:00 committed by Oliver Kiddle
parent a53cd5eacb
commit 044267cecb
7 changed files with 66 additions and 26 deletions

View file

@ -1,5 +1,11 @@
2025-10-23 Oliver Kiddle <opk@zsh.org>
* Christopher Bock: github #131 (with tweaks by dana):
Completion/Debian/Command/_dpkg, Completion/Debian/Command/_schroot,
Completion/Unix/Command/_libvirt, Completion/Debian/Type/_deb_files,
Completion/Debian/Command/_madison,
Completion/Unix/Command/_smartmontools: add missing options
* Kevin Cox: github #147: Completion/Unix/Command/_git,
Completion/Unix/Command/_ssh, Completion/Unix/Type/_hosts:
Clean up some leaked variables in completion functions

View file

@ -19,12 +19,14 @@ _dpkg_deb_only_actions=(
_dpkg_deb_actions=(
'(--build -b)'{--build,-b}'[build archive]:directory:_files -/'
'(--contents -c)'{--contents,-c}'[list contents]: :_deb_files'
'(--info -I)'{--info,-I}'[show info]: :_deb_files'
'(--field -f)'{--field,-f}'[show fields]: :_deb_files'
'(--control -e)'{--control,-e}'[extract control]: :_deb_files'
'(--extract -x)'{--extract,-x}'[extract files]: :_deb_files'
'(--vextract -X)'{--vextract,-X}'[extract and list files]: :_deb_files'
'(--raw-extract -R)'{--raw-extract,-R}'[extract files and control]: :_deb_files'
'(--field -f)'{--field,-f}'[show fields]: :_deb_files'
'--fsys-tarfile[output fs tarfile]: :_deb_files'
'--ctrl-tarfile[output ctrl tarfile]: :_deb_files'
'(--info -I)'{--info,-I}'[show info]: :_deb_files'
)
_dpkg_common_actions=(
@ -39,36 +41,43 @@ _dpkg_actions=(
'--configure[reconfigure specified packages]:*:package:->configure'
'(--remove -r)'{--remove,-r}'[remove package]:*:package:->remove'
'(--purge -P)'{--purge,-P}'[purge package]:*:package:->purge'
'(--verify -V)'{--verify,-V}'[verify package]:*:package:->verify'
'(--audit -C)'{--audit,-C}'[check for broken packages]'
'--update-avail[update available]:package file:_files'
'--merge-avail[merge available]:package file:_files'
'(--record-avail -A)'{--record-avail,-A}'[record available]:*:package files:->record_avail'
'--forget-old-unavail[forget uninstalled unavailable]'
'--clear-avail[clear available]'
'(--audit -C)'{--audit,-C}'[check for broken pkgs]'
'--get-selections[get selections]:pattern:'
'--set-selections[set selections]'
'--clear-selections[clear selections]'
'--yet-to-unpack[list uninstalled]'
'--print-architecture[print target architecture]'
'--print-installation-architecture'
'--print-foreign-architectures[print list of extra architectures]'
'--predep-package[predep package]'
'--add-architecture[add extra architecture]:architecture:->add_architecture'
'--remove-architecture[remove extra architecture]:architecture:->remove_architecture'
'--print-architecture[print target architecture]'
'--print-foreign-architectures[print list of extra architectures]'
'--assert--[assert feature]:what:(help support-predepends working-epoch long-filenames multi-conrep multi-arch versioned-provides protected-field)'
'--validate--[validate thing]:what:(pkgname trigname archname version)'
'--compare-versions[compare version numbers]:*::expression:= ->compare_versions'
)
_dpkg_options=(
'--abort-after[abort after errors]:number of errors:'
'--root=[alternative root]:root:_files -/'
'--instdir=[change inst root but not data dir]:_files -/'
'(--selected-only -O)'{--selected-only,-O}'[skip unselected packages]'
'(--skip-same-version -E)'{--skip-same-version,-E}'[skip packages with same version as installed]'
'(--refuse-downgrade -G)'{--refuse-downgrade,-G}'[skip packages with earlier version than installed]'
'(--auto-deconfigure -B)'{--auto-deconfigure,-B}'[install can break other packages]'
'--no-act[show potential actions but do not follow through]'
'-D+[debug options]:debug options:(h 1 2 3)'
'--debug=[debug options]:debug options:(help 1 2 3)'
--{force,refuse,no-force}'--[forcing options]:what:(all downgrade configure-any hold remove-reinstreq remove-protected remove-essential depends depends-version breaks conflicts confmiss confnew confold confdef confask overwrite overwrite-dir overwrite-diverted statoverride-add statoverride-remove security-mac unsafe-io script-chrootless architecture bad-version bad-path not-root bad-verify)'
'--ignore-depends=[ignore depends involving package]:package:_deb_packages avail'
--{force,refuse,no-force}'--[forcing options]:what:(all downgrade configure-any hold bad-path not-root overwrite overwrite-diverted bad-verify depends-version depends confnew confold confdef confmiss conflicts architecture overwrite-dir remove-reinstreq remove-essential help)'
'--no-act[show potential actions but do not follow through]'
'--dry-run[show potential actions but do not follow through]'
'--simulate[show potential actions but do not follow through]'
'--instdir=[change inst root but not data dir]:_files -/'
'--root=[alternative root]:root:_files -/'
'(--selected-only -O)'{--selected-only,-O}'[skip unselected packages]'
'(--skip-same-version -E)'{--skip-same-version,-E}'[skip packages with same version as installed]'
)
_dpkg_options_recursive=( '(--recursive -R)'{--recursive,-R}'[recursive]' )
@ -82,11 +91,11 @@ _dpkg_deb_and_query_only_options=(
)
_dpkg_query_actions=(
'(--status -s)'{--status,-s}'[display package status]:*:packages:->status'
'(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail'
'(--listfiles -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles'
'(--list -l)'{--list,-l}'[list packages]:*:packages:->list'
'(--status -s)'{--status,-s}'[display package status]:*:packages:->status'
'(--listfiles -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles'
'(--search -S)'{--search,-S}'[search for file owner]:*:pattern:->search'
'(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail'
'--admindir=[data directory]:directory:_files -/'
)
@ -147,7 +156,7 @@ case "$state" in
- nonrecur \
'*: :_deb_files'
;;
remove|status|listfiles)
remove|status|listfiles|verify)
_call_function ret _dpkg_$state && return ret
_arguments -C -A "-*" -s "$_dpkg_options[@]" \
'*:package:_deb_packages installed'

View file

@ -3,12 +3,15 @@
_arguments \
'(-a --architecture)'{-a,--architecture=}':arch:_sequence _deb_architectures -a "all source" -' \
'(-b --binary)'{-b,--binary-type=}':type:(deb udeb)' \
'(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free' \
'(-c --component)'{-c,--component=}':component:_values -s , "component list" main contrib non-free non-free-firmware' \
'(-g --greaterorequal)'{-g,--greaterorequal} \
'(-G --greaterthan)'{-G,--greaterthan} \
'(-h --help)'{-h,--help} \
'(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" stable testing unstable oldstable oldoldstable' \
'(-r --regex)'{-r,--regex} \
'(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable' \
'(-S --source-and-binary)'{-S,--source-and-binary} \
'(-u --url)'{-u,--url=}':url:_values -s , "url alias" debian new qa ubuntu all udd archive ports' \
'--version' \
'(--no-conf --noconf)'{--no-conf,--noconf} \
'*:package:_deb_packages avail'

View file

@ -9,19 +9,25 @@ _arguments -S \
'(-a --all)'{-a,--all}'[select all chroots and active sessions]' \
'--all-chroots[select all chroots]' \
'--all-sessions[select all active sessions]' \
'*'{-c,--chroot=}'[use specified chroot]:chroot:->chroot' \
'(-d --directory)'{-d,--directory=}'[directory to use]:dir:_files -W / -P /' \
'(-u --user)'{-u,--user=}'[username (default current user)]:user:_users' \
'--all-source-chroots[select all source chroots]' \
'--exclude-aliases[do not include aliases]' \
'*'{-c+,--chroot=}'[use specified chroot]:chroot:->chroot' \
'(-d --directory)'{-d+,--directory=}'[directory to use]:dir:_files -W / -P /' \
'(-u --user)'{-u+,--user=}'[username (default current user)]:user:_users' \
'(-s --shell)'{-s+,--shell=}'[shell to use as login shell]:shell:->shells' \
'(-l --list)'{-l,--list}'[list available chroots]' \
'(-i --info)'{-i,--info}'[show information about selected chroots]' \
'--location[print location of selected chroots]' \
'--config[dump configuration of selected chroots]' \
'(-p --preserve-environment)'{-p,--preserve-environment}'[preserve user environment]' \
'(-o --option)'{-o+,--option=}'[set option]:option key=value' \
'(-q --quiet)'{-q,--quiet}'[quiet]' \
'(-v --verbose)'{-v,--verbose}'[verbose]' \
'(-V --version)'{-V,--version}'[version]' \
'--automatic-session[begin, run and end a session automatically]' \
'(-b --begin-session)'{-b,--begin-session}'[begin a session; returns a session ID]' \
'(-r --run-session)'{-r,--run-session}'[run an existing session]' \
'(-n --session-name)'{-n+,--session-name=}'[session name]:session name' \
'--recover-session[recover an existing session]' \
'(-e --end-session)'{-e,--end-session}'[end an existing session]' \
'(-f --force)'{-f,--force}'[force operation]' \
@ -33,4 +39,8 @@ case "$state" in
_wanted tag expl 'chroot' \
compadd $(schroot -l -a)
;;
(shells)
_wanted -C $context shells expl shell compadd ${(f)^"$(</etc/shells)"}(N)
return
;;
esac

View file

@ -5,13 +5,15 @@
# the following:
#
# -c Include .changes and .dsc files
# -D Only .dsc files (e.g. apt-get build-dep ./foo.dsc)
local -a _expl _fopts _c _exts=( deb ddeb udeb )
local -a _expl _fopts _c _D _exts=( deb ddeb udeb )
zparseopts -a _fopts -D -E - \
c=_c 1 2 F+: J+: M+: n P+: q r+: R+: S+: V+: W+: X+:
c=_c D=_D 1 2 F+: J+: M+: n P+: q r+: R+: S+: V+: W+: X+:
(( $#_c )) && _exts+=( changes dsc )
(( $#_D )) && _exts+=( dsc )
_description files _expl 'Debian package'
_files "${(@)_fopts}" "${(@)_expl}" -g "*.(${(j<|>)_exts})(-.)"

View file

@ -18,7 +18,7 @@ interact_cmds=(cd echo exit quit connect)
typeset -A dom_opts
dom_opts=(
console " "
console --state-running
destroy " "
managedsave " "
reboot " "
@ -197,7 +197,7 @@ case $state in
return 1
fi
# Allow passing domain without --domain with few of the most used commands
if [[ $cmd == (destroy|edit|reboot|reset|start|shutdown) ]]; then
if [[ $cmd == (destroy|edit|reboot|reset|start|shutdown|console|guestinfo) ]]; then
if [[ $words[CURRENT-1] == $cmd ]]; then
values=( $(_call_program domains "noglob virsh $conn_opt list ${dom_opts[$cmd]:-"--all"} --name") )
[[ -n $values ]] && _wanted domains expl domain compadd ${=values} && return 0

View file

@ -9,13 +9,23 @@ _arguments -s -S \
"w[print all words]"
"(b v)n[suppress printing bits]"
"(b n)v[print all bits from valid words]"' \
'(--json)-j[output as JSON]' \
'(-j)--json=-[specify JSON/YAML output format]:: : _values -S "" "output format"
"c[compact]"
"g[grep/gron]"
"o[original]"
"s[sorted]"
"v[verbose]"
"y[YAML]"
"i[implemented dev]"
"u[unimplemented dev]"' \
'(H)*'{-g+,--get=}'[get device setting]:setting:(all aam apm lookahead security wcache rcache wcreorder)' \
'(H -a --all -x --xall -H --health -i --info -c --capabilities -A --attributes --scan --scan-open)'{-a,--all}'[show all SMART information for device]' \
'(H -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes --scan --scan-open)'{-x,--xall}'[show all information for device]' \
'(H 1 --scan-open --identify -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes)--scan[scan for devices]' \
'(H 1 --scan --identify -x --xall -a --all -H --health -i --info -c --capabilities -A --attributes)--scan-open[scan for devices and try to open each device]' \
'(H -q --quietmode)'{-q+,--quietmode=}'[set smartctl quiet mode]:quiet mode:(errorsonly silent noserial)' \
'(H -d --device)'{-d+,--device=}'[specify device type]:device type:(ata scsi nvme sat usbcypress usbjmicron usbprolific usbsunplus marvell areca 3ware hpt megaraid cciss auto test)' \
'(H -d --device)'{-d+,--device=}'[specify device type]:device type:(auto test ata scsi nvme sat usbcypress usbjmicron usbprolific usbsunplus sntasmedia sntjmicron sntrealtek marvell megaraid aacraid 3ware areca cciss hpt sssraid intelliprop jmb39x jms56x)' \
'(H)*'{-T+,--tolerance=}'[specify how tolerant smartctl should be of ATA SMART command failures]:tolerance:(normal conservative permissive verypermissive)' \
'(H -b --badsum)'{-b+,--badsum=}'[set action if checksum error is detected]:action:(warn exit ignore)' \
'(H)*'{-r+,--report=}'[report transactions]:transaction type:(ioctl ataioctl scsiioctl nvmeioctl)' \
@ -28,7 +38,7 @@ _arguments -s -S \
'(H -c --capabilities)'{-c,--capabilities}'[show device SMART capabilities]' \
'(H -A --attributes)'{-A,--attributes}'[show device SMART vendor-specific attributes and values]' \
'(H)*'{-f+,--format=}'[set output format for attributes]:format:(old brief hex,id hex,val hex)' \
'(H)*'{-l+,--log=}'[show device log]:log:(error selftest selective directory xerror xselftest background sasphy sataphy scttemp scttempsts scttemphist scttempint scterc devstat ssd gplog smartlog nvmelog)' \
'(H)*'{-l+,--log=}'[show device log]:log:(error selftest selective directory xerror xselftest background sasphy sataphy scttemp scttempsts scttemphist scttempint scterc devstat ssd gplog smartlog nvmelog farm)' \
'(H)*'{-v+,--vendorattribute=}'[set display option for vendor attribute]:vendor attribute:->vendorattrs' \
'(H -F --firmwarebug)'{-F+,--firmwarebug=}'[use firmware bug workaround]:bug:(none nologdir samsung samsung2 samsung3 xerrorlba swapid)' \
'(H -P --presets)'{-P+,--presets=}'[specify whether to use drive-specific presets]:preset usage:(use ignore show showall)' \