diff options
Diffstat (limited to 'Completion/Linux')
33 files changed, 1417 insertions, 143 deletions
diff --git a/Completion/Linux/Command/_alsa-utils b/Completion/Linux/Command/_alsa-utils index 91bb0b86c..dd5c26866 100644 --- a/Completion/Linux/Command/_alsa-utils +++ b/Completion/Linux/Command/_alsa-utils @@ -38,7 +38,7 @@ opts=( --disable-format'[disable automatic format conversions]' --disable-softvol'[disable software volume control (softvol)]' --test-position'[test ring buffer position]' - --test-coef='[test coefficient for ring buffer position (default 8)]' + --test-coef='[test coefficient for ring buffer position]:coefficient [8]' --test-nowait'[do not wait for ring buffer - eats whole CPU]' --max-file-time='[start another output file when the old file has recorded]' --process-id-file='[write the process ID here]' diff --git a/Completion/Linux/Command/_basenc b/Completion/Linux/Command/_basenc new file mode 100644 index 000000000..515621aaa --- /dev/null +++ b/Completion/Linux/Command/_basenc @@ -0,0 +1,30 @@ +#compdef basenc +# based on GNU coreutils 8.32 + +local specs=( + + '(type)' + "(info)--base64[same as 'base64' program (RFC4648 section 4)]" + "(info)--base64url[file- and url-safe base64 (RFC4648 section 5)]" + "(info)--base32[same as 'base32' program (RFC4648 section 6)]" + "(info)--base32hex[extended hex alphabet base32 (RFC4648 section 7)]" + "(info)--base16[hex encoding (RFC4648 section 8)]" + "(info)--base2msbf[bit string with most significant bit (msb) first]" + "(info)--base2lsbf[bit string with least significant bit (lsb) first]" + "(info)--z85[ascii85-like encoding (ZeroMQ spec-32/Z85)]" + + + enc + '(info dec -w --wrap)'{-w+,--wrap=}"[wrap encoded lines at specified column]:number of characters (0=disable wrapping) [76]: " + + + dec + '(info enc -d --decode)'{-d,--decode}"[decode data]" + '(info enc -i --ignore-garbage)'{-i,--ignore-garbage}"[when decoding, ignore non-alphabet characters]" + + + info + "(: -)--help[display help information and exit]" + "(: -)--version[output version information and exit]" + + + input + '(info)1:input file:_files' +) + +_arguments -s -S : $specs diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs index eb31580ad..65cf067aa 100644 --- a/Completion/Linux/Command/_btrfs +++ b/Completion/Linux/Command/_btrfs @@ -17,11 +17,14 @@ cmds_7=( get set list ) cmds_8=( enable disable rescan help ) cmds_9=( assign remove create destroy show limit help ) cmds_10=( start status cancel help ) -cmds_11=( chunk-recover fix-device-size super-recover zero-log ) +cmds_11=( chunk-recover fix-device-size super-recover zero-log create-control-device ) _arguments -C -A "-*" "$args[@]" \ '(- *)--help[print help information]' \ '(- *)--version[print version information]' \ + '(-v --verbose -q --quiet --help --version)'{-v,--verbose}'[verbose output of operation]' \ + '(-v --verbose -q --quiet --help --version)'{-q,--quiet}'[suppress all messages except errors]' \ + '(--help --version)--format=[specify output format]:format:(text json)' \ '(--version)1: :->groups' \ '2: :->cmds' \ '*:: :->args' && ret=0 @@ -60,6 +63,11 @@ while (( $#state )); do fi args=( '(-)--help[print help information]' ) case ${cont} in + (balance|replace):start|device:(add|delete|remove)|filesystem:resize) + args+=( + "--enqueue[wait if there's another exclusive operation running, otherwise continue]" + ) + ;| subvolume:create) args+=( '*-i[add the newly created subvolume to a qgroup]:qgroup' @@ -67,10 +75,10 @@ while (( $#state )); do ) ;; subvolume:delete) - args+=( + args+=( '!-v' '!--verbose' '(-c --commit-after -C --commit-each)'{-c,--commit-after}'[wait for transaction commit at the end of the operation]' '(-c --commit-after -C --commit-each)'{-C,--commit-each}'[wait for transaction commit after deleting each subvolume]' - '(-v --verbose)'{-v,--verbose}'[verbose output of operations]' + '(-i --subvolid)'{-i+,--subvolid=}'[specify id of subvolume to be removed]:subvolume id' '1:subvolume:_files -/' ) ;; @@ -112,7 +120,7 @@ while (( $#state )); do ;| subvolume:sync) args+=( '-s[sleep between checks]:delay (seconds) [1]' );; subvolume:find-new) args+=( '1:subvol:_files -/' '2:lastgen: _message "last gen"' );; - (device|filesystem|qgroup|subvolume):(df|du|show|usage)) + (device|filesystem|qgroup|subvolume):(df|du|show|usage)|scrub:status) args+=( '--iec[use 1024 as a base]' '--si[use 1000 as a base]' @@ -129,7 +137,7 @@ while (( $#state )); do '(-t --tbytes)'{-t,--tbytes}'[show sizes in TiB, or TB with --si]' ) ;| - (filesystem|qgroup):(du|show)) + (filesystem|qgroup|scrub):(du|show|status)) args+=( '--raw[output raw numbers in bytes]' '--human-readable[output human friendly numbers, base 1024]' @@ -139,17 +147,16 @@ while (( $#state )); do '--tbytes[show sizes in TiB, or TB with --si]' ) ;| - filesystem:resize) args+=( '1:size:_guard "(|+|-)[0-9]#[GKM]"' '2:path:->mounts' );; + filesystem:resize) args+=( '1: :_numbers -u bytes -N size K M G T P E' '2:path:->mounts' );; filesystem:defragment) - args+=( - '-v[verbose]' + args+=( '!-v' '-r[defragment files recursively]' '-c+[compress files while defragmenting]::compression algorithm:(zlib lzo zstd)' '-r[defragment files recursively]' '-f[flush after defragmenting]' - '-s[start position]:byte position' - '-l[defragment limited number of bytes]:length (bytes)' - '-t[defragment only files over a certain size]:minimum size (bytes) [32M]' + '-s[start position]: :_numbers -u bytes -d "beginning of file" offset K M G T P E' + '-l[defragment limited number of bytes]: :_numbers -u bytes length K M G T P E' + '-t[defragment only extents up to a certain size]: :_numbers -u bytes -d 32M "maximum extent size" K M G T P E' '*:file:_files' ) ;; @@ -192,10 +199,9 @@ while (( $#state )); do ;; device:ready) args+=( '1:device: _files -g "*(-%)"' );; scrub:(start|resume)) - args+=( + args+=( '!-q' "-B[don't background and print statistics at end]" '-d[print separate statistics for each device]' - '-q[omit error message and statistics]' '-r[read only mode]' '-R[raw print mode]' '-c[set ioprio class]:class:(( 0\:none 1\:realtime 2\:best-effort 3\:idle))' @@ -215,18 +221,17 @@ while (( $#state )); do ) ;; balance:start) - args+=( + args+=( '!-v' '!--verbose' '(-m -s)-d+[act on data chunks]:filter:->filters' '(-d -s)-m+[act on metadata chunks]:filter:->filters' '(-d -m)-s+[act on system chunks (only under -f)]:filters:->filters' - '-v[verbose mode]' '-f[force a reduction of metadata integrity]' "--full-balance[don't print warning and don't delay start]" '(--background --bg)'{--background,--bg}'[run balance operation asynchronously in the background]' '1:path:_files -/' ) ;; - balance:status) args+=( '-v[verbose mode]' '1:path:_files -/' );; + balance:status) args+=( '!-v' '!--verbose' '1:path:_files -/' );; balance:(pause|cancel|resume)) args+=( '1:path:_files -/' );; property:set) args+=( '3:value' );& property:get) args+=( '2:property:(ro label compression)' );& @@ -244,10 +249,14 @@ while (( $#state )); do '1:path:_files -/' ) ;; - qgroup:(assign|remove)) args+=( '1:source path:_files -/' - '2:destination path:_files -/' '3:path:_files -/' );| - qgroup:assign) args+=( \!--rescan - "--no-rescan[don't do a rescan, even if the assignment will make the quotas inconsistent]" ) + qgroup:(assign|remove)) + args+=( + \!--rescan + "--no-rescan[don't do a rescan, even if the quotas may become inconsistent]" + '1:source path:_files -/' + '2:destination path:_files -/' + '3:path:_files -/' + ) ;; qgroup:(create|destroy)) args+=( '1:qgroupid:' '2:path:_files -/' );; qgroup:show) @@ -296,6 +305,11 @@ while (( $#state )); do '(-t --tree)'{-t,--tree}'[print only tree with the given id (string or number)]:tree id' '--follow[use with -b, to show all children tree blocks of the block]' "--noscan[don't scan devices from the filesystem, use only the listed ones]" + '!(--dfs)--bfs' + '--dfs[depth-first traversal of the trees]' + '--hide-names[hide filenames/subvolume/xattrs and other name references]' + '--csum-headers[print node checksums stored in headers (metadata)]' + '--csum-items[print checksums stored in checksum items (data)]' ) ;; inspect*:dump-super) @@ -307,12 +321,12 @@ while (( $#state )); do '--bytenr[specify alternate superblock offset]:offset' ) ;; - inspect*:inode*) args+=( '-v[verbose mode]' '1:inode:_files' '2:path:_files -/' );; - inspect*:subvol*) args+=( '-v[verbose mode]' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );; + inspect*:inode*) args+=( '!-v' '1:inode:_files' '2:path:_files -/' );; + inspect*:subvol*) args+=( '!-v' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );; inspect*:logical*) - args+=( - '-v[verbose mode]' + args+=( '!-v' '-P[skip the path resolving and print the inodes instead]' + '-o[ignore offsets when matching references]' '-s[specify buffer size]:buffer size [4096]' '1:logical address:_files' '2:filesystem path:_files -/' @@ -322,9 +336,8 @@ while (( $#state )); do inspect*:rootid) args+=( '1:path:_files -/' );; inspect*:tree*) args+=( '-b[print raw numbers in bytes]' );; rescue:(chunk|super)-recover) - args+=( + args+=( '!-v' '-y[assume yes to every question]' - '-v[verbose mode]' '1:device:_files' ) [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('(-)-h[display help]') @@ -352,12 +365,11 @@ while (( $#state )); do ) ;; restore) - args+=( + args+=( '!-v' '!--verbose' '(-s --snapshots)'{-s,--snapshots}'[get snapshots]' '(-x --xattr)'{-x,--xattr}'[restore extended attributes]' '(-m --metadata)'{-m,--metadata}'[restore owner, mode and times]' '(-S --symlink)'{-S,--symlink}'[restore symbolic links]' - '(-v --verbose)'{-v,--verbose}'[be verbose and output what is restored]' '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors]' '(-o --overwrite)'{-o,--overwrite}'[overwrite directories and files]' '-t[specify tree location]:tree root' @@ -374,23 +386,20 @@ while (( $#state )); do ) ;; send|receive) - args+=( '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' ) + args+=( '!-q' '!--quiet' ) ;| send) - args+=( - '*-v[verbose mode]' + args+=( '!-v' '-e[if sending multiple subvolumes at once, use the new format]' '-p[send incremental stream]:parent:_files -/' '*-c[use snapshot as clone source]:clone:_files -/' '-f[specify output file]:file:_files' '--no-data[send in NO_FILE_DATA mode]' - '(-v --verbose)'{-v,--verbose}'[enable verbose output]' '1:subvolume:_files -/' ) ;; receive) - args+=( - '*-v[verbose mode]' + args+=( '!-v' '-f[input file]:file: _files' '-e[terminate after <end cmd>]' '(-C --chroot)'{-C,--chroot}'[confine the process to destination path using chroot(1)]' diff --git a/Completion/Linux/Command/_choom b/Completion/Linux/Command/_choom new file mode 100644 index 000000000..2a6dd03c7 --- /dev/null +++ b/Completion/Linux/Command/_choom @@ -0,0 +1,10 @@ +#compdef choom + +_arguments -S \ + '(H -n --adjust)'{-n,--adjust}'+[specify the adjust score value (-1000...1000)]:score (-1000...1000)' \ + '(H -p --pid)'{-p,--pid}'[interpret args as process ID]:process ID:_pids' \ + '(H -p --pid):command:_command_names' \ + '*::arguments:_normal' \ + + 'H' \ + '(- *)'{-V,--version}'[display version information]' \ + '(- *)'{-h,--help}'[display help information]' diff --git a/Completion/Linux/Command/_cpupower b/Completion/Linux/Command/_cpupower index ae1f1d3d1..6763bdd12 100644 --- a/Completion/Linux/Command/_cpupower +++ b/Completion/Linux/Command/_cpupower @@ -20,11 +20,12 @@ cmds=( 'info:show global power parameters' 'set:set global power parameters' 'monitor:report frequency and idle statistics' + 'powercap-info:show powercapping related kernel and hardware configurations' 'help:print usage information' ) case $state in cmds) - _describe command cmds && ret=0 + _describe command cmds -M 'r:|-=* r:|=*' && ret=0 ;; args) curcontext="${curcontext%:*}-$words[1]" diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index 45159d0be..f7149a76f 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -21,6 +21,7 @@ _arguments -s \ '--new-keyfile-offset=[specify number of bytes to skip in newly added keyfile]:offset (bytes)' \ '(-S --key-slot)'{-S+,--key-slot=}'[select key slot]:key slot' \ '(-b --size)'{-b+,--size=}'[force device size]:sectors' \ + '--device-size=[use only specified device size (ignore rest of device)]:size (bytes)' \ '(-o --offset)'{-o+,--offset=}'[set start offset]:sectors' \ '(-p --skip)'{-p+,--skip=}'[data to skip at beginning]:sectors' \ '(-r --readonly)'{-r,--readonly}'[create a read-only mapping]' \ @@ -44,10 +45,12 @@ _arguments -s \ '--veracrypt[scan also for VeraCrypt compatible device]' \ '--veracrypt-pim=[specify personal iteration multiplier for VeraCrypt compatible device]:multiplier' \ '--veracrypt-query-pim[query personal iteration multiplier for VeraCrypt compatible device]' \ - '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks plain loopaes tcrypt)' \ + '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks luks1 luks2 plain loopaes tcrypt bitlk)' \ '--force-password[disable password quality check (if enabled)]' \ '--perf-same_cpu_crypt[use dm-crypt same_cpu_crypt performance compatibility option]' \ '--perf-submit_from_crypt_cpus[use dm-crypt submit_from_crypt_cpus performance compatibility option]' \ + '--perf-no_read_workqueue[bypass dm-crypt workqueue and process read requests synchronously]' \ + '--perf-no_write_workqueue[bypass dm-crypt workqueue and process write requests synchronously]' \ '--deferred[device removal is deferred until the last user closes it]' \ '--serialize-memory-hard-pbkdf[use global lock to serialize memory]' \ '--pbkdf=[specify PBKDF algorithm for LUKS2]:algorithm:(argon2i argon2id pbkdf2)' \ @@ -60,14 +63,16 @@ _arguments -s \ '(-I --integrity)'{-I+,--integrity=}'[specify data integrity algorithm (LUKS2 only)]:algorithm' \ '--integrity-no-journal[disable journal for integrity device]' \ "--integrity-no-wipe[don't wipe device after format]" \ + '--integrity-legacy-padding[use inefficient legacy padding (old kernels)]' \ "--token-only[don't ask for passphrase if activation by token fails]" \ '--token-id=[specify token number]:number [any]' \ '--key-description=[specify key description]:description' \ '--sector-size=[specify encryption sector size]:size [512 bytes]' \ + '--iv-large-sectors[use IV counted in sector size (not in 512 bytes)]' \ '--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]' \ + '--unbound[create or dump unbound (no assigned data segment) LUKS2 keyslot]' \ '--json-file=[read or write token to json file]:json file:_files -g "*.json(-.)"' \ '--luks2-metadata-size=[specify LUKS2 header metadata area size]:size (bytes)' \ '--luks2-keyslots-size=[specify LUKS2 header keyslots area size]:size (bytes)' \ @@ -77,12 +82,13 @@ _arguments -s \ '--encrypt[Encrypt LUKS2 device (in-place encryption)]' \ '--decrypt[decrypt LUKS2 device (remove encryption)]' \ '--init-only[initialize LUKS2 reencryption in metadata only]' \ + '--resume-only[resume initialized LUKS2 reencryption only]' \ '--reduce-device-size=[reduce data device size (move data offset)]:size (bytes)' \ '--hotzone-size=[specify maximal reencryption hotzone size]:size (bytes)' \ '--resilience=[specify reencryption hotzone resilience type]:resilience type:(checksum journal none)' \ '--resilience-hash=[specify reencryption hotzone checksums hash]:string' \ '--active-name=[override device autodetection of dm device to be reencrypted]:string' \ - "${ign}(- : *)--version[show version information]" \ + "${ign}(- : *)"{-V,--version}'[show version information]' \ "${ign}(- : *)"{-\?,--help}'[display help information]' \ "${ign}(- : *)--usage[display brief usage]" \ ':action:->actions' \ @@ -111,6 +117,7 @@ case $state in 'isLuks:check if device is a LUKS partition' 'luksDump:dump header information' 'tcryptDump:dump TCRYPT device information' + 'bitlkDump:dump BITLK device information' 'luksSuspend:suspend LUKS device and wipe key' 'luksResume:resume suspended LUKS device' 'luksHeaderBackup:store binary backup of headers' diff --git a/Completion/Linux/Command/_dkms b/Completion/Linux/Command/_dkms index a0a666e33..2a3c016c5 100644 --- a/Completion/Linux/Command/_dkms +++ b/Completion/Linux/Command/_dkms @@ -8,6 +8,7 @@ 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' + 'unbuild:undoes the build of a module' "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' @@ -17,6 +18,7 @@ subcmds=( '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' + 'mkbmdeb:create a debian package containing just binary modules' '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' @@ -32,6 +34,7 @@ args=( '--installtree=:path:_directories' '--sourcetree=:path:_directories' '--dkmsframework=:path:_directories' + '--force-version-override' '1: : _describe -t commands command subcmds' ) @@ -44,7 +47,7 @@ else '(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(deb|dsc|bmdeb|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)' \ @@ -67,7 +70,7 @@ case $cmd in remove|build|install|uninstall|mk*|status) args+=( ': :->modules' ) ;| - |remove|build|install|uninstall|match|status|mk(^kmp)) + |remove|(un|)build|install|uninstall|match|status|mk(^kmp)) args+=( '(--all)*-k[specify kernel version]:kernel:->kernels' ) ;| |add|remove) args+=( "${ign}--rpm_safe_upgrade" ) ;| @@ -77,7 +80,7 @@ case $cmd in |(mk|ld)tarball) args+=( "${ign}--archive=:tarball:_files -g '*.tar(-.)'" ) ;| - |mk(deb|dsc|rpm)) + |mk(deb|dsc|bmdeb|rpm)) args+=( "${ign}--legacy-postinst=:value [1]:(0 1)" ) ;| |mk(tarball|rpm|deb|dsc)) args+=( "${ign}(--source-only --binaries-only)--"{source,binaries}-only ) ;| @@ -100,7 +103,7 @@ case $cmd in '-c[specify location of dkms.conf file]:location:_files' ) ;| - |remove|build|install|status|mk(^kmp)) + |remove|(un|)build|install|status|mk(^kmp)) args+=( '(-a --arch -k)--all[specify all relevant kernels/arches]' ) ;| |build) diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index dccda4684..95a8bbfb6 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -5,16 +5,21 @@ local -a state line expl cmds local -A opt_args _arguments -C \ + '--debug[turn on debugging messages]:mask:((1\:parser\ information))' \ + '--json[output results in JSON]' \ + '(-I --include-statistics)'{-I,--include-statistics}'[include command-related statistics in the output]' \ + '(cmds)'{-Q,--per-queue}'[apply per-queue command]: :(queue_mask):queue mask' \ "1:interface:_net_interfaces" \ - '*: :->args' \ + '*:: :->args' \ + + '(cmdc)' \ + '(cmds)'{-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \ + '(cmds)'{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \ + '(cmds)' \ '(1)'{-h,--help}'[display help information]' \ '(1)--version[display version information]' \ {-s,--change}'[allow changing some or all settings of the specified ethernet device]' \ {-a,--show-pause}'[query the specified ethernet device for pause parameter information]' \ {-A,--pause}'[change the pause parameters of the specified ethernet device]' \ - {-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \ - {-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \ {-g,--show-ring}'[query the specified ethernet device for RX/TX ring parameter information]' \ {-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \ {-k,--show-features,--show-offload}'[query the specified ethernet device for offload information]' \ @@ -46,10 +51,21 @@ _arguments -C \ '--set-eee[set EEE settings]' \ '--set-phy-tunable[set PHY tunable]' \ '--get-phy-tunable[get PHY tunable]' \ + '--get-tunable[get tunable parameters]' \ + "--set-tunable[set driver's tunable parameters]" \ '--reset[reset hardware components]' \ '--show-fec[query device for forward error correction support]' \ '--set-fec[configure forward error correction for device]' \ - {-Q,--per-queue}'[apply per-queue command]' && return + '--cable-test[perform cable test and report the results]' \ + '--cable-test-tdr[perform cable test and report Time Domain Reflectometer data]' \ + '--show-tunnels[show tunnel-related device capabilities and state]' \ + '--monitor[listen to netlink notifications and displays them]::command:( + --all -s --change -k --show-features --show-offload -K + --features --offload --show-priv-flags --set-priv-flags -g --show-ring + -G --set-ring -l --show-channels -L --set-channels -c --show-coalesce + -C --coalesce -a --show-pause -A --pause --show-eee --set-eee + --cable-test --cable-test-tdr + )' && return if [[ -n $state ]]; then case $words[CURRENT-1] in @@ -62,7 +78,8 @@ if [[ -n $state ]]; then _wanted onoff expl 'enabled' compadd off on fi ;; - autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift|fast-link-down) + autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift) ;& + fast-link-down|energy-detect-power-down|mode) _wanted onoff expl 'enabled' compadd off on ;; rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames) ;& @@ -71,6 +88,8 @@ if [[ -n $state ]]; then rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|dmac|rx-mini) ;& rx-jumbo|offset|length|magic|value|phyad|proto|tos|tclass|l4proto|src-port) ;& dst-port|spi|l4data|vlan-etype|vlan|user-def|action|vf|queue|loc) ;& + page|bank|i2c|first|last|step|pair|lanes) ;& + rx-copybreak|tx-copybreak|pfc-prevention-tout) ;& other|combined|tx-timer|count|msecs) _message -e numbers 'number' ;; @@ -81,7 +100,10 @@ if [[ -n $state ]]; then _wanted duplex expl 'duplex mode' compadd half full ;; port) - _wanted port expl 'device port' compadd tp aui bnc mii fibre + _wanted port expl 'device port' compadd tp aui bnc mii fibre da + ;; + master-slave) + _wanted roles expl role compadd {preferred,forced}-{master,slave} ;; advertise) _values 'hexadecimal value (or a combination of the following)' \ @@ -93,7 +115,8 @@ if [[ -n $state ]]; then '0x020[1000 full]' \ '0x8000[2500 full(not supported by IEEE standards)]' \ '0x800[10000 full]' \ - '0x03F[auto]' + '0x03F[auto]' \ + 'mode[set mode]' ;; xcvr) _wanted xcvr expl 'transceiver type' compadd internal external @@ -144,7 +167,7 @@ if [[ -n $state ]]; then _message -e contexts 'RSS context' ;; *) - case $words[2] in + case ${${(Mk)opt_args:#cmd?*}[1]#cmd?-} in -A|--pause) _values -S ' ' -w 'pause parameter' \ 'autoneg[specify if pause autonegotiation is enabled]' \ @@ -192,6 +215,9 @@ if [[ -n $state ]]; then -p|--identify) (( CURRENT = 4 )) && _message -e length 'duration (seconds)' ;; + -S|--statistics) + _arguments '(-)--all-groups' '(-)--groups:eth-phy: :eth-mac: :eth-ctrl: :rmon' + ;; -t|--test) _values -S ' ' -w 'test mode' \ '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \ @@ -202,8 +228,10 @@ if [[ -n $state ]]; then if (( ! $words[(I)msglvl] )); then _values -S ' ' -w 'generic option' \ 'speed[set speed in Mb/s]' \ + 'lanes[set number of lanes]' \ 'duplex[set full or half duplex mode]' \ 'port[select device port]' \ + 'master-slave[configure interface role]' \ 'autoneg[specify if autonegotiation is enabled]' \ 'advertise[set the speed and duplex advertised by autonegotiation]' \ 'phyad[PHY address]' \ @@ -274,16 +302,23 @@ if [[ -n $state ]]; then fi ;; -m|--dump-module-eeprom|--module-info) - _wanted options expl option compadd -F line - raw hex offset length + _wanted options expl option compadd -F line - raw hex offset \ + length page bank i2c ;; --set-eee) _wanted behaviours expl behaviour compadd -F line - eee advertise tx-lpi tx-timer ;; --set-phy-tunable) - _wanted options expl tunable compadd -F line - downshift count fast-link-down msecs + _wanted options expl tunable compadd -F line - downshift count \ + fast-link-down msecs energy-detect-power-down ;; --get-phy-tunable) - _wanted options expl tunable compadd downshift fast-link-down + _wanted options expl tunable compadd downshift fast-link-down \ + energy-detect-power-down + ;; + --[gs]et-tunable) + _wanted options expl tunable compadd rx-copybreak tx-copybreak \ + pfc-prevention-tout ;; --reset) _wanted components expl component compadd flags dedicated all \ @@ -303,6 +338,9 @@ if [[ -n $state ]]; then _wanted options expl option compadd -c --show-coalescing -C --coalesce fi ;; + --cable-test-tdr) + _wanted options expl 'distance options' compadd first last step pair + ;; esac ;; esac diff --git a/Completion/Linux/Command/_findmnt b/Completion/Linux/Command/_findmnt index 9f13e695f..0c832364d 100644 --- a/Completion/Linux/Command/_findmnt +++ b/Completion/Linux/Command/_findmnt @@ -22,9 +22,12 @@ _arguments -s -C \ '(H -M --mountpoint :)'{-M+,--mountpoint=}'[specify the mountpoint]: :->targets' \ '(H -n --noheadings)'{-n,--noheadings}'[do not print a header line]' \ '(H -O --options)'{-O+,--options=}'[only print the filesystems with the specified options]:list of options: ' \ - '(H -o --output)'{-o+,--output=}'[specify output columns]: :->columns' \ + '(H -o --output --output-all)'{-o+,--output=}'[specify output columns]: :->columns' \ + '(H -o --output)--output-all[output all available columns]' \ '(H -p --poll)'{-p+,--poll=}'[monitor changes in /proc/self/mountinfo]::action:(mount umount remount move)' \ + '(H --real)--pseudo[print only pseudo-filesystems]' \ '(H -R --submounts)'{-R,--submounts}'[print recursively all submounts]' \ + '(H --pseudo)--real[print only real filesystems]' \ '(H -S --source :)'{-S+,--source=}'[specify the mount source]: :->sources' \ '(H -T --target :)'{-T+,--target=}'[specify the mount target]:target:_files' \ '(H -t --types)'{-t+,--types=}'[specify the type of filesystems]:filesystem types:_sequence -s , _file_systems' \ @@ -39,7 +42,7 @@ _arguments -s -C \ '(H)2:: :->targets' \ + '(format)' \ '(H)'{-D,--df}'[imitate the output of df command]' \ - '(H)'{-J,--json}'[use JASON output format]' \ + '(H)'{-J,--json}'[use JSON output format]' \ '(H)'{-l,--list}'[use list output format]' \ '(H)'{-P,--pairs}'[use key="value" output format]' \ '(H)'{-r,--raw}'[use raw output format]' \ @@ -101,7 +104,7 @@ case $state in 'prefixes:prefix:compadd -S "" LABEL= UUID= PARTLABEL= PARTUUID=' ) [[ $state = sources_targets ]] && - alts+=( 'mount-points:moutpoint:__findmnt_mountpoints' ) + alts+=( 'mount-points:mountpoint:__findmnt_mountpoints' ) _alternative $alts && ret=0 fi ;; diff --git a/Completion/Linux/Command/_free b/Completion/Linux/Command/_free index cc5bcf3bd..6d74e4a0d 100644 --- a/Completion/Linux/Command/_free +++ b/Completion/Linux/Command/_free @@ -1,5 +1,4 @@ #compdef free -# based on procps-ng-3.3.15 _arguments -s \ '(-l --lohi)'{-l,--lohi}'[show detailed low and high memory statistics]' \ @@ -7,6 +6,7 @@ _arguments -s \ '(-w --wide)'{-w,--wide}'[wide mode]' \ '(-s --seconds)'{-s,--seconds}'[specify the delay between display]:seconds: ' \ '(-c --count)'{-c+,--count=}'[specify the display count]:count: ' \ + '(-C --full-cache)'{-C,--full-cache}'[add further cache lines to main cache]' \ '--si[use power of 1000 instead of power of 1024]' \ '(-)--help[print help and exit]' \ '(-)'{-V,--version}'[print version information and exit]' \ diff --git a/Completion/Linux/Command/_fusermount b/Completion/Linux/Command/_fusermount index 02cb57237..41d3dec72 100644 --- a/Completion/Linux/Command/_fusermount +++ b/Completion/Linux/Command/_fusermount @@ -6,7 +6,7 @@ typeset -A opt_args _arguments \ '-h[display help information]' \ '-V[display version information]' \ - '-o[specify mount options]:mount options:_fuse_values "mount options"' \ + '-o[specify mount options]:mount option:_fuse_values "mount option"' \ '-u[unmount a fuse mount]' \ '-z[unmount lazily (work even when if the resource is still busy)]' \ '-q[suppress nonessential output]' \ diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice index d64f1c496..ba403ca56 100644 --- a/Completion/Linux/Command/_ionice +++ b/Completion/Linux/Command/_ionice @@ -17,14 +17,14 @@ _arguments -C -s -S \ '(- *)'{-h,--help}'[display help information]' \ + '(args)' \ '(H)'{-p-,--pid=-}'[interpret args as process ID]::process id:_pids' \ - '(H)'{-P-,--pgid=-}'[specify process group IDs]::process group' \ + '(H)'{-P-,--pgid=-}'[specify process group IDs]::process group:_pgids' \ '(H)'{-u-,--uid=-}'[act on running process owned by specified users]::user id' && ret=0 if [[ -n $state ]]; then if (( $+opt_args[args--p] || $+opt_args[args---pid] )); then _pids && ret=0 elif (( $+opt_args[args--P] || $+opt_args[args---pgid] )); then - _message -e pgids 'process group' + _pgids && ret=0 elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then _message -e uids 'user id' else diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset index d05f13caf..a40480904 100644 --- a/Completion/Linux/Command/_ipset +++ b/Completion/Linux/Command/_ipset @@ -4,7 +4,7 @@ local offset=0 local -a args from_to hash cmds listopts addopts _set_types () { - _values -S \ "Set type" \ + _values -S \ "set type" \ 'bitmap\:ip[uses a memory range to store IPv4 host (default) or IPv4 subnet addresses up to 65536 elements]'\ 'bitmap\:ip,mac[uses a memory range to store an IPv4 host/subnet and mac address pair up to 65536 elements]'\ 'bitmap\:port[uses a memory range to store port numbers independent of L4 protocol at up to 65536 elements]'\ @@ -25,7 +25,7 @@ _set_types () { _ipsets () { local -a vals vals=( ${${(M)${(f)"$(_call_program ipsets ipset -L)"}%Name: *}#Name: } ) - _describe -t ipsets "IP sets" vals + _describe -t ipsets "IP set" vals } _sets () { _ipsets @@ -37,18 +37,11 @@ from_to=('(--network)--from[from IP or network (with --netmask)]:IP' '(--from --to)--network[network]:IP/mask' ) -_addressfamily () { - vals=( inet - inet6 - ) - _describe -t addressfamily "Address Family" vals -} - -hash=( '--hashsize[the initial hash size aligned to a power of 2(default 1024)]:hashsize' - '--maxelem[the maximum number of elements in the set (default 65536)]:maxelements' - '--family[the protocol family of addresses to be stored in the set (default inet)]:addressfamily:_addressfamily' +hash=( '--hashsize[the initial hash size aligned to a power of 2]:hashsize [1024]' + '--maxelem[the maximum number of elements in the set]:max elements [65536]' + '--family[the protocol family of addresses to be stored in the set]:address family [inet]:(inet inet6)' '--timeout[adds timeout support to the set with your specified value as default, (0 = forever)]:entrytimeout' - '--probes[max number of tries to resolve clashing, altering this is discouraged (default 8)]:probes' + '--probes[max number of tries to resolve clashing, altering this is discouraged]:tries [8]' '--resize[ratio of increasing hash size after unsuccessful <probes> of double-hashing, altering discouraged]:percent' ) @@ -100,7 +93,7 @@ case $words[offset+2]; in args=( $hash ) ;; list\:set) - args=( '--size[size of the new setlist (default 8)]:size' ) + args=( '--size[size of the new setlist]:size [8]' ) ;; esac ;; @@ -118,7 +111,7 @@ _ips () { if (( $ips )); then vals1+=$i; else bindings+=${i/ ->/:}; fi done _describe -t ips "IPs from $words[offset+3] set" vals1 - _describe -t special_values "special values" vals2 + _describe -t special_values "special value" vals2 fi } diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup index 54debe19e..f5a7ec1b1 100644 --- a/Completion/Linux/Command/_losetup +++ b/Completion/Linux/Command/_losetup @@ -33,14 +33,15 @@ _arguments -s -S \ {-D,--detach-all}'[detach all associated loop devices]' \ - 'create' \ '--direct-io[open backing file with O_DIRECT]::enable:(on off)' \ - '(-f --find 2)'{-f,--find}'[find the first unused loop device]' \ + '(-f --find 1)'{-f,--find}'[find the first unused loop device]' \ '(-L --nooverlap)'{-L,--nooverlap}'[avoid possible conflict between devices]' \ '(-P --partscan)'{-P,--partscan}'[scan the partition table of newly created loop devices]' \ '--sizelimit[limit device to specified size]:size (bytes)' \ '(-b --sector-size)'{-b+,--sector-size=}'[set logical sector size of loop device]:size (bytes)' \ '--show[print device name after setup]' \ '(-r --read-only)'{-r,--read-only}'[set up a read-only loop device]' \ - '1:file:_files' \ + "(-f)$device" \ + '2:file:_files' \ - 'assoc' \ '(-j --associated)'{-j,--associated}'[show the status of all loop devices associated with an file]:associated file:_files' \ "(-f)$device" diff --git a/Completion/Linux/Command/_lsns b/Completion/Linux/Command/_lsns new file mode 100644 index 000000000..994101d97 --- /dev/null +++ b/Completion/Linux/Command/_lsns @@ -0,0 +1,18 @@ +#compdef lsns + +local ign + +(( $#words > 2 )) && ign='!' +_arguments -s -S \ + '(-J --json)'{-J,--json}'[use JSON output format]' \ + '(-l --list)'{-l,--list}'[use list format output]' \ + '(-n --noheadings)'{-n,--noheadings}"[don't print headings]" \ + '(-o --output)'{-o,--output}'[define which output columns to use]:column:_sequence compadd -M "m\:{a-z}={A-Z}" - NS TYPE PATH NPROCS PID PPID COMMAND UID USER NETNSID NSFS' \ + '(-p --task)'{-p+,--task=}'[print process namespaces]:process id:_pids' \ + '(-r --raw)'{-r,--raw}'[use the raw output format]' \ + '(-u --notruncate)'{-u,--notruncate}"[don't truncate text in columns]" \ + '(-W --nowrap)'{-W,--nowrap}"[don't use multi-line representation]" \ + '(-t --type)'{-t+,--type=}'[filter by namespace type]:namespace type:(mnt net ipc user pid uts cgroup)' \ + "$ign(- *)"{-h,--help}'[display usage information]' \ + "$ign(- *)"{-V,--version}'[display version information]' \ + '*: :_guard "^-*" namespace' diff --git a/Completion/Linux/Command/_mat b/Completion/Linux/Command/_mat new file mode 100644 index 000000000..ff65167ff --- /dev/null +++ b/Completion/Linux/Command/_mat @@ -0,0 +1,19 @@ +#compdef mat + +# Completion for mat 0.6.1 (https://tails.boum.org/blueprint/doc/mat) + +local curcontext="$curcontext" state line +typeset -A opt_args +_arguments \ + '(- *)'{-h,--help}'[show help message and exit]' \ + '(-a --add2archive)'{-a,--add2archive}'[add to output archive non-supported filetypes]' \ + '(-b --backup)'{-b,--backup}'[keep a backup copy]' \ + '(-L --low-pdf-quality)'{-L,--low-pdf-quality}'[produces a lighter, but lower quality PDF]' \ + '(-c --check -b --backup)'{-c,--check}'[check if a file is free of harmful metadatas]' \ + '(-d --display -b --backup)'{-d,--display}'[list all the harmful metadata of a file without removing them]' \ + '(- *)'{-l,--list}'[list all supported fileformats]' \ + '(- *)'{-v,--version}"[show program's version number and exit]" \ + '*:file:_files -g "*.(tif|tiff|png|jpeg|jpg|jpe|odt|fodt|odx|odp|fodp|ods|fods|odg|fodg|docx|docm|pptx|pptm|xlsx|xlsm|pdf|tar|tar.bz2|tar.gz|zip|mp3|mp2|mp1|mpa|ogg|oga|flac|torrent)"' + # they are all that are in --list + # might not be all the supported files + diff --git a/Completion/Linux/Command/_mat2 b/Completion/Linux/Command/_mat2 new file mode 100644 index 000000000..98dd1d05b --- /dev/null +++ b/Completion/Linux/Command/_mat2 @@ -0,0 +1,19 @@ +#compdef mat2 + +# Completion for mat2 0.11.0 (https://0xacab.org/jvoisin/mat2). + +local curcontext="$curcontext" state line +typeset -A opt_args +_arguments \ + '(- *)'{-h,--help}'[show help message and exit]' \ + '(-V --verbose)'{-V,--verbose}'[show more verbose status information]' \ + --unknown-members'[policy how to handle unknown members of archive-style files]:policy:(abort omit keep)' \ + --inplace'[clean in place, without backup]' \ + --no-sandbox"[disable bubblewrap's sandboxing]" \ + '(- *)'{-v,--version}"[show program's version number and exit]" \ + '(- *)'{-l,--list}'[list all supported fileformats]' \ + '(- *)'--check-dependencies'[check if mat2 has all the dependencies it needs]' \ + '(-L --lightweight -s --show)'{-L,--lightweight}'[remove SOME metadata]' \ + '(-s --show -L --lightweight)'{-s,--show}'[list harmful metadata detectable by mat2 without removing them]' \ + '*:file:_files -g "*.(epub|pdf|odc|odf|odg|odi|odp|ods|odt|pptx|xlsx|docx|torrent|ncx|tar|xhtml|xhtm|xht|zip|mp3|mpga|mp1|mp2|oga|opus|ogg|spx|flac|wav|gif|jpg|jpe|jfif|jpeg|png|svgz|svg|tiff|tif|bmp|ppm|css|htm|html|cxx|text|log|txt|hh|hxx|el|conf|cc|pm|f90|mpg4|m4v|mp4|wmv|avi)"' + diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm index b6dce7ccb..5b73ef4be 100644 --- a/Completion/Linux/Command/_mdadm +++ b/Completion/Linux/Command/_mdadm @@ -156,7 +156,7 @@ _mds () { return 1 fi vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} ) - _describe -t mds "RAID devices" vals + _describe -t mds "RAID device" vals _arguments \ "(-h --help)"{-h,--help}'[display a mode specific help message]' } diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index ff6844f41..3e46130a2 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -12,7 +12,19 @@ _modules_caching_policy() _modutils() { local curcontext="$curcontext" expl state line modules modaliases ign args ret=1 local -A opt_args - local -r modules_dir=/lib/modules + local -a possible_modules_dirs=( + # Mostly every other distro + /lib/modules + # NixOS & possibly Guix + /run/booted-system/kernel-modules/lib/modules + ) + local modules_dir tested_modules_dir + for tested_modules_dir in "${possible_modules_dirs[@]}"; do + if [[ -d "$tested_modules_dir" ]]; then + modules_dir="$tested_modules_dir" + break + fi + done local update_policy zstyle -s ":completion:*:*:$service:*" cache-policy update_policy @@ -93,8 +105,10 @@ _modutils() { loaded-modules|loadable-modules) if [[ -r /proc/modules ]]; then loaded_modules=(${${(f)"$(</proc/modules)"}%% *}) + # For compatibility with old systems. Kernels nowadays provide + # `/proc/modules` which is more reliable and faster for us. elif [[ -x /sbin/lsmod ]]; then - loaded_modules=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *}) + loaded_modules=(${${(f)"$(_call_program loaded-modules /sbin/lsmod)"}[2,-1]%% *}) else return 1 fi @@ -106,8 +120,11 @@ _modutils() { ;& all-modules) - local kver=${opt_args[(i)(-S|-k|--set-version)]:-$(uname -r)} + local kver=${(v)opt_args[(i)(-S|-k|--set-version)]:-$(uname -r)} + if [[ -z "$modules_dir" ]]; then + return + fi if _cache_invalid modules-$kver || ! _retrieve_cache modules-$kver; then modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz|ko.xz)(.:t:r:r) ) @@ -115,7 +132,7 @@ _modutils() { _store_cache modules-$kver modules modaliases fi - if (( ${+opt_args[(k)(-R|--resolve-alias)]} )); then + if [[ -v opt_args[(i)(-R|--resolve-alias)] ]]; then _tags module-aliases else _tags files modules module-aliases @@ -137,7 +154,7 @@ _modutils() { _message -e value 'parameter value' else local params - params=( ${${(M)${(f)"$(_call_program module-parameters /sbin/modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) + params=( ${${(M)${(f)"$(_call_program module-parameters modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) compset -S '=*' if (( $#params )); then _values -S = -w 'module parameter' \ diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager index c9b09d145..1e05252b2 100644 --- a/Completion/Linux/Command/_networkmanager +++ b/Completion/Linux/Command/_networkmanager @@ -244,7 +244,7 @@ _nm_device_wifi() { local curcontext="$curcontext" state line _arguments -C \ - "1:command:(list connect hotspot rescan)" \ + "1:command:(list connect hotspot rescan show-password)" \ "*::arg:->args" case $line[1] in @@ -252,6 +252,7 @@ _nm_device_wifi() { c*) _nm_device_wifi_connect ;; ho*) _nm_device_wifi_hotspot ;; r*) _nm_device_wifi_rescan ;; + s*) _nm_device_wifi_show-password ;; esac } @@ -362,6 +363,12 @@ _nm_device_wifi_rescan() { "4:ssid:_nm_device_wifi_ssids" } +_nm_device_wifi_show-password() { + _arguments \ + "1: :(ifname)" \ + "2:interface:_nm_device_ifnames" +} + _nm_device_wifi_bssids() { local -a bssids bssids=(${(f)"$(_call_program nmcli nmcli -t -f bssid device wifi list)"}) diff --git a/Completion/Linux/Command/_nsenter b/Completion/Linux/Command/_nsenter new file mode 100644 index 000000000..8e7c6bc42 --- /dev/null +++ b/Completion/Linux/Command/_nsenter @@ -0,0 +1,28 @@ +#compdef nsenter + +local ign +(( $#words > 2 )) && ign='!' + +_arguments -S -s \ + '(-a --all)'{-a,--all}'[enter all namespaces]' \ + '(-t --target)'{-t+,--target=}'[specify target process to get namespaces from]:pid:_pids' \ + '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \ + '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \ + '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \ + '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \ + '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \ + '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \ + '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \ + '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \ + '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \ + '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \ + "--preserve-credentials[don't touch uids or gids]" \ + '(-r --root)'{-r+,--root=}'[set the root directory]:directory:_directories' \ + '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \ + '(-F --no-fork)'{-F,--no-fork}"[don't fork]" \ + '(-Z --follow-context)'{-Z,--follow-context}'[set SELinux context according to --target PID]' \ + "${ign}(- 1 *)"{-h,--help}'[display usage information]' \ + "${ign}(- 1 *)"{-V,--version}'[display version information]' \ + '1: : _command_names -e' \ + '*::args :_normal' + diff --git a/Completion/Linux/Command/_perf b/Completion/Linux/Command/_perf new file mode 100644 index 000000000..dd9621606 --- /dev/null +++ b/Completion/Linux/Command/_perf @@ -0,0 +1,809 @@ +#compdef perf + +local curcontext="$curcontext" curstate state line expl nm="$compstate[nmatches]" +local -a args opts cmd fields sortkeys +local -A exclude full short +local -i i skip + +exclude=( + --add \* --cgroup \* --definition \* --del \* + --detailed \* --dlarg \* --dsos \* --event \* --events \* + --fields \* --funcs \* --node-info \* --symbols \* --vars \* + --gtk '(--stdio --stdio2 --tui)' + --tui '(--gtk --stdio --stdio2)' + --stdio '(--gtk --tui --stdio2)' + --stdio2 '(--gtk --tui --stdio)' + --log-fd '(--output)' + --output '(--log-fd)' + --tracer '(-G --graph-funcs -g --nograph-funcs -F --funcs)' + --graph-funcs '(-g --nograph-funcs -N --notrace-funcs -T --trace-funcs -t --tracer)*' + --nograph-funcs '(-G --graph-funcs -N --notrace-funcs -T --trace-funcs -t --tracer)*' + --trace-funcs '(-N --notrace-funcs -G --graph-funcs -g --nograph-funcs -t --tracer)*' + --notrace-funcs '(-T --trace-funcs -G --graph-funcs -g --nograph-funcs -t --tracer)*' + --source '!(--no-source)' +) + +full=( + --addr-range '=[list traced records within address range]:range' + --affinity '=[set affinity mask of trace reading thread]:affinity:(node cpu)' + --aio '=[specify number of control blocks in asynchronous trace writing mode]:control blocks (1-4) [1]' + --all-cgroups '[record cgroup events]' + --all-cpus '[system-wide collection from all CPUs]' + --asm-raw '[show raw instruction encoding of assembly instructions]' + --aux-sample '=[sample AUX area]::options' + --baseline-only '[show only items with match in baseline]' + --branch-any '[sample any taken branches]' + --branch-filter '=[enable taken branch stack sampling]:mask' + --branch-stack '[use branch records for per branch histogram filling]' + --buffer-size '=[size of per-cpu buffer]: :_numbers size B K M G' + --build-ids '[inject build-ids into the output stream]' + --buildid-all '[handle build-id of all DSOs]' + --call-graph '=[enable call-graph (stacktrace) recording]:(fp dwarf)' + --cgroup '=[monitor event in named cgroup only]:cgroup' + --children '[accumulate callchains of children and show total overhead]' + --clang-opt '=:clang option' + --clang-path '=:clang binary:_command_names -e' + --clockid '=[specify clockid to use for events]:clock id' + --coalesce '=:coalesce field:_sequence compadd - pid tid iaddr dso' + --color-cpus '=[highlight given CPUs in map]:cpus' + --color-pids '=[highlight given pids in map]: :_sequence _pids' + --column-widths '=[use fixed column widths]:widths (comma-separated)' + --comms '=[restrict to specified comms]:comms' + --compression-level '=[produce compressed trace using specified level]:level (1-22) [1]' + --compute '=[set comparison method]:comparison method [delta-abs]:(delta delta-abs ratio wdiff)' + --control '=[listen on ctl-fd descriptor for command to control measurement]:descriptor' + --count '=[specify event period]:period' + --count-filter '=[only display functions with more than given number of events]:minimum number of events' + --cpu '=[restrict to specified CPUs]:cpus' + --cpus '=[restrict to specified CPUs]:cpus' + --cycles-hist '[show cycles histogram and standard deviation]' + --data '[record the sample addresses]' + --data-page-size '[record the sampled data address data page size]' + --definition '=[show trace-event definition converted from given probe-event]:event' + --delay '=[specify delay before starting measurement after program start]:delay (ms)' + --demangle '[demangle symbols]' + --demangle-kernel '[demangle kernel symbols]' + --detailed '[detailed run - start a lot of events]' + --disassembler-style '=[specify disassembler style]:style' + --dlarg '=:dlfilter argument' + --dlfilter '=[filter sample events using the given shared object]:file:_files -g "*.so(-.)"' + --dry-run '[parse options then exit]' + --dsos '=[only consider symbols in these dsos]:dso' + --dump-raw-trace '[dump raw trace in ASCII]' + --dump-symtab '[dump the symbol table used for profiling]' + --duration '=[show only events with duration over threshold]:minimum duration (ms)' + --entries '=[specify how many functions to display]:number of functions' + --event '=[select the PMU event]:event:->events' + --exclude-other '[only display entries with parent-match]' + --exclude-perf "[don't record events from perf itself]" + --exec '=[specify path to executable or shared library]:file:_files' + --expr '=[specify syscalls/events to trace]:syscall or event' + --field-separator '=[specify field separator]:separator' + --fields '=[specify output field]:field:->fields' + --filter '=[event filter]:filter' + --filter-pids '=[specify pids to filter]: :_sequence _pids' + --for-each-cgroup '=[expand events for each cgroup]:cgroup' + --force "[don't complain, do it]" + --format '=[specify output formatting style]:style:(default simple)' + --formula '[show formula]' + --freq '=[specify profile frequency]:frequency (Hz)' + --func-opts '=[specify function tracer options]:option:_sequence compadd - call-graph irq-info' + --funcs '=[show available functions]::filter' + --graph-funcs '=[select function_graph tracer and trace given functions]:function' + --graph-function '=[only print symbols and callees with --call-trace/--call-ret-trace]:symbol list' + --graph-opts '=[specify graph tracer options]: : _values -s , option nosleep-time noirqs verbose thresh\:duration depth\:depth' + --group '=[show event group information together]' + --group-sort-idx '=[sort output by specified event in group]:event index' + --gtk '[use the graphical interface]' + --guestkallsyms '=[provide copy of guest os /proc/kallsyms]:file:_files' + --guestmodules '=[provide copy of guest os /proc/modules]:file:_files' + --guestmount '=[specify guest os root file system mount directory]:path:_directories' + --guestvmlinux '=[provide guest os kernel]:kernel file:_files' + --hide_kernel_symbols '[hide kernel symbols]' + --hide_user_symbols '[hide user symbols]' + --hide-unresolved '[only display entries resolved to a symbol]' + --hierarchy '[show entries in a hierarchy]' + --ignore-callees '=[ignore callees of specified functions in call graphs]:functions (regex)' + --ignore-vmlinux '[ignore vmlinux files]' + --inherit '[trace child processes]' + --input '=[specify input file]:file:_files' + --interval-count '=[print counts for fixed number of times]:times' + --interval-print '=[print counts at regular interval]:interval (ms)' + --intr-regs '=[sample selected machine registers on interrupt]:register' + --inverted '[alias for inverted call graph]' + --iostat '=::default' + --itrace '=[specify instruction tracing options]:option:->itrace-opts' + --jit '[merge jitdump files into perf.data file]' + --kallsyms '=[specify kallsyms pathname]:path:_files' + --kcore '=[add specified kcore file to the cache]:file:_files' + --kernel '[show running kernel build id]' + --Latency '[show latency attributes (irqs/preemption disabled, etc)]' + --list '[list all cached files]' + --list-opts '[list available options]' + --log-fd '=[log output to file descriptor instead of stderr]:file descriptor:_file_descriptors' + --map-dump '=[specify BPF map to periodically dump]:BPF map' + --max-blocks '=[set maximum number of code blocks to dump with brstackinsn]:blocks' + --max-events '=[set maximum number of events to print]:events' + --max-size '=[limit the maximum size of the output file]: :_numbers size B K M G' + --max-stack '=[set maximum stack depth when parsing the callchain]:depth [kernel.perf_event_max_stack or 127]' + --metrics '=[monitor specified metrics or metric groups]:metric' + --min-stack '=[set minimum stack depth when parsing the callchain]:depth' + --mmap-flush '=[specify minimum size that is extracted from mmap data pages]: :_numbers -d 1 -u bytes size B K M G' + --mmap-pages '=[specify number of mmap data pages]:number of pages' + --modules '[load module symbols]' + --namespaces '[record namespaces events]' + --no-bpf-event "[don't record bpf events]" + --no-buildid "[don't collect buildids in perf.data]" + --no-buildid-cache "[don't update the buildid cache]" + --no-inherit "[child tasks don't inherit counters]" + --no-samples "[don't sample]" + --node-info '[show extra node info in report]' + --nograph-funcs "=[select function_graph tracer and don't trace given functions]:function" + --notrace-funcs "=[select function tracer and don't trace given functions]:function filter" + --null "[null run - don't start any counters]" + --num-thread-synthesize '=[specify number of threads to run for event synthesis]:threads' + --objdump '=[specify objdump binary to use for disassembly and annotations]:path:_command_names -e' + --order '=[specify compute sorting]:ordering [1]:(( + 0\:baseline\ overhead + 1\:computed\ value\ of\ column\ 1))' + --output '=[specify output file]:file:_files' + --parent '=[filter by parent caller]:parent (regex)' + --percent-limit "=[don't show entries under specified percentage]:percent" + --percent-type '=[set annotation percent type]:compadd {local,global}{period,hits}' + --percentage '=[set display of filtered entries percentages]:display:(relative absolute)' + --phys-data '[record/report sample physical addresses]' + --pid '=[restrict to specified process id]:process: _sequence _pids' + --post '=[specify command to run after to the measured command]: :_cmdstring' + --pre '=[specify command to run prior to the measured command]: :_cmdstring' + --prefix '=[add prefix to source file path names]:prefix:_directories' + --prefix-strip '=[strip elements from source file path names]:elements' + --pretty '=[specify pretty printing style]:key:(normal raw)' + --proc-map-timeout '=[specify per-thread proc mmap processing timeout]:timeout (ms)' + --quiet "[don't print any messages]" + --raw-samples '[collect raw sample records from all opened counters]' + --raw-trace '[show raw trace event output]' + --realtime '=[profile --addevents with specified priority]:RT SCHED_FIFO priority' + --repeat '=[specify amount of times to repeat the run]:repetitions' + --samples '=[specify number of samples to save per histogram entry for individual browsing]:samples' + --sched-stat '[get details of how long tasks slept]' + --show-cpu-utilization '[show sample percentage for different cpu modes]' + --show-info '[display extended perf.data information]' + --show-nr-samples '[show a column with the number of samples]' + --show-on-off-events '[show the --switch-on/off events too]' + --show-round-events '[display finished round events]' + --show-switch-events '[display context switch events]' + --show-total-period '[show a column with the sum of periods]' + --skip-missing '--skip-missing[skip symbols that cannot be annotated]' + --snapshot '=[select AUX area tracing snapshot mode]::snapshot capturing parameter' + --socket-filter '=[only show processor socket that match specified filter]:filter' + --sort '=[sort by specified keys]:key:->sort-keys' + --stat '[per-thread counts]' + --stdio '[use the stdio interface]' + --stdio-color '=[specify when to use colors in output]:mode [always]:(always never auto)' + --stdio2 '[use the stdio2 interface, non-interactive, TUI formatting]' + --stitch-lbr '[enable LBR callgraph stitching approach]' + --stop-bt '=[stop display of callgraph at these symbols]:symbol list' + --stream '[enable hot streams comparison]' + --strip '[strip non-synthesized events]' + --summary '[show only syscall summary with statistics]' + --switch-max-files '=[limit number of generated files to keep]:limit' + --switch-off '=[stop considering events after occurrence of specified event]:event' + --switch-on '=[consider events after occurrence of specified event]:event' + --switch-output '=[specify when to rotate output file]::signal or size [USR2]:_signals' + --switch-output-event '=[switch output event selector]:event:->events' + --sym-annotate '=[specify symbol to annotate]:symbol' + --symbol '=[specify symbol]:symbol' + --symbol-filter '=[only show symbols that match filter]:filter' + --symbols '=[only consider specified symbols]:symbol' + --symfs '=[look symbol files relative to specified directory]:directory:_directories' + --sync '[call sync() before starting a run]' + --system '[read and write system config file]' + --target-ns '=[obtain mount namespace information form the target pid]:pid:_processes' + --td-level '=[set the metrics level for the top-down statistics]:level' + --tid '=[restrict to specified threads]:tids' + --time '=[specify time span of interest]:time span (start,stop)' + --time-quantum '=[set time quantum for time sort key]: :_numbers -d 100ms "time quantum" ms us ns s' + --timeout '=[stop workload and print counts after a timeout period]:timeout (ms)' + --timestamp-filename '[append timestamp to output file name]' + --trace-fields '[show tracepoint fields]' + --trace-funcs '=[select function tracer and set function filter]:function filter' + --tracer '=[specify tracer to use]:tracer:(function_graph function)' + --tui '[use the curses interface]' + --uid '=[profile events in threads owned by uid]:uid:_users' + --user '[read and write user config file]' + --user-regs '=[sample selected machine registers on interrupt]:registers' + --vars '=[show available local variables at given probe point]:probe' + --vcpu '=[specify vcpu id to report]:vcpu' + --verbose '[be more verbose]' + --vm-time-correlation '=[correlate time between VM guests and the host]::options' + --vmlinux '=[specify vmlinux path]:vmlinux pathname:_files' + --weight '[sample by weight (on special events only)]' + --with-hits '[show only DSOs with hits]' + --with-summary '[show all syscalls and summary with statistics]' + --zero '[zero history across updates]' +) +short=( + --add -a + --all-cpus -a + --baseline-only -b + --branch-any -b + --build-ids -b + --cpu -C + --coalesce -c + --compute -c + --count -c + --delay -D + --dump-raw-trace -D + --data -d + --dsos -d + --event -e + --fields -F + --formula -F + --freq -F + --funcs -F + --force -f + --cgroup -G + --graph-funcs -G + --with-hits -H + --intr-regs -I + --show-info -I + --input -i + --no-inherit -i + --branch-filter -j + --jit -j + --clockid -k + --key -k + --vmlinux -k + --list -l + --disassembler-style -M + --buffer-size -m + --mmap-pages -m + --modules -m + --node-info -N + --no-buildid-cache -N + --no-samples -n + --show-nr-samples -n + --order -o + --output -o + --pid -p + --quiet -q + --raw-samples -R + --realtime -r + --repeat -r + --snapshot -S + --symbols -S + --with-summary -S + --sched-stat -s + --script -s + --sort -s + --summary -s + --timestamp -T + --tid -t + --tracer -t + --uid -u + --verbose -v + --weight -W + --column-widths -w + --field-separator -x + --compression-level -z + --zero -z +) + +cmd=( $words[1] ) +(( $#words > 2 )) && ign='!' + +_arguments -C -A "-*" \ + "${ign}(- *)"{-v,--version}'[display version information]' \ + "${ign}(- *)"{-h,--help}'[display usage information]' \ + "${ign}(- *)-vv[print the compiled-in status of libraries]" \ + '(- *)--exec-path[display or set exec path]' \ + '(- *)--html-path[display html documentation path]' \ + "${ign}(- *)--list-opts[list available options]" \ + "${ign}(- *)--list-cmds[list available subcommands]" \ + '!(-p --paginate --no-pager)'{-p,--paginate} \ + --no-pager \ + '--buildid-dir=[setup buildid cache directory]: :_directories' \ + '--debugfs-dir=[set debugfs directory]: :_directories' \ + '--debug=[setup debug variable]: : _values -s, "debug option" + verbose\:level ordered-events data-convert stderr perf-event-open' \ + '1: :->subcmds' \ + '*:: :->args' + +while (( $#state )); do + curstate=$state + shift state + case $curstate in + subcmds) + subcmds=( + ${${${(f)"$(_call_program subcmds $cmd)"}[3,-2]## ##}/ ##(#m)?/:$MATCH[-1]:l} + 'help:display help information about perf' + ) + _describe 'subcommand' subcmds + ;; + subsubcmds) + _description commands expl command + compadd "$expl[@]" -a subcmds + ;; + args) + (( $#words < 3 )) && ign='' + cmd+=( $words[1] ) + curcontext="${curcontext%:*:*}:${(j.-.)cmd}:" + args=() + skip=0 + case ${(j.-.)cmd[2,-1]} in + kvm-*|top|stat) + full[--group]='[put the counters into a counter group]' + ;| + bench-[^-]##(|-all)) skip=1 opts=() subcmds=() ;| + + annotate) + full+=( + --full-paths "[don't shorten the displayed pathnames]" + --print-line "[print matching source lines (may be slow)]" + ) + short+=( + --print-line -l + --full-paths -P + --symbol -s + ) + args+=( + "--no-source[don't interleave source code with assembly code]" + '1:: :_guard "^-*" "symbol name"' + ) + ;; + + archive) + _arguments --help '1:file:_files' + break + ;; + + bench) + short+=( + --edge -E + --format -f + --nfds -f + --group -g + --iterations -i + --loop -l + --nr_loops -l + --nr-mmaps -m + --multiq -m + --nested -N + --noaffinity -n + --nonblocking -B + --nr-samples -n + --pipe -p + --randomize -R + -fruntime -r + --size -s + --thread -t + --threaded -T + ) + args=( + '1:subsystem:(sched syscall mem numa futex epoll internals all)' + '*:: :->args' + ) + full+=( + --group '=[specify number of groups]:groups' + --nr_loops '=[specify number of loops to run]:loops [100]' + --pipe '[use pipe() instead of socketpair()]' + --runtime '=[specify runtime]:runtime (seconds)' + --thread '[be multi thread instead of multi process]' + --threads '=[specify number of threads]:threads' + --loop '=[specify number of loops]:loops' + --iterations '=[number of iterations used to compute average]:iterarions' + --threaded '[specify threads/process based task setup]' + --size '=[specify size of memory buffers]: :_numbers -d 1MB size B KB MB GB TB' + ) + ;; + bench-sched) args=( '1:suite:(all messaging pipe)' '*:: :->args' ) ;; + bench-numa) args=( '1:suite:(all mem)' '*:: :->args' ) ;; + bench-mem) args=( '1:suite:(all memcpy memset find_bit)' '*:: :->args' ) ;; + bench-futex) + args=( '1:suite:(all hash wake wake-parallel requeue lock-pi)' '*:: :->args' ) + ;; + bench-epoll) args=( '1:suite:(all wait ctl)' '*:: :->args' ) ;; + bench-internals) args=( '1:suite:(all synthesize kallsyms-parse inject-build-id)' '*:: :->args' ) ;; + bench-syscall) args=( '1:suite:(all basic)' '*:: :->args' ) ;; + + buildid-cache) + full+=( + --add '=[add specified file to the cache]:file:_files' + --debuginfod '=[specify debuginfod URL to be used when retrieving perf.data binaries]:url:_urls' + --missing '=[list missing build ids in the cache for the specified]:file:_files' + --purge '=[purge all cached binaries including older caches which have specified path from the cache]:path:_files' + --purge-all '[purge all cached binaries - flush out entire cache]' + --remove '=[remove a cached binary which has same build-id of specified file from the cache]:file:_files' + --update '=[update specified file of the cache]:file:_files' + ) + short+=( + --kcore -k + --missing -M + --purge -p + --purge-all -P + --remove -r + --update -u + ) + ;; + c2c) + args+=( '1:commands:(record report)' '*:: :->args' ) + ;; + daemon) + full+=( + --base '=[specify base directory]:base directory:_directories' + --config '=[specify config file path]:config file:_files' + --foreground "[don't put process in background]" + --session '=[apply to specific session]:session' + ) + short[--foreground]=-f + args=( '1:action:(start stop signal ping)' '*:: :->args' ) + ;; + (kvm-|)buildid-list) + short[--kernel]=-k + ;; + config) + full[--list]='[show current config variables]' + ;; + data) + full+=( + --all '[convert all events]' + --to-json '=[convert to JSON format]:output file:_files' + --to-ctf '=[convert to CTF format]:output file:_files' + --tod '[convert time to wall clock time]' + ) + exclude+=( + --to-ctf '(--to-json)' + --to-json '(--to-ctf)' + ) + ;; + (kvm-|)diff) + short+=( + --baseline-only -b + --compute -c + --comms -C + --field-separator -t + --formula -F + --order -o + --period -p + ) + full+=( + --period '[show period values]' + ) + unset 'short[--pid]' + unset 'short[--tid]' + sortkeys=( pid comm dso symbol cpu parent srcline ) + ;; + evlist) + short+=( --group -g ) + ;; + ftrace) + short+=( + --nograph-funcs -g + --graph-funcs -G + --buffer-size -m + --notrace-funcs -N + --trace-funcs -T + --tracer -t + ) + unset 'short[--tid]' + ;; + help*) + short+=( -a --all -i --info -m --man -w --web ) + ;; + inject) + short+=( --jit -j --build-ids -b --sched-stat -s ) + ;; + kmem) + full+=( + --alloc '[show per-allocation statistics]' + --caller '[show per-callsite statistics]' + --raw-ip '[show raw ip instead of symbol]' + --line '=[show specified number of lines]:lines' + --live '[show live page stat]' + --slab '[analyze SLAB allocator events]' + --page '[analyze page allocator events]' + ) + short[--line]=-l + sortkeys=( + ptr callsite bytes hit pingpong frag + page order migtype gfp + ) + ;; + list) + short+=( --desc -d --long-desc -v ) + full+=( + --desc '[print extra event descriptions]' + --details '[print information on the perf event names and expressions used internally by events]' + --long-desc '[print longer event descriptions]' + ) + args=( '*::events:->event-types' ) + ;; + lock-info) + short[--map]=-m + short[--threads]=-t + full+=( + --map '[dump map of lock instances (address:name table)]' + --threads '[dump thread list in perf.data]' + ) + ;; + lock-report) + full[--key]='=[specify sort key]:key [acquired]:(acquired contended avg_wait wait_total wait_max wait_min)' + ;; + mem) + short[--phys-data]=-p + short[--type]=-t + short[--dump-raw-samples]=-D + full[--type]='=[select the memory operation type]:type:(load store)' + full[--dump-raw-samples]='[dump raw samples in ASCII]' + ;; + probe) + full+=( + --add '=[probe point definition]:probe' + --del '=[delete a probe event]:probe event' + --filter '=[set a filter]:filter' + --line '[show source code lines which can be probed]' + --max-probes '=[set how many probe points can be found for a probe]:probes' + --module '=[specify target module name or path]:module name or path:_directories' + --range '[show variables location range in scope]' + --source '=[specify path to kernel source]:path:_directories' + ) + short+=( + --definition -D + --del -d + --exec -x + --line -L + --module -m + --dry-run -n + --source -s + --vars -V + ) + unset 'exclude[--source]' + unset 'short[--list]' + ;; + timechart-record) + short+=( --io-only -I --callchain -g ) + full+=( + --callchain '[record callchain]' + --io-only '[record only IO data]' + ) + ;; + *record) + short+=( + --data -d + --clockid -k + --no-samples -n + --no-buildid -B + --no-buildid-cache -N + --period -P + --stat -s + ) + full+=( + --overwrite '[use overwrite mode]' + --period '[record the sample period]' + --timestamp '[record the sample timestamps]' + --transaction '[sample transaction flags (special events only)]' + ) + ;; + (c2c-|kvm-|)report) + short+=( + --branch-stack -b + --comms -c + --inverted -G + --call-graph -g + --parent -p + --threads -T + --field-separator -t + --exclude-other -x + ) + full+=( + --threads '[show per-thread event counters]' + ) + unset 'short[--pid]' + unset 'short[--tid]' + sortkeys=( + pid comm dso symbol parent cpu socket srcline weight local_weight cgroup_id + ) + fields=( + overhead period sample overhead overhead_sys overhead_us + overhead_guest_sys overhead_guest_us overhead_children + sample period pid comm dso symbol parent cpu socket + srcline srcfile local_weight weight transaction trace + symbol_size dso_size cgroup cgroup_id ipc_null time + code_page_size local_ins_lat ins_lat p_stage_cyc dso_from + dso_to symbol_from symbol_to mispredict abort in_tx + cycles srcline_from srcline_to ipc_lbr symbol_daddr + dso_daddr locked tlb mem snoop dcacheline symbol_iaddr + phys_daddr data_page_size blocked + ) + ;; + sched-latency) + short+=( + --CPU -C + --pids -p + ) + full+=( + --pids '[latency stats per pid instead of per comm]' + --CPU '=[specify CPU to profile on]:cpu' + ) + ;; + sched-timehist) + short+=( + --idle-hist -I + --migrations -M + --next -n + --cpu-visual -V + --wakeups -w + ) + full+=( + --cpu-visual '[add CPU visual]' + --idle-hist '[show idle events only]' + --migrations '[show migration events]' + --next '[show next task]' + --state '[show task state when sched-out]' + --wakeups '[show wakeup events]' + ) + ;; + (*-|)script) + short+=( --comms -c --gen-script -g --Latency -L --debug-mode -d ) + full+=( + --debug-mode '[do various checks like samples ordering and lost events]' + --gen-script '=[generate perf-script.xx script in specified language]:language' + --script '=[specify script file name]:script file name:_files' + ) + unset 'short[--pid]' + unset 'short[--dsos]' + unset 'short[--tid]' + fields=( + comm tid pid time cpu event trace ip sym dso addr symoff + srcline period iregs uregs brstack brstacksym flags + bpf-output brstackinsn brstackoff callindent insn insnlen + synth phys_addr metric misc ipc tod data_page_size + code_page_size + ) + ;; + *stat*) + full+=( + --big-num "[print large numbers with thousands' separators]" + --delay '=[wait after starting program]:delay (msecs)' + --key '=[specify key for sorting]:key:(sample time)' + --no-aggr '[disable CPU count aggregation]' + --transaction '[hardware transaction statistics]' + ) + short+=( + --no-aggr -A + --big-num -B + --detailed -d + --group -g + --interval-print -I + --metrics -M + --null -n + --sync -S + --transaction -T + ) + exclude+=( + --log-fd '(-o --output)' + --output '(--log-fd)' + ) + unset 'short[--quiet]' + ;; + test*) + short+=( --dont-fork -F --skip -s ) + full+=( + --dont-fork "[don't fork for testcase]" + --skip '=[specify tests to skip]:test' + ) + ;; + timechart) + short+=( --width -w --topology -t --proc-num -n --process -p ) + full+=( + --highlight '=[highlight tasks that outlast duration or with given name]:duration or name' + --io-skip-eagain "[don't draw EAGAIN IO events]" + --io-min-time '=[all IO faster than minimum time will visually appear longer]: :_numbers -u ns -d 1ms time ms us' + --io-merge-dist '=[merge events that are within specified time]: :_numbers -u ns -d 1us time ms us' + --process '=[select process]:process:_pids' + --proc-num '=[specify minimum number of tasks to print]:tasks' + --topology '[sort CPUs according to topology]' + --width '=[specify page width]:page width' + ) + ;; + (kvm-|)top) + full+=( + --delay '=[specify delay between refreshes]:delay (seconds)' + --comms '=[only consider symbols in specified comms]:comm' + --dsos '=[only consider symbols in these dsos]:dso' + --overwrite '[use a backward ring buffer]' + ) + short+=( + --count-filter -f + --delay -d + --dump-symtab -D + --entries -E + ) + unset 'short[--dsos]' + unset 'short[--fields]' + unset 'short[--force]' + unset 'short[--symbols]' + sortkeys=( + pid comm dso symbol parent srcline weight local_weight + abort in_tx transaction overhead sample period + ) + fields=( overhead period sample $sortkeys ) + ;; + trace) + short+=( + --pf -F + --summary -s + --time -T + ) + full+=( + --pf '=[trace pagefaults]::type [maj]:(all min maj)' + --time '[show full timestamp, not relative]' + ) + unset 'short[--no-inherit]' + ;; + esac + if (( !skip )); then + subcmds=( $(_call_program commands "$cmd --list-cmds|grep -v -e '^#' -e Unknown") ) + opts=( $(_call_program options "$cmd --list-opts|grep -v -e '^#' -e Unknown") ) + fi + + for (( i = $#opts; i; i-- )); do + opts[i]=( + ${exclude[$opts[i]]}${opts[i]}${full[$opts[i]]} + ${short[$opts[i]]:+${exclude[$opts[i]]}${short[$opts[i]]}${full[$opts[i]]/(#s)=/+}} + ) + done + (( $#subcmds)) && opts+=( + "${ign}(- *)--list-cmds[list available subcommands]" \ + '1: :->subsubcmds' + '*:: :->args' + ) + (( $#opts )) && opts+=( + "${ign}(- *)--help[display help information]" + "${ign}(- *)--list-opts[list available options]" + ) + _arguments -C $opts $args \ + "${ign}(- *)-h[display brief usage summary]" + ;; + event-types) + _wanted event-types expl 'event type' compadd - hw sw cache pmu tracepoint event_glob + ;& + events) + _wanted events expl event compadd - \ + ${${=${${(f)"$(_call_program events perf list hw sw cache pmu tracepoint event_glob)"}[2,-5]# }%% [ \[]*}:#OR} + ;; + itrace-opts) + _values -s '' "itrace option [ibxwpe]" \ + 'i[synthesize instructions events]' \ + 'b[synthesize branches events (branch misses for Arm SPE)]' \ + 'c[synthesize branches events (calls only)]' \ + 'r[synthesize branches events (returns only)]' \ + 'x[synthesize transactions events]' \ + 'w[synthesize ptwrite events]' \ + 'p[synthesize power events (incl. PSB events for Intel PT)]' \ + 'o[synthesize other events recorded due to the use of aux-output]' \ + 'e[synthesize error events]' \ + 'd[create a debug log]' \ + 'f[synthesize first level cache events]' \ + 'm[synthesize last level cache events]' \ + 'M[synthesize memory events]' \ + 't[synthesize TLB events]' \ + 'a[synthesize remote access events]' \ + 'g[synthesize a call chain (use with i or x)]' \ + 'G[synthesize a call chain on existing event records]' \ + 'l[synthesize last branch entries (use with i or x)]' \ + 'L[synthesize last branch entries on existing event records]' \ + 's[skip initial number of events]' \ + 'q[quicker (less detailed) decoding]' \ + 'Z[prefer to ignore timestamps (so-called "timeless" decoding)]' + ;; + fields) + _sequence _wanted fields expl 'field' compadd - -a fields + ;; + sort-keys) + _sequence _wanted sort-keys expl 'sort key' compadd - -a sortkeys + ;; + esac +done + +[[ nm -ne compstate[nmatches] ]] diff --git a/Completion/Linux/Command/_pidof b/Completion/Linux/Command/_pidof index 05fb23d45..dd0649ce9 100644 --- a/Completion/Linux/Command/_pidof +++ b/Completion/Linux/Command/_pidof @@ -9,6 +9,8 @@ _arguments -C -s -w \ '(- *)'{-V,--version}'[print program version]' \ "(-s --single-shot $exargs)"{-s,--single-shot}'[return one PID only]' \ "(-c --check-root $exargs)"{-c,--check-root}'[omit processes with different root]' \ + '-q[quiet mode, only set the exit code]' \ + '(-w --with-workers)'{-w,--with-workers}'[show kernel workers too]' \ "(-x $exargs)"-x'[include shells running named scripts]' \ "($exargs)"\*{-o+,--omit-pid=}'[omit processes with PIDs]:pids:_sequence -s , _pids' \ '(-S --separator)'{-S+,--separator=}'[specify separator put between PIDs]:separator' \ diff --git a/Completion/Linux/Command/_setpriv b/Completion/Linux/Command/_setpriv new file mode 100644 index 000000000..196f2f627 --- /dev/null +++ b/Completion/Linux/Command/_setpriv @@ -0,0 +1,107 @@ +#compdef setpriv + +__setpriv_prctl_securebits_set_elements() { + local -a expl + local -a bits + + bits=( + noroot noroot_locked + no_setuid_fixup no_setuid_fixup_locked + keep_caps_locked + ) + + if ! compset -P '[+-]'; then + _description minus-or-plus expl "-/+" + compadd "${(@)expl}" -qS '' {+,-} + return + fi + + _description minus-plus-securebits expl "prctl securebit" + compadd "${(@)expl}" "$@" -a - bits +} + +__setpriv_numbered_caps() { + # The cap_ prefix. + # We override the suffix from _sequence with -S '' to stay adjacent + # to the following number. + if ! compset -P cap_; then + compadd -S '' "$@" -n - cap_ + return + fi + # A capability number; i.e. a non-negative integer. + # We can't complete integers, so no matches. + if ! compset -P '[0-9]##'; then + local -a expl + _description -x numbers expl "capability number" + compadd -S '' "${(@)expl}" -n - + return + fi + # The numbered cap expression is complete. + compadd "$@" -n - '' +} + +__setpriv_cap_set_elements() { + # '-' or '+', followed by one of the following: + # - a capability name + # - the word 'all' + # - 'cap_[0-9]+' (to specify unknown capabilities). + if ! compset -P '[+-]'; then + local -a expl + _description minus-or-plus expl "-/+" + compadd "${(@)expl}" -qS '' + - + return + fi + + # We pass through compadd options generated by _sequence. + local -a sequence_argv=( "$@" ) + + _alternative -O sequence_argv \ + 'special-words:drop/obtain all caps:(all)' \ + 'capabilities: :_capabilities' \ + 'numbered-capabilities:cap_N:__setpriv_numbered_caps' \ + # +} + +__setpriv_death_signals() { + _alternative \ + 'special-words:keep or clear:(keep clear)' \ + 'signals:UNIX signal:_signals' \ + # +} + +local curcontext="$curcontext" state state_descr line +typeset -A opt_args + +_arguments -C -S -s \ + '(- : *)'{-h,--help}'[print help and exit]' \ + '(- : *)'{-V,--version}'[print version information and exit]' \ + '(- : *)'{-d,--dump}'[display the current privilege state]:*: :->option-dump' \ + '(--groups --init-groups --keep-groups)--clear-groups[clear supplementary groups]' \ + '(--clear-groups --init-groups --keep-groups)--groups[set supplementary groups]: : _sequence _groups' \ + '(--clear-groups --groups --init-groups)--keep-groups[preserve supplementary groups]' \ + '(--clear-groups --groups --keep-groups)--init-groups[initialize supplementary groups]' \ + '--inh-caps[set inheritable caps]: : _sequence __setpriv_cap_set_elements' \ + '--ambient-caps[set ambient caps]: : _sequence __setpriv_cap_set_elements' \ + '--bounding-set[set the cap bounding set]: : _sequence __setpriv_cap_set_elements' \ + '(- : *)--list-caps[list all known capabilities]' \ + '--no-new-privs[set NO_NEW_PRIVS]' \ + '--rgid[set real UNIX group id]:UNIX group:_groups' \ + '--egid[set effective UNIX group id]:UNIX group:_groups' \ + '--regid[set real and effective UNIX group id]:UNIX group:_groups' \ + '--ruid[set real UNIX user id]:UNIX user:_users' \ + '--euid[set effective UNIX user id]:UNIX user:_users' \ + '--reuid[set real and effective UNIX user id]:UNIX user:_users' \ + '--securebits[set "process securebits"]: : _sequence __setpriv_prctl_securebits_set_elements' \ + '--pdeathsig[keep, clear, or set parent death signal]: : __setpriv_death_signals' \ + '--selinux-label[request a selinux label]:SELinux labels: ' \ + '--apparmor-profile[request an apparmor profile]:AppArmor profiles: ' \ + '--reset-env[set environment as for a classic login shell]' \ + '*:::command:_normal' \ + && return 0 + +case $state in + option-dump) + _arguments -S '*'{-d,--dump}'[display the current privilege state]' + ;; + *) ;; +esac diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs index 3363ecdc0..3467fbd8a 100644 --- a/Completion/Linux/Command/_sshfs +++ b/Completion/Linux/Command/_sshfs @@ -19,8 +19,14 @@ _arguments -C -S : \ ':mountpoint:_files -/' && ret=0 if [[ $state == options ]]; then - _values -s , "sshfs or fuse or mount options" \ + # TODO complete ssh(1) options + _values -s , "options to ssh, sshfs, mount, or FUSE" \ + 'port:number' \ + 'compression: :(yes no)' \ reconnect delay_connect sshfs_sync no_readahead sync_readdir \ + sshfs_debug \ + 'cache: :(yes no)' \ + 'cache_timeout:timeout (seconds)' \ 'dir_cache:cache setting:(yes no)' \ 'dcache_max_size:size [10000]' \ 'dcache_timeout:timeout (seconds) [20]' \ @@ -37,12 +43,13 @@ if [[ $state == options ]]; then sftp_server:path:_files \ directport:port:_ports \ slave disable_hardlink transform_symlinks follow_symlinks no_check_root password_stdin \ + debug \ allow_other allow_root auto_unmount nonempty default_permissions \ fsname:filesystem\ name \ subtype:filesystem\ type \ large_read \ max_read:max\ size \ - hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache \ + hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache noauto_cache \ 'umask:permissions' \ 'uid:owner' 'gid:group' \ 'entry_timeout:timeout (seconds) [1]' \ @@ -60,7 +67,7 @@ if [[ $state == options ]]; then congestion_threshold:threshold \ async_read sync_read atomic_o_trunc big_writes no_remote_lock no_remote_flock \ no_remote_posix_lock splice_write splice_move splice_read \ - from_code:charset to_code:charset subdir:_directories rellinks && ret=0 + from_code:charset to_code:charset subdir:_directories rellinks norellinks && ret=0 fi return ret diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index 7d4595a33..b3b6f5096 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -1,50 +1,66 @@ #compdef strace strace64 -local curcontext="$curcontext" state line root expl ret=1 +local curcontext="$curcontext" root +local -i prec=1 form=1 ret=1 +local -a state line expl alts suf typeset -A opt_args -(( EUID )) && root='!' +(( EUID && ! $+_comp_priv_prefix )) && root='!' _arguments -C -s \ - '-a+[align return values in a specific column]:column number [40]' \ - '(-c)-i[print instruction pointer at time of syscall]' \ - '-o+[write the trace output to the file]:output file:->file-pipe' \ - '-q[suppress messages about attaching, detaching etc.]' \ - '(-q)-qq[suppress messages about process exit status]' \ - '(-c)-r[print a relative timestamp upon entry to each system call]' \ - '-s+[specify the maximum string size to print]:maximum string size [32]' \ - '(-c -ttt)-t[prefix each line of the trace with the time of day]' \ - '(-c -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ - '(-c -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ - '(-c)-T[show the time spent in system calls]' \ - '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \ - '(-x)-xx[print all strings in hexadecimal string format]' \ - '-X+[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \ - '(-c -yy)-y[print paths associated with file descriptor arguments]' \ - '(-c -y)-yy[print protocol specific information associated with socket file descriptors]' \ - '(-C -i -k -r -ff -t -tt -ttt -T -y -yy)-c[count time, calls, and errors for each system call and report a summary]' \ - '(-c)-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ - '-O+[overhead for tracing system calls]:overhead (microseconds)' \ - '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort criterion [time]:(time calls errors name nothing)' \ - '-w[summarise syscall latency]' \ - '*-e+[select events to trace or how to trace]:system call:->expressions' \ - '*-P+[trace only system calls accessing given path]:path:_files' \ - '(-Z)-z[trace only system calls that return success]' \ - '(-z)-Z[trace only system calls that return an error]' \ - '-b+[detach from process on specified syscall]:syscall:(execve)' \ - '-f[trace child processes as they are created by currently traced processes]' \ - '(-c -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \ - '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ - '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default with -o)" 4\:"fatal signals and SIGTSTP are always blocked"))' \ - '*-E+[set or remove exported environment variable]:variable:->envars' \ - "${root}-u+[run as specified user]:user:_users" \ - '(:)*-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ + \*{-E+,--env=}'[set or remove exported environment variable]:variable:->envars' \ + '(:)*'{-p+,--attach=}'[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ + "${root}(-u --user)"{-u+,--user=}'[run as specified user]:user:_users' \ + '(-b --detach-on)'{-b+,--detach-on=}'[detach from process on specified syscall]:syscall:(execve)' \ + '(--daemonize)-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ + '(-D)--daemonize=-[specify how to run tracer process]::method:(grandchild pgroup session)' \ + '(-f --follow-forks)'{-f,--follow-forks}'[trace child processes as they are created by currently traced processes]' \ + '(-I --interruptible)'{-I+,--interruptible=}'[specify when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default with -o)" 4\:"fatal signals and SIGTSTP are always blocked"))' \ + \*{-e+,--trace=}'[select events to trace or how to trace]:system call:->expressions' \ + \*{-P+,--path=}'[trace only system calls accessing given path]:path:_files' \ + '(-z -Z --successful-only --failed-only)'{-z,--successful-only}'[trace only system calls that return success]' \ + '(-z -Z --successful-only --failed-only)'{-Z,--failed-only}'[trace only system calls that return an error]' \ + '(-a --columns)'{-a+,--columns=}'[align return values in a specific column]:column number [40]' \ + '(-i --instruction-pointer -c --summary-only)'{-i,--instruction-pointer}'[print instruction pointer at time of syscall]' \ + '(-c --summary-only -k --stack-traces)'{-k,--stack-traces}'[obtain stack trace between each syscall]' \ + '(-n --syscall-number)'{-n,--syscall-number}'[print syscall number]' \ + '(-o --output)'{-o+,--output=}'[send trace output to the specified file]:output file:->file-pipe' \ + '(-A --output-append-mode)'{-A,--output-append-mode}'[open the file provided with the -o option in append mode]' \ + '--output-separately[output to separate files for child processes (by appending pid to file names)]' \ + '(--quiet)-q[suppress messages about attaching, detaching etc]' \ + '(-q --quiet)-qq[suppress messages about process exit status]' \ + '(-q -qq --quiet)-qqq[suppress all suppressible messages]' \ + '(-q -qq -qqq)--quiet=[suppress messages about attaching, detaching etc]:suppression:_sequence compadd - attach personality exit all' \ + '(--relative-timestamps -c --summary-only)-r[print a relative timestamp upon entry to each system call]' \ + '(-r -c --summary-only)--relative-timestamps=-[print a relative timestamp upon entry to each system call]:precision [us]:compadd -o nosort s ms us ns' \ + '(--absolute-timestamps)-t[prefix each line of the trace with the wall clock time]' \ + '(-t)--absolute-timestamps=-[prefix each line of the trace with the wall clock time]:: :->time-formats' \ + '!(-t --absolute-timestamps)--timestamps=-:: :->time-formats' \ + '(-s --string-limit)'{-s+,--string-limit=}'[specify the maximum string size to print]:maximum string size [32]' \ + '(-c --summary-only -ttt)-t[prefix each line of the trace with the time of day]' \ + '(-c --summary-only -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ + '(-c --summary-only -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ + '(--syscall-times -c --summary-only)-T[show the time spent in system calls]' \ + '(-T -c --summary-only)--syscall-times=-[show the time spent in system calls]::precision [us]:compadd -o nosort s ms us ns' \ + '(-v --no-abbrev)'{-v,--no-abbrev}'[print unabbreviated versions of environment, stat, termios, etc. calls]' \ + '(-xx --strings-in-hex)-x[print all non-ASCII strings in hexadecimal string format]' \ + '(-x --strings-in-hex)-xx[print all strings in hexadecimal string format]' \ + '(-x -xx)--strings-in-hex=[specify strings to print in hexadecimal format]:string type:(all non-ascii)' \ + '(-X --const-print-style)'{-X+,--const-print-style=}'[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \ + '(-c --summary-only -yy --decode-fds)-y[print paths associated with file descriptor arguments]' \ + '(-c --summary-only -y --decode-fds)-yy[print protocol specific information associated with socket file descriptors]' \ + '(-c --summary-only -y -yy)--decode-fds=-[print information associated with file descriptors]::information [none]:_sequence compadd - none all path socket dev pidfd' \ + '(-c --summary-only -C --summary -i --instruction-pointer -k --stack-traces -r --relative-timestamps -ff -t -tt -ttt --absolute-timestamps -T --syscall-times -y -yy --decode-fds)'{-c,--summary-only}'[count time, calls, and errors for each system call and report a summary]' \ + '(-c --summary-only -C --summary)'{-C,--summary}'[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ + '(-O --summary-syscall-overhead)'{-O+,--summary-syscall-overhead=}'[specify overhead for tracing system calls]:overhead (microseconds)' \ + '(-S --summary-sort-by)'{-S+,--summary-sort-by=}'[sort the output of the histogram (-c option) by the specified criterion]:sort criterion [time]:(time min-time max-time avg-time calls errors name nothing)' \ + '(-U --summary-columns)'{-U+,--summary-columns=}'[show specific columns in the summary report]:column:_sequence compadd - time-percent total-time min-time max-time avg-time calls errors name' \ + '(-w --summary-wall-clock)'{-w,--summary-wall-clock}'[summarise syscall latency]' \ + '(-c --summary-only -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \ + '(-d --debug)'{-d,--debug}'[show debug output of strace itself on standard error]' \ + '(- 1 *)'{-h,--help}'[display help information]' \ '--seccomp-bpf[enable seccomp-bpf filtering]' \ - '-d[show debug output of strace itself on standard error]' \ - '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \ - '(- 1 *)-h[display help information]' \ - '(- 1 *)-V[display version information]' \ - '(-c)-k[obtain stack trace between each syscall]' \ + '(- 1 *)'{-V,--version}'[display version information]' \ '(-):command name: _command_names -e' \ '*::arguments:_normal' && ret=0 @@ -61,7 +77,9 @@ case $state in 'fault[perform syscall fault injection]:system call:_sys_calls -a -n' \ 'inject[perform syscall tampering]:system call:_sys_calls -a -n' \ 'status[trace system calls with given return status]:status:->status' \ - 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' && ret=0 + 'quiet[suppress various information messages]:message [none]:_sequence compadd - none attach exit path-resolution personality thread-execve superseded' \ + 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' \ + 'decode-fds[print information associated with file descriptors]:information [none]:_sequence compadd - none all path socket dev pidfd' && ret=0 if [[ $state = status ]]; then _values -s , 'return status [all]' \ all successful failed \ @@ -69,15 +87,17 @@ case $state in 'unavailable[system calls that return but strace fails to fetch the error]' \ 'detached[system calls where strace detaches before the return]' && ret=0 elif [[ $words[CURRENT] != *=* || $state = syscalls ]]; then - local dedup sets suf="-qS," + local dedup sets compset -P '!' dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} ) - compset -S ',*' || suf="" + compset -S ',*' || suf=( "-qS," ) compset -P '*,' if compset -P /; then _wanted syscalls expl "system call (regex)" _sys_calls -a -n $suf -F dedup && ret=0 else sets=( + '%clock:trace system calls that read or modify system clocks' + '%creds:trace system calls that read or modify user and group identifiers or capability sets' {%,}'file:trace all system calls which take a file name as an argument' {%,}'process:trace all system calls which involve process management' {%net,{%,}network}':trace all the network related system calls' @@ -122,6 +142,22 @@ case $state in _parameters -qS= -g "*export*" && ret=0 fi ;; + time-formats) + alts=() + compset -P '(precision:*|s|ms|us|ns),' && prec=0 + compset -P '(format:*|none|time|unix),' && form=0 + compset -S ',*' || (( !prec + !form )) || suf=( -S , ) + if compset -P 'precision:'; then + form=0 + elif compset -P 'format:'; then + prec=0 + else + alts=( 'prefixes:prefix:compadd -S ":" ${${(s. .):-format x}[form]} ${${(s. .):-precision x}[prec]}' ) + fi + (( prec )) && alts+=( 'precisions:precision [s]:compadd -o nosort $suf s ms us ns' ) + (( form )) && alts+=( 'formats:format [time]:compadd $suf none time unix' ) + _alternative $alts && ret=0 + ;; esac return ret diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index e091dd3ea..5620da73d 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -11,6 +11,7 @@ _mpstat() { '--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)' \ '-o[display statistics in JSON]:format:(JSON)' \ '(-A)-P[specify processor number]:processor: _values -s "," processor ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ + '-T[display topology elements in the CPU report]' \ '-u[report CPU utilization]' \ '(- 1 2)-V[display version information]' \ '1: : _guard "^-*" interval' \ @@ -26,6 +27,7 @@ _cifsiostat() { '-t[print timestamp for each report]' \ '(- 1 2)-V[print version number]' \ '--human[print sizes in human readable format]' \ + '--pretty[make the CIFS report easier to read by a human]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } @@ -49,8 +51,8 @@ _sadf() { '-H[display only the header of the report]' \ '(-g -j -p -r -x)-h[print on a single line when used with -d]' \ '-O[specify output options]: : _values -s , option - autoscale height\:value oneday packed showidle showinfo skipempty showhints' \ - '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \ + autoscale bwcol customcol height\:value oneday packed showidle showinfo showtoc skipempty hz\:value pcparchive\:name\:_files debug' \ + '-P[restrict processor dependent statistics]:processor number(zero indexed) or ALL:(ALL)' \ '--dev=-[specify block devices for which statistics are to be displayed]:block device:_files -g "*(-%)"' \ '--fs=-[specify filesystems for which statistics are to be displayed]:file system:_dir_list -s ,' \ '--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \ @@ -66,6 +68,7 @@ _sadf() { '-d[output file in SQL format]' \ '-g[print data in SVG format]' \ '-j[output file in JSON]' \ + '-l[export the contents of the data file to a PCP (Performance Co-Pilot) archive]' \ '-p[print in format parsable by tools like awk]' \ '-r[print raw contents of data file]' \ '-x[output file in XML]' \ @@ -96,16 +99,16 @@ _sar() { '(--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[report statistics for interrupts]: : _values -s "," interrupt 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' \ '--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \ '-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 FC SOFT ALL' \ + '-m[report power management statistics]:keyword:_sequence compadd - CPU FAN FREQ IN TEMP USB ALL' \ + '-n[report network statistics]:keyword:_sequence compadd - 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]' \ + '-q[report queue length and load averages]::keyword:(CPU IO LOAD MEM PSI ALL)' \ '-R[report memory statistics]' \ '-r[report memory utilization statistics]:: :(ALL)' \ '-S[report swap space utilization]' \ diff --git a/Completion/Linux/Command/_tpb b/Completion/Linux/Command/_tpb index c4c4c2bbd..2bdee0942 100644 --- a/Completion/Linux/Command/_tpb +++ b/Completion/Linux/Command/_tpb @@ -9,7 +9,7 @@ _arguments \ '(-x --xevents)'{-x,--xevents=}':state:(on off)' \ '(-m --mixer)'{-m,--mixer=}':state:(on off)' \ '(-o --osd)'{-o,--osd=}':state:(on off)' \ - '(-p --poll)'{-p,--poll=}':delay in microseconds:' \ + '(-p --poll)'{-p,--poll=}':delay (microseconds)' \ '(-t --thinkpad)'{-t,--thinkpad=}':command to execute:_command_names' \ '(-H --home)'{-H,--home=}':command to execute:_command_names' \ '(-S --search)'{-S,--search=}':command to execute:_command_names' \ diff --git a/Completion/Linux/Command/_unshare b/Completion/Linux/Command/_unshare new file mode 100644 index 000000000..ff6f7042f --- /dev/null +++ b/Completion/Linux/Command/_unshare @@ -0,0 +1,40 @@ +#compdef unshare + +local ign +(( $#words > 2 )) && ign='!' + +# a different unshare exists on some systems +if [[ $OSTYPE != linux* ]]; then + _default + return +fi + +_arguments -S -s \ + '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \ + '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \ + '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \ + '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \ + '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \ + '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \ + '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \ + '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \ + '(-f --fork)'{-f,--fork}"[fork before launching]" \ + '(-r --map-root-user)--map-user=[map current user to uid (implies --user)]:user:_users' \ + '--map-group=[map current group to gid (implies --user)]:group:_groups' \ + '(-r --map-root-user -c --map-current-user --map-user)'{-r,--map-root-user}'[map current user to root (implies --user)]' \ + '(-c --map-current-user)'{-c,--map-current-user}'[map current user to itself (implies --user)]' \ + '(-f --fork)--kill-child=-[when dying, kill the forked child (implies --fork)]::signal [KILL]:_signals' \ + '--mount-proc=-[mount proc filesystem first (implies --mount)]::mount point [/proc]:_directories' \ + '--propagation=[modify mount propagation in mount namespace]:propagation flag:(slave shared private unchanged)' \ + '--setgroups=[control the setgroups syscall in user namespaces]:grant setgroups:(allow deny)' \ + '--keep-caps[retain capabilities granted in user namespaces]' \ + '(-R --root)'{-R+,--root=}'[set the root directory]:directory:_directories' \ + '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \ + '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \ + '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \ + '--monotonic=[set clock monotonic offset in time namespaces]:offset (seconds)' \ + '--boottime=[set clock boottime offset in time namespaces]:offset (seconds)' \ + "${ign}(- 1 *)"{-h,--help}'[display usage information]' \ + "${ign}(- 1 *)"{-V,--version}'[display version information]' \ + '1: : _command_names -e' \ + '*::args :_normal' diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind index 4a710e7f7..b4bb3248e 100644 --- a/Completion/Linux/Command/_valgrind +++ b/Completion/Linux/Command/_valgrind @@ -20,7 +20,7 @@ common_own_malloc=( '--alignment=-[set minimum alignment of heap allocations]:number [16]' '--redzone-size=-[set minimum size of redzones added before/after heap blocks]:size (bytes) [16]' '--xtree-memory=-[profile heap memory in an xtree [none]:(none allocs full)' - '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%p]:_files' + '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%%p]:_files' ) common_read_varinfo=( @@ -67,7 +67,7 @@ args_addrcheck=( '(--show-leak-kinds)--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)' '(--show-leak-kinds)--show-possibly-lost=-:enable:(yes no)' '--xtree-leak=-[output leak result in xtree format]:enable [no]:(yes no)' - '--xtree-leak-file=-[specify xtree leak report file]:file [xtleak.kcg.%p]:_files' + '--xtree-leak-file=-[specify xtree leak report file]:file [xtleak.kcg.%%p]:_files' '--undef-value-errors=-[check for undefined value errors]:enable [yes]:(yes no)' '--track-origins=-[show origins of undefined values]:enable [no]:(yes no)' $common_partial @@ -123,7 +123,7 @@ args_cachegrind=( '--LL=-[set LL cache manually]:size,assoc,line_size' '--cache-sim=-[collect cache stats]:enable [yes]:(yes no)' '--branch-sim=-[collect branch prediction stats]:enable [no]:(yes no)' - '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%p]:_files' + '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%%p]:_files' ) args_helgrind=( @@ -169,7 +169,7 @@ args_massif=( ))" '--detailed-freq=-[every Nth snapshot should be detailed]:snapshot interval [10]' '--max-snapshots=-[specofy maximum number of snapshots recorded]:maximum [100]' - '--massif-out-file=-[specify output file name]:filename [massif.out.%p]:_files' + '--massif-out-file=-[specify output file name]:filename [massif.out.%%p]:_files' ) args_exp_bbv=( @@ -205,6 +205,7 @@ _arguments -C ${(P)args} $cmd \ '(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \ '(-h --help)'{-h,--help}'[show help information]' \ '--help-debug[show help info including debugging options]' \ + '--help-dyn-options[show the dynamically changeable options]' \ '(-)--version[show version]' \ '(-q --quiet)'{-q,--quiet}'[run silently; only print error msgs]' \ '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ diff --git a/Completion/Linux/Command/_wipefs b/Completion/Linux/Command/_wipefs index 5142def8a..8642aab92 100644 --- a/Completion/Linux/Command/_wipefs +++ b/Completion/Linux/Command/_wipefs @@ -19,6 +19,7 @@ _arguments -s -S \ '(H -p --parsable -i --no-headings -J --json)'{-p,--parsable}'[print out in parsable instead of printable format]' \ '(H -q --quiet)'{-q,--quiet}'[suppress output messages]' \ '(H -t --types)'{-t+,--types=}'[limit the set of filesystem, RAIDs or partition tables]:type:_file_systems' \ + '(H)--lock=-[use exclusive device lock]::mode:(yes no nonblock)' \ '(H)*:disk device:_files -g "*(-%)" -P / -W /' \ + '(H)' \ '(- *)'{-h,--help}'[display help information]' \ diff --git a/Completion/Linux/Type/_capabilities b/Completion/Linux/Type/_capabilities new file mode 100644 index 000000000..8cb31878f --- /dev/null +++ b/Completion/Linux/Type/_capabilities @@ -0,0 +1,65 @@ +#autoload + +# This function completes POSIX capabilities for Linux. +# Many command line utilities expect different syntax to encode various kinds +# of capability names or sets, so this function tries to be as generic as +# possible. It accepts compadd options to allow variations on the exact +# generated completion matches. +# +# Usage examples: +# +# Complete full capability names: +# _capabilities -p cap_ +# Sort the completion list by capability number: +# _capabilities -o nosort + +# The list of Linux capabilities is taken from include/uapi/linux/capability.h +# and subject to the following pipe filter: +# grep 'define CAP' | sed -r 's/^[[:space:]]*#define[[:space:]]+CAP_//; s/[[:space:]]+[0-9]+$//' | tr '[[:upper:]]' '[[:lower:]]' +local -a caplist=( + chown + dac_override + dac_read_search + fowner + fsetid + kill + setgid + setuid + setpcap + linux_immutable + net_bind_service + net_broadcast + net_admin + net_raw + ipc_lock + ipc_owner + sys_module + sys_rawio + sys_chroot + sys_ptrace + sys_pacct + sys_admin + sys_boot + sys_nice + sys_resource + sys_time + sys_tty_config + mknod + lease + audit_write + audit_control + setfcap + mac_override + mac_admin + syslog + wake_alarm + block_suspend + audit_read + perfmon + bpf + checkpoint_restore +) +local -a expl + +_description capabilities expl "Linux capability" +compadd "${(@)expl}" "$@" -a - caplist diff --git a/Completion/Linux/Type/_fuse_values b/Completion/Linux/Type/_fuse_values index be830cb40..211eb5b35 100644 --- a/Completion/Linux/Type/_fuse_values +++ b/Completion/Linux/Type/_fuse_values @@ -47,7 +47,7 @@ fvals=( [[ -n $cvalsvar ]] && set -- "$@" ${(P)cvalsvar} if [[ $# -eq 0 ]]; then - set -- 'mount options' $fvals + set -- 'mount option' $fvals else set -- "$@" $fvals fi |