diff options
Diffstat (limited to 'Completion/Linux')
-rw-r--r-- | Completion/Linux/Command/_cryptsetup | 6 | ||||
-rw-r--r-- | Completion/Linux/Command/_dkms | 162 | ||||
-rw-r--r-- | Completion/Linux/Command/_iptables | 6 | ||||
-rw-r--r-- | Completion/Linux/Command/_kpartx | 6 | ||||
-rw-r--r-- | Completion/Linux/Command/_networkmanager | 8 | ||||
-rw-r--r-- | Completion/Linux/Command/_opkg | 462 | ||||
-rw-r--r-- | Completion/Linux/Command/_ss | 10 | ||||
-rw-r--r-- | Completion/Linux/Command/_sysstat | 12 | ||||
-rw-r--r-- | Completion/Linux/Command/_tune2fs | 2 |
9 files changed, 655 insertions, 19 deletions
diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index ea7152ea1..351859586 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -33,7 +33,7 @@ _arguments -s \ '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \ '--shared[share device with another non-overlapping crypt segment]' \ '--uuid=[set device UUID]:uuid' \ - '--allow-discards[allow discards (aka TRIM) requests for device]' \ + '--allow-discards[allow discard (aka TRIM) requests for device]' \ '--header=[device or file with separated LUKS header]:file:_files' \ '--test-passphrase[do not activate device, just check passphrase]' \ '--tcrypt-hidden[use hidden header (hidden TCRYPT device)]' \ @@ -64,6 +64,7 @@ _arguments -s \ '--persistent[set activation flags persistent for device]' \ '--label=[set label for the LUKS2 device]:label' \ '--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \ + '--unbound[create unbound (no assigned data segment) LUKS2 keyslot]' \ '(- : *)--version[show version information]' \ '(- : *)'{-\?,--help}'[display help information]' \ '(- : *)--usage[display brief usage]' \ @@ -86,6 +87,7 @@ case $state in 'luksAddKey:add a new key' 'luksRemoveKey:remove a key' 'luksChangeKey:change a key' + 'luksConvertKey:convert a key to new pbkdf parameters' 'luksKillSlot:wipe key from slot' 'luksUUID:print/change device UUID' 'isLuks:check if device is a LUKS partition' @@ -112,7 +114,7 @@ case $state in erase|convert|config|repair|(luks(AddKey|Erase|RemoveKey|DelKey|UUID|Dump)|isLuks)) args=( $device ) ;; - luks(Format|AddKey|RemoveKey|ChangeKey)) + luks(Format|AddKey|RemoveKey|ChangeKey|ConvertKey)) args=( $device ':key file:_files' ) ;; luksHeader*) args=( $device '--header-backup-file:file:_files' );; diff --git a/Completion/Linux/Command/_dkms b/Completion/Linux/Command/_dkms new file mode 100644 index 000000000..7ea34aa2e --- /dev/null +++ b/Completion/Linux/Command/_dkms @@ -0,0 +1,162 @@ +#compdef dkms + +local curcontext="$curcontext" ign cmds opts ret=1 +local -a state line expl args subcmds dirs +local -A opt_args + +subcmds=( + 'add:add a module/version combination to the tree for builds and installs' + 'remove:remove a module from the tree' + 'build:compile a module for a kernel' + "install:install a build module for it's corresponding kernel" + 'uninstall:uninstall a module for a kernel' + 'match:install every module that is installed for a template kernel for another kernel' + 'mkdriverdisk:create a floppy driver disk image for use when updated drivers are needed to install an OS' + 'mktarball:tar up files in the DKMS tree for a specific module' + 'ldtarball:extract a tarball created with mktarball into the DKMS tree' + 'mkrpm:create an RPM package for a module' + 'mkdeb:create a debian binary package for a module' + 'mkdsc:create a debian source package for a module' + 'mkkmp:create a Kernel Module Package source RPM for a module' + 'status:display the current status of modules, versions and kernels within the tree' + 'autoinstall:try to install the latest revision of all modules that have been installed for other kernel revisions' +) + +args=( + '(1)-m[specify module]:module:->modules' + '(1)-v[specify module version]:version' + '(-q --quiet)'{-q,--quiet}'[suppress output]' + '(--all)*'{-a,--arch}'[specify system architecture]:architecture:->architectures' + '*--directive=:directive' + '--dkmstree=:path:_directories' + '--installtree=:path:_directories' + '--sourcetree=:path:_directories' + '--dkmsframework=:path:_directories' + '1: : _describe -t commands command subcmds' +) + +cmd=${${${subcmds%%:*}:*words}[1]} +if [[ -n $cmd ]]; then + curcontext="${curcontext%:*}-$cmd:" +else + # exclude sub-commands based on any options specified so far + for cmds opts in \ + '(remove|build|install|uninstall|match|status|mk(^kmp))' 'k' \ + '(add|remove)' '-rpm_safe_upgrade' \ + 'mk(driverdisk|kmp)' '-spec' \ + 'mk(deb|dsc|rpm)' '-legacy-postinst' \ + 'mk(tarball|rpm|deb|dsc)' '-(source|binary)-only' \ + '(match|build|mkkmp)' '(k|-no-(prepare|clean)-kernel|-kernelsourcedir)' \ + '(|un)install' '-no-(depmod|initrd)' \ + 'mkdriverdisk' '([dr]|-distro|-release|-size|-media)' \ + '(add|build|install|ldtarball)' '-force' \ + 'match' '-templatekernel' \ + '*tarball' '-archive' \ + '(match|build|mkkmp)' '(j*|-no-(prepare|clean)-kernel|-kernelsourcedir)' \ + '(remove|build|install|status|mk(^kmp))' '-all' \ + 'build' '-config' + do + [[ -n ${(M)words:#-${~opts}*} ]] && + subcmds=( ${(M)subcmds:#${~cmds}:*} ) + done + args+=( '(1 -)'{-V,--version}'[display version information]' ) + ign='!' # hide some uncommon options but handle their arguments +fi + +case $cmd in + remove|build|install|uninstall|mk*|status) + args+=( ': :->modules' ) + ;| + |remove|build|install|uninstall|match|status|mk(^kmp)) + args+=( '(--all)*-k[specify kernel version]:kernel:->kernels' ) + ;| + |add|remove) args+=( "${ign}--rpm_safe_upgrade" ) ;| + |mk(driverdisk|kmp)) + args+=( "${ign}--spec=:spec file:_files -g '*.spec(-.)'" ) + ;| + |(mk|ld)tarball) + args+=( "${ign}--archive=:tarball:_files -g '*.tar(-.)'" ) + ;| + |mk(deb|dsc|rpm)) + args+=( "${ign}--legacy-postinst=:value [1]:(0 1)" ) + ;| + |mk(tarball|rpm|deb|dsc)) args+=( "${ign}(--source-only --binaries-only)--"{source,binaries}-only ) ;| + |match|build|mkkmp) + args+=( #TODO: check ignore needed in absence of parameters + "${ign}--no-prepare-kernel" + "${ign}--no-clean-kernel" + '--kernelsourcedir=:directory:_directories' + "${ign}-j+[specify maximum number of jobs to use when building]:jobs" + ) + ;| + |(|un)install) + args+=( + "${ign}--no-depmod" + "${ign}--no-initrd" + ) + ;| + |add) + args+=( + '-c[specify location of dkms.conf file]:location:_files' + ) + ;| + |remove|build|install|status|mk(^kmp)) + args+=( '(-a --arch -k)--all[specify all relevant kernels/arches]' ) + ;| + |build) + args+=( "${ign}--config=:kernel config file:_files" ) + ;| + |add|build|install|ldtarball) + args+=( '--force[force overwriting of extant files]' ) + ;| + |match) + args+=( "${ign}--templatekernel=:kernel:->kernels" ) + ;| + |mkdriverdisk) + args+=( + "${ign}(-d --distro)"{-d,--distro=}':distribution:(redhat'{,1,2,3}' suse unitedlinux)' + "${ign}(-r --release)"{-r,--release=}':release' + "${ign}--size=:size (kb) [1440]" + "${ign}--media=:media type [floppy]:(floppy iso tar)" + ) + ;| + add) + args+=( + '2:path:_directories' + '3:tarball:_files -g "*.tar(-.)"' + ) + ;; + install) + args+=( + '2:rpm file:_files -g "*.rpm(-.)"' + ) + ;; +esac + +_arguments -C $args && ret=0 + +case $state in + modules) + dirs=( ${(e)opt_args[--dkmstree]:-/var/lib/dkms}/*/*(/) ) + dirs=( ${${(M)dirs%/*/*}#/} ) + _description modules expl module + _multi_parts -i "$expl[@]" / dirs && ret=0 + ;; + kernels) + if compset -P 1 '*/'; then + _description architectures expl architecture + compadd "$expl[@]" /lib/modules/$IPREFIX/build/arch/*(/:t) && ret=0 + else + compset -S '/*' + dirs=( /lib/modules/*(/:t) ) + _description -V kernels expl kernel + compadd "$expl[@]" -r "/ \t\n\-" ${(on)dirs} && ret=0 + fi + ;; + architectures) + _description architectures expl architecture + compadd "$expl[@]" /lib/modules/$(uname -r)/build/arch/*(/:t) && ret=0 + ;; +esac + +return ret diff --git a/Completion/Linux/Command/_iptables b/Completion/Linux/Command/_iptables index 4178a1a2e..447d7c932 100644 --- a/Completion/Linux/Command/_iptables +++ b/Completion/Linux/Command/_iptables @@ -1,16 +1,16 @@ -#compdef iptables iptables-save iptables-restore +#compdef iptables iptables-save iptables-restore ip6tables ip6tables-save ip6tables-restore local curcontext="$curcontext" state line expl i ret=1 local -a cmds rcmds ropts rules states prev args case $service in - iptables-save) + iptables-save | ip6tables-save) _arguments -s \ {-c,--counters}'[include values of packet and byte counters in output]' \ {-t,--table}'[specify table]:table:(filter nat mangle)' return ;; - iptables-restore) + iptables-restore | ip6tables-restore) _arguments -s \ {-c,--counters}'[restore the values of all packet and byte counters]' \ {-n,--noflush}"[don't flush the previous contents of the table]" diff --git a/Completion/Linux/Command/_kpartx b/Completion/Linux/Command/_kpartx index 11c614c01..8f09c416d 100644 --- a/Completion/Linux/Command/_kpartx +++ b/Completion/Linux/Command/_kpartx @@ -1,6 +1,6 @@ #compdef kpartx -_arguments -s -w : \ +_arguments -s -S : \ '-a[add partition mappings]' \ '-r[read-only partition mappings]' \ '-d[delete partition mappings]' \ @@ -9,6 +9,6 @@ _arguments -s -w : \ '-p[set device name-partition number delimiter]' \ '-f[force creation of mappings]' \ '-g[force GUID partition table]' \ - '-v[Operate verbosely]' \ - '-s[don'\''t return until the partitions are created]' \ + '-v[operate verbosely]' \ + '-n[return before the partitions are created]' '!(-n)-s' \ '1: : _files' diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager index 881445abb..e38215e76 100644 --- a/Completion/Linux/Command/_networkmanager +++ b/Completion/Linux/Command/_networkmanager @@ -102,7 +102,7 @@ _nm_connection_up() { } _nm_connection_down() { - _arguments "1:connection:_nm_connection_specs" + _arguments "1:connection:_nm_connection_active" } _nm_connection_modify() { @@ -162,6 +162,12 @@ _nm_connection_ids() { _describe 'select connection' con_ids } +_nm_connection_active() { + local -a con_ids + con_ids=(${(f)"$(_call_program nmcli nmcli -t -f name connection show --active)"}) + _describe 'select connection' con_ids +} + _nm_device() { local curcontext="$curcontext" state line diff --git a/Completion/Linux/Command/_opkg b/Completion/Linux/Command/_opkg new file mode 100644 index 000000000..d64567681 --- /dev/null +++ b/Completion/Linux/Command/_opkg @@ -0,0 +1,462 @@ +#compdef opkg ipkg + +# Notes: +# +# - This function has been designed with opkg in mind, but much of it should +# also work with ipkg. +# +# - Caching doesn't appear to save a HUGE amount of time given the scale of most +# opkg repos (compared to e.g. APT) and the resources available to the devices +# that use them. +# +# - _opkg_pkg_* functions can be called with --update to update their respective +# cache files without actually completing. +# +# - Lots of code redundancy here (@todo). +# +# Notable styles supported: +# +# % zstyle ':completion:*:opkg:*' use-cache <yes/no> +# Set to yes to enable caching of package names. Usually disabled by default. +# +# % zstyle ':completion:*:opkg:*' cache-path <directory> +# Set to a directory path to override the default cache-file directory. +# +# % zstyle ':completion:*:opkg:*' cache-persists <yes/no> +# Set to yes to keep cache data in memory for the remainder of the shell +# session. Most completion functions do this always, but opkg tends to be used +# on fairly resource-constrained devices, so it's disabled by default here. +# +# % zstyle ':completion:*:opkg:*' status-paths <pattern> ... +# Set to one or more paths or glob patterns to override the defaults used when +# checking cache validity. If any of the specified files has been modified +# more recently than the cache, the cache is considered invalid. +# +# % zstyle ':completion:*:opkg:*' conf-paths <pattern> ... +# Set to one or more paths or glob patterns to override the defaults used when +# searching opkg configuration data. + +## +# Check cache validity. +__opkg_cache_policy() { + local -a tmp + + # Always invalidate if it's been over a week + tmp=( $1(#qmw+1N) ) + (( $#tmp )) && return 0 + + zstyle -a ":completion:$curcontext:" status-paths tmp + + if (( $#tmp )); then + tmp=( $~tmp(#qN) ) + else + tmp=( + {/opt,/usr,/var}/lib/{i,o}pkg/status(#q-.N) + {/opt,/usr,/var}/lib/{i,o}pkg/lists/packages(#q-.N) + /opt/var/opkg-lists/packages(#q-.N) + ) + fi + + # Always invalidate if we found no status files + (( $#tmp )) || return 0 + + # Invalidate if any status file is newer than the cache file + for 2 in $tmp; do + [[ $2 -nt $1 ]] && return 0 + done + + return 1 +} + +## +# Search opkg config files. +__opkg_grep_conf() { + local -aU tmp + + zstyle -a ":completion:$curcontext:" conf-paths tmp + + if (( $#tmp )); then + tmp=( $~tmp(#qN) ) + else + tmp=( + {,/opt}/etc/{i,o}pkg*.conf(#q-.N) + {,/opt}/etc/{i,o}pkg/*.conf(#q-.N) + ) + fi + + (( $#tmp )) || return 1 + + GREP_OPTIONS= command grep -sE "$@" $tmp +} + +## +# Complete architecture/priority pair. +# +# Architecture names are essentially arbitrary (up to the packager), so we can't +# really complete every possibility here — but we'll account for most of the +# popular ones. +_opkg_arch_prio() { + local -a copts=( "$@" ) + local -aU tmp + + [[ -prefix *: ]] && { + _message priority + return + } + + # Already configured arches + tmp=( ${(f)"$( _call_program architectures $svc print-architecture )"} ) + tmp=( ${${tmp##arch[ ]##}%% *} ) + + tmp+=( + # 'Meta' arches + all any noarch + # Arches supported by entware-ng + armv5soft armv7soft mipselsf x86-32 x86-64 + # Arches mentioned in the optware-ng source + arm armeb fsg3be hpmv2 i686 ixp4xxbe ixp4xxle mssii nslu2 powerpc qemux86 + slugosbe slugosle + # Arches mentioned in the Ångström distribution's narcissus source + a780 ac100 akita am180x-evm am3517-crane am3517-evm am37x-evm archos5 + archos5it arm arm-oabi armeb armv4 armv4b armv4t armv4tb armv5 armv5-vfp + armv5e armv5e-vfp armv5eb armv5t armv5t-vfp armv5te armv5te-vfp armv5teb + armv6 armv6-vfp armv6t-vfp armv7 armv7-vfp armv7a armv7a-vfp armv7a-vfp-neon + armv7at2-vfp armv7at2-vfp-neon armv7t2-vfp at32stk1000 at91sam9263ek + atngw100 avr32 beagleboard beaglebone bug20 c6a816x-evm c6a816x_evm c7x0 + cm-t35 collie da830-omapl137-evm da850-omapl138-evm davinci-dvevm dht-walnut + dm355-evm dm355-leopard dm357-evm dm365-evm dm3730-am3715-evm dm37x-evm + dm6446-evm dm6467-evm dm6467t-evm dns323 eee701 efika h2200 h3900 h4000 + h5000 hawkboard htcalpine hx4700 i386 i486 i586 i686 igep0020 iwmmxt + ixp4xxbe ixp4xxle kuropro lsppchd lsppchg lspro mini2440 mini6410 mips + mv2120 n1200 n2100 neuros-osd2 nokia800 om-gta01 om-gta02 omap3-pandora + omap3-touchbook omap3evm omap4430-panda omap4430_panda omap5912osk omapzoom + omapzoom2 omapzoom36x openrd-base openrd-client overo palmt650 poodle + powerpc ppc ppc405 ppc603e qemuarm qemumips qemuppc qemux86 sheevaplug + simpad smartq5 spitz tosa ts409 tsx09 usrp-e1xx x86 + ) + + _values -O copts -w -S : architecture ${^tmp}:priority +} + +## +# Complete destination name. +_opkg_dest() { + local -a copts=( "$@" ) + local -aU tmp + + tmp=( ${(f)"$( __opkg_grep_conf '^\s*dest\s+\S+\s+\S+' )"} ) + tmp=( ${tmp##[[:space:]]#dest[[:space:]]##} ) + tmp=( ${tmp%%[[:space:]]*} ) + + (( $#tmp )) || { + _message destination + return + } + _values -O copts -w destination $tmp +} + +## +# Complete destination-name/path pair. +_opkg_dest_path() { + local -a copts=( "$@" ) + local -aU tmp + + tmp=( ${(f)"$( __opkg_grep_conf '^\s*dest\s+\S+\s+\S+' )"} ) + tmp=( ${tmp##[[:space:]]#dest[[:space:]]##} ) + tmp=( ${tmp%%[[:space:]]*} ) + + (( $#tmp )) || { + _message destination:path + return + } + _values -O copts -w -S : destination ${^tmp}': :_directories' +} + +## +# Complete any package name. +_opkg_pkg_all() { + local -a upd copts + + zparseopts -a upd -D -E -update + copts=( "$@" ) + + { (( ! $#_opkg_cache_pkg_all )) || _cache_invalid opkg-pkg-all } && + ! _retrieve_cache opkg-pkg-all && { + _opkg_cache_pkg_all=( ${(f)"$( _call_program pkg-all ${svc:-opkg} list )"} ) + _opkg_cache_pkg_all=( ${(@)_opkg_cache_pkg_all##[[:space:]]*} ) + _opkg_cache_pkg_all=( ${(@)_opkg_cache_pkg_all%%[[:space:]]*} ) + _store_cache opkg-pkg-all _opkg_cache_pkg_all + } + (( $#upd )) && return 0 + + (( $#_opkg_cache_pkg_all )) || { + _message package + return + } + _values -O copts -w package $_opkg_cache_pkg_all +} + +## +# Complete installed package name. +_opkg_pkg_inst() { + local -a upd copts + + zparseopts -a upd -D -E -update + copts=( "$@" ) + + { (( ! $#_opkg_cache_pkg_inst )) || _cache_invalid opkg-pkg-inst } && + ! _retrieve_cache opkg-pkg-inst && { + _opkg_cache_pkg_inst=( ${(f)"$( + _call_program pkg-inst ${svc:-opkg} list-installed + )"} ) + _opkg_cache_pkg_inst=( ${(@)_opkg_cache_pkg_inst##[[:space:]]*} ) + _opkg_cache_pkg_inst=( ${(@)_opkg_cache_pkg_inst%%[[:space:]]*} ) + _store_cache opkg-pkg-inst _opkg_cache_pkg_inst + } + (( $#upd )) && return 0 + + (( $#_opkg_cache_pkg_inst )) || { + _message 'installed package' + return + } + _values -O copts -w 'installed package' $_opkg_cache_pkg_inst +} + +## +# Complete new (installable) package name. +_opkg_pkg_new() { + local -a upd copts + + zparseopts -a upd -D -E -update + copts=( "$@" ) + + { (( ! $#_opkg_cache_pkg_new )) || _cache_invalid opkg-pkg-new } && + ! _retrieve_cache opkg-pkg-new && { + _opkg_pkg_all --update + _opkg_pkg_inst --update + _opkg_cache_pkg_new=( ${_opkg_cache_pkg_all:|_opkg_cache_pkg_inst} ) + _store_cache opkg-pkg-new _opkg_cache_pkg_new + } + (( $#upd )) && return 0 + + (( $#_opkg_cache_pkg_new )) || { + _message 'installable package' + return + } + _values -O copts -w 'installable package' $_opkg_cache_pkg_new +} + +## +# Complete upgradeable package name. +_opkg_pkg_upgr() { + local -a upd copts + + zparseopts -a upd -D -E -update + copts=( "$@" ) + + { (( ! $#_opkg_cache_pkg_upgr )) || _cache_invalid opkg-pkg-upgr } && + ! _retrieve_cache opkg-pkg-upgr && { + _opkg_cache_pkg_upgr=( ${(f)"$( + _call_program pkg-upgr ${svc:-opkg} list-upgradable + )"} ) + _opkg_cache_pkg_upgr=( ${(@)_opkg_cache_pkg_upgr##[[:space:]]*} ) + _opkg_cache_pkg_upgr=( ${(@)_opkg_cache_pkg_upgr%%[[:space:]]*} ) + _store_cache opkg-pkg-upgr _opkg_cache_pkg_upgr + } + (( $#upd )) && return 0 + + (( $#_opkg_cache_pkg_upgr )) || { + _message 'upgradable package' + return + } + _values -O copts -w 'upgradable package' $_opkg_cache_pkg_upgr +} + +_opkg() { + local curcontext=$curcontext ret=1 cache_policy help variant svc=$words[1] + local -a line state state_descr args tmp + local -A opt_args val_args + + if + zstyle -t ":completion:*:*:$service:*" cache-persists && + (( ! $+_opkg_cache_pkg_all )) + then + typeset -gaU _opkg_cache_pkg_all + typeset -gaU _opkg_cache_pkg_inst + typeset -gaU _opkg_cache_pkg_new + typeset -gaU _opkg_cache_pkg_upgr + else + local -aU _opkg_cache_pkg_all + local -aU _opkg_cache_pkg_inst + local -aU _opkg_cache_pkg_new + local -aU _opkg_cache_pkg_upgr + fi + + zstyle -s ":completion:*:*:$service:*" cache-policy cache_policy + [[ -n $cache_policy ]] || + zstyle ":completion:*:*:$service:*" cache-policy __opkg_cache_policy + + # Options are ordered by long name. Alternative names not listed in the usage + # help are (mostly) ignored + args=( + '*--add-arch=[register architecture with priority]: :_opkg_arch_prio' + '*--add-dest=[register destination with path]: :_opkg_dest_path' + '--autoremove[remove unnecessary packages]' + '--combine[combine upgrade and install operations]' + '(-f --conf)'{-f+,--conf=}'[specify opkg config file]:config file:_files' + '(-d --dest)'{-d+,--dest=}'[specify root directory for package operations]: :_opkg_dest' + '--download-only[make no changes (download only)]' + '--force-checksum[ignore checksum mismatches]' + '--force-downgrade[allow package downgrades]' + '--force-depends[ignore failed dependencies]' + '(--force-maintainer --ignore-maintainer)--force-maintainer[overwrite local config files with upstream changes]' + '--force-overwrite[overwrite files from other packages]' + '--force-postinstall[always run postinstall scripts]' + '--force-reinstall[reinstall packages]' + # This is obnoxiously long; maybe add --force-removal-* to ignored-patterns + '--force-removal-of-dependent-packages[remove packages and all dependencies]' + '--force-remove[ignore failed prerm scripts]' + '--force-space[disable free-space checks]' + '(--force-maintainer --ignore-maintainer)--ignore-maintainer[ignore upstream changes to config files]' + '(-l --lists-dir)'{-l+,--lists-dir=}'[specify package-list directory]:list directory:_directories' + '(--noaction --test)'{--noaction,--test}'[make no changes (test only)]' + '--nodeps[do not follow dependencies]' + # Undocumented variant + '!(-o --offline --offline-root)--offline=:root directory:_directories' + '(-o --offline --offline-root)'{-o+,--offline-root=}'[specify root directory for offline package operations]:root directory:_directories' + '(-A --query-all)'{-A,--query-all}'[query all packages (not just installed)]' + '--recursive[remove packages and all their dependencies]' + '--size[show package sizes]' + '(-t --tmp-dir)'{-t+,--tmp-dir=}'[specify temp directory]:temp directory:_directories' + '(-V --verbosity)'{-V+,--verbosity=}'[specify output verbosity level]: :->verbosity-levels' + '(: -)'{-v,--version}'[display version information]' + '1: :->commands' + '*::: :->extra' + ) + + # There are a few different variants of opkg, but we'll concern ourselves + # mainly with OpenWRT/Entware vs (up-stream) Yocto + _pick_variant -r variant openwrt=--nocase yocto --help + + if [[ $variant == openwrt ]]; then + args+=( + '--cache=[specify cache directory]:cache directory:_directories' + '--nocase[match patterns case-insensitively]' + ) + else + args+=( + '*--add-exclude=[register package for exclusion]: :_opkg_pkg_all' + '--cache-dir=[specify cache directory]:cache directory:_directories' + '--host-cache-dir[do not place cache in offline root directory]' + '--no-install-recommends[do not install recommended packages]' + '--prefer-arch-to-version[prefer higher architecture priorities to higher versions]' + '--volatile-cache[use volatile download cache]' + ) + fi + + _arguments -s -S -C : $args && ret=0 + + case $state in + commands) + tmp=( + 'compare-versions[compare version numbers]' + 'configure[configure unpacked package]' + 'depends[display dependencies of package]' + 'download[download package]' + 'files[display files belonging to package]' + 'find[search package names and descriptions]' + 'flag[flag package]' + 'info[display package information]' + 'install[install package]' + 'list[display available packages]' + 'list-changed-conffiles[display user-modified config files]' + 'list-installed[display installed packages]' + 'list-upgradable[display upgradable packages]' + 'print-architecture[display installable architectures]' + 'remove[remove package]' + 'search[display packages providing file]' + 'status[display package status]' + 'update[update list of available packages]' + 'upgrade[upgrade installed package]' + 'whatconflicts[display what conflicts with package]' + 'whatdepends[display what depends on package]' + 'whatdependsrec[display what depends on package (recursive)]' + 'whatprovides[display what provides package]' + 'whatrecommends[display what recommends package]' + 'whatreplaces[display what replaces package]' + 'whatsuggests[display what suggests package]' + ) + [[ $variant == openwrt ]] || + tmp+=( 'clean[clean internal cache]' ) + + _values sub-command $tmp && ret=0 + ;; + verbosity-levels) + _values 'verbosity level' \ + '0[show errors only]' \ + '1[show normal messages (default)]' \ + '2[show informational message]' \ + '3[show debug messages (level 1)]' \ + '4[show debug messages (level 2)]' \ + && ret=0 + ;; + extra) + case $line[1] in + compare-versions) + case $CURRENT in + 1|3) _message 'version string' && ret=0 ;; + 2) + _values operator \ + '<<[earlier]' \ + '<=[earlier or equal]' \ + '=[equal]' \ + '>=[later or equal]' \ + '>>[later]' \ + && ret=0 + ;; + esac + ;; + configure|files|list-*|status) + (( CURRENT == 1 )) && _opkg_pkg_inst && ret=0 + ;; + depends|what*) + if [[ -n ${opt_args[(I)-A|--query-all]} ]]; then + _opkg_pkg_all && ret=0 + else + _opkg_pkg_inst && ret=0 + fi + ;; + download) + _opkg_pkg_all && ret=0 + ;; + find|info|list) + (( CURRENT == 1 )) && _opkg_pkg_all && ret=0 + ;; + flag) + if (( CURRENT == 1 )); then + _values flag hold noprune user ok installed unpacked && ret=0 + else + _opkg_pkg_inst && ret=0 + fi + ;; + install) + _opkg_pkg_new && ret=0 + ;; + remove) + _opkg_pkg_inst && ret=0 + ;; + search) + (( CURRENT == 1 )) && _files && ret=0 + ;; + upgrade) + _opkg_pkg_upgr && ret=0 + ;; + esac + ;; + esac + + (( ret && $#state )) && _message 'no more arguments' && ret=0 + return ret +} + +_opkg "$@" diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index dff289947..b1bfa207c 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -18,6 +18,7 @@ _arguments -C -s \ "($info -m --memory)"{-m,--memory}'[show socket memory usage]' \ "($info -p --processes)"{-p,--processes}'[show process using each socket]' \ "($info -i --info)"{-i,--info}'[show internal TCP information]' \ + "($info)--tipcinfo[show internal tipc socket information]" \ "($info -s --summary)"{-s,--summary}'[print summary statistics]' \ "($info -b --bpf)"{-b,--bpf}'[show bpf filter socket information]' \ "($info -E --events)"{-E,--events}'[continually display sockets as they are destroyed]' \ @@ -33,13 +34,14 @@ _arguments -C -s \ "($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \ "($info -w --raw)"{-w,--raw}'[display RAW sockets]' \ "($info -x --unix)"{-x,--unix}'[display Unix domain sockets]' \ + "($info)--tipc[display only TIPC sockets]" \ "($info)--vsock[display only vsock sockets]" \ - "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock)' \ + "($info -f --family)"{-f+,--family=}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock tipc)' \ "($info -K --kill)"{-K,--kill}'[forcibly close sockets, display what was closed]' \ "($info -H --no-header)"{-H,--no-header}'[suppress header line]' \ - "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram' \ - "($info -D)"{-D,--diag=}'[dump raw info to file]:file:_files' \ - "($info -F)"{-F,--filter=}'[read filter information from a file]:file:_files' \ + "($info -A --query --socket)"{-A+,--query=,--socket=}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram tipc' \ + "($info -D)"{-D+,--diag=}'[dump raw info to file]:file:_files' \ + "($info -F)"{-F+,--filter=}'[read filter information from a file]:file:_files' \ "($info)*: :->filter" && ret=0 if [[ -n $state ]]; then diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index 855bf0a70..8b7929ddd 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -9,7 +9,7 @@ _mpstat() { '(-A)-N[specify NUMA nodes]:NUMA node' \ '(-A)-n[report summary CPU statistics based on NUMA node placement]' \ '-o[display statistics in JSON]:format:(JSON)' \ - '(-A)-P[specify processor number]:processor: _values -s "," processor ON ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ + '(-A)-P[specify processor number]:processor: _values -s "," processor ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ '-u[report CPU utilization]' \ '(- 1 2)-V[display version information]' \ '1: : _guard "^-*" interval' \ @@ -85,29 +85,31 @@ _sar() { '-F[display statistics for mounted filesystems]' \ '-f[extract records from file]:record:_files' \ '-H[report hugepages utilization]' \ - '-h[display help]' \ + '(--human -p)-h[make output easier to read: implies --human and -p]' \ + '(- 1 2)--help[display usage information]' \ '--human[print sizes in human readable format]' \ '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \ '-i[select records as close as possible to interval]:interval' \ '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \ '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \ - '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \ + '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT ALL' \ '-o[save readings to file in binary form]:file:_files' \ '-P[report per-processor statistics]:processor: _values -s "," processors ALL' \ '-p[pretty-print device names]' \ '-q[report queue length and load averages]' \ '-R[report memory statistics]' \ - '-r[report memory utilization statistics]' \ + '-r[report memory utilization statistics]:: :(ALL)' \ '-S[report swap space utilization]' \ '-s[set starting time of report]:start time (HH\:MM\:SS)' \ '--sadc[print name of data collector]' \ '-t[display timestamps in original local time of file creator]' \ - '-u[report CPU utilization]: :(ALL)' \ + '-u[report CPU utilization]:: :(ALL)' \ '(- 1 2)-V[display version information]' \ '-v[report status of kernel tables]' \ '-W[report swapping statistics]' \ '-w[report task creation and system switching activity]' \ '-y[report TTY device activity]' \ + '-z[omit output for any devices lacking activity during sample period]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } diff --git a/Completion/Linux/Command/_tune2fs b/Completion/Linux/Command/_tune2fs index af120e279..3d64f266c 100644 --- a/Completion/Linux/Command/_tune2fs +++ b/Completion/Linux/Command/_tune2fs @@ -24,7 +24,7 @@ _arguments -s -S \ '-m+[set the percentage of reserved filesystem blocks]:percentage' \ '-M+[set the last-mounted directory for the filesystem]:directory:_files -/' \ '-o+[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback nobarrier block_validity discard nodelalloc' \ - '-O+[set or clear filesystem features]: :_values -s , feature dir_index dir_nlink encrypt extentextent extra_isize filetype flex_bg has_journalhuge_file large_file metadata_csum mmp project quota read-only resize_inode sparse_super uninit_bg' \ + '-O+[set or clear filesystem features]: :_values -s , feature 64bit dir_index dir_nlink ea_inode encrypt extent extra_isize filetype flex_bg has_journal large_dir huge_file large_file metadata_csum metadata_csum_seed mmp project quota read-only resize_inode sparse_super uninit_bg' \ '-r+[set the number of reserved filesystem blocks]:number' \ '-Q+[set quota feature on the superblock]: :_values -s , "quota option" usrquota grpquota prjquota' \ '-s+[set sparse super feature]:state:((0\:off 1\:on))' \ |