diff options
Diffstat (limited to 'Completion/Linux/Command')
26 files changed, 855 insertions, 185 deletions
diff --git a/Completion/Linux/Command/_acpi b/Completion/Linux/Command/_acpi index 850687506..5ebf1447c 100644 --- a/Completion/Linux/Command/_acpi +++ b/Completion/Linux/Command/_acpi @@ -14,5 +14,5 @@ _arguments -s \ '(-c --celsius -f --fahrenheit -k --kelvin)'{-f,--fahrenheit}'[use Fahrenheit as the temperature scale]' \ '(-c --celsius -f --fahrenheit -k --kelvin)'{-k,--kelvin}'[use Kelvin as the temperature scale]' \ '(-d --directory)'{-d,--directory}'[path to ACPI info (/proc/acpi)]:directory:_files -/' \ - '(-h --help)'{-h,--help}'[display this help and exit]' \ + '(-h --help)'{-h,--help}'[display help and exit]' \ '(-v --version)'{-v,--version}'[output version information and exit]' diff --git a/Completion/Linux/Command/_blkid b/Completion/Linux/Command/_blkid index e31250d37..29392c4e5 100644 --- a/Completion/Linux/Command/_blkid +++ b/Completion/Linux/Command/_blkid @@ -19,10 +19,10 @@ _arguments \ '(-l --list-one)'{-l,--list-one}'[look up only first device with token specified by -t]' \ '(-n --match-types)'{-n+,--match-types=}'[filter by filesystem type]: :_sequence _file_systems' \ '(-O --offset)'{-O+,--offset=}'[probe at the given offset]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" offset {K,M,G,T,P,E,Z,Y}{,B,iB}' \ - '(-o --output)'{-o+,--output=}'[specify output format]:format [full]:(full value list device udev export)' \ + '(-o --output)'{-o+,--output=}'[specify output format]:format [full]:(full value list device udev export json)' \ '(-p --probe)'{-p,--probe}'[probe low-level superblocks]' \ \*{-s+,--match-tag=}'[show specified tag(s)]:tag:(none LABEL UUID UUID_SUB TYPE PARTLABEL PARTUUID SEC_TYPE PTUUID PTTYPE ALIGNMENT_OFFSET MINIMUM_IO_SIZE OPTIMAL_IO_SIZE PHYSICAL_SECTOR_SIZE LOGICAL_SECTOR_SIZE)' \ - '(-S --size)'{-S+,--size=}'[overwrite device size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" size {K,M,G,T,P,E,Z,Y}{,B,iB}' \ + '(-S --size)'{-S+,--size=}'[override device size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" size {K,M,G,T,P,E,Z,Y}{,B,iB}' \ '(-t --match-token)'{-t+,--match-token=}'[find device with a specific token]:token' \ '(-u --usages)'{-u+,--usages=}'[filter by usage]:usage:_sequence compadd - {no,}{filesystem,raid,crypto,other}' \ '*:device:_files -g "*(-%)"' diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs index d8b97a200..539416321 100644 --- a/Completion/Linux/Command/_btrfs +++ b/Completion/Linux/Command/_btrfs @@ -155,9 +155,9 @@ while (( $#state )); do '-c-[compress files while defragmenting]::compression algorithm:(zlib lzo zstd)' '-r[defragment files recursively]' '-f[flush after defragmenting]' - '-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' + '-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' ) ;; @@ -213,8 +213,8 @@ while (( $#state )); do '-d[print separate statistics for each device]' '-r[read only mode]' '-R[raw print mode]' - '-c[set ioprio class]:class:(( 0\:none 1\:realtime 2\:best-effort 3\:idle))' - '-n[set ioprio classdata]:classdata:(0 1 2 3 4 5 6 7)' + '-c+[set ioprio class]:class:(( 0\:none 1\:realtime 2\:best-effort 3\:idle))' + '-n+[set ioprio classdata]:classdata:(0 1 2 3 4 5 6 7)' '1:path or device:_files' ) [[ ${${(P)group}[cmd]} == start ]] && args+=( @@ -246,7 +246,7 @@ while (( $#state )); do property:get) args+=( '2:property:(ro label compression)' );& property:list) args+=( - '-t[specify object type]:object type:(subvol filesystem inode device)' + '-t+[specify object type]:object type:(subvol filesystem inode device)' '1: : _guard "^-*" object' ) ;; diff --git a/Completion/Linux/Command/_chrt b/Completion/Linux/Command/_chrt index 5431b0799..3e550bf60 100644 --- a/Completion/Linux/Command/_chrt +++ b/Completion/Linux/Command/_chrt @@ -8,21 +8,22 @@ _arguments -C -s -S -A "-*" \ '(H -a --all-tasks)'{-a,--all-tasks}'[operate on all tasks (threads) for a given pid]' \ '(H)'{-v,--verbose}'[display status information]' \ '(H)'{-p,--pid}'[interpret args as process ID]' \ - '(H -R --reset-on-fork -b --batch -d --deadline -i --idle -o --other)'{-R,--reset-on-fork}'[set SCHED_RESET_ON_FORK for FIFO or RR]' \ + '(H -R --reset-on-fork -b --batch -d --deadline -e --ext -i --idle -o --other)'{-R,--reset-on-fork}'[set SCHED_RESET_ON_FORK for FIFO or RR]' \ + '(H -T --sched-runtime -f --fifo -e --ext -i --idle -r --rr)'{-T,--sched-runtime}'[runtime parameter for DEADLINE]' \ '(H)*::command or priority:->cmd_or_prio' \ + 'H' \ '(* -)'{-m,--max}'[show minimum and maximum valid priorities, then exit]' \ '(* -)'{-h,--help}'[display usage information]' \ '(* -)'{-V,--version}'[output version information]' \ + 'dline' \ - '(H -T --sched-runtime -b --batch -f --fifo -i --idle -o --other -r --rr)'{-T,--sched-runtime}'[runtime parameter for DEADLINE]' \ - '(H -P --sched-period -b --batch -f --fifo -i --idle -o --other -r --rr)'{-P,--sched-period}'[period parameter for DEADLINE]' \ - '(H -D --sched-deadline -b --batch -f --fifo -i --idle -o --other -r --rr)'{-D,--sched-deadline}'[deadline parameter for DEADLINE]' \ + '(H -P --sched-period -b --batch -f --fifo -e --ext -i --idle -o --other -r --rr)'{-P,--sched-period}'[period parameter for DEADLINE]' \ + '(H -D --sched-deadline -b --batch -f --fifo -e --ext -i --idle -o --other -r --rr)'{-D,--sched-deadline}'[deadline parameter for DEADLINE]' \ + '(policy)' \ '(H dline -R --reset-on-fork)'{-b,--batch}'[set scheduling policy to SCHED_BATCH]' \ '(H -R --reset-on-fork)'{-d,--deadline}'[set scheduling policy to SCHED_DEADLINE]' \ - '(H dline)'{-f,--fifo}'[set scheduling policy to SCHED_FIFO]' \ - '(H dline -R --reset-on-fork)'{-i,--idle}'[set scheduling policy to SCHED_IDLE]' \ + '(H dline -T --sched-runtime)'{-e,--ext}'[set scheduling policy to SCHED_EXT (BPF program-defined scheduling)]' \ + '(H dline -T --sched-runtime)'{-f,--fifo}'[set scheduling policy to SCHED_FIFO]' \ + '(H dline -R --reset-on-fork -T --sched-runtime)'{-i,--idle}'[set scheduling policy to SCHED_IDLE]' \ '(H dline -R --reset-on-fork)'{-o,--other}'[set scheduling policy to SCHED_OTHER]' \ '(H dline)'{-r,--rr}'[set scheduling policy to SCHED_RR (default)]' && ret=0 diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index 897eb94f9..2654ca844 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -45,6 +45,7 @@ _arguments -s \ '--dump-volume-key[dump volume key instead of keyslots info]' \ '--external-tokens-path=[specify path to directory with external token handlers (plugins)]:path:_directories' \ '--force-offline-reencrypt[force offline LUKS2 reencryption and bypass active device detection]' \ + '--force-no-keyslots[force dangerous reencryption operation erasing all remaining keyslots]' \ '--header=[device or file with separated LUKS header]:file:_files' \ '--hw-opal[use HW OPAL encryption together with SW encryption]' \ '--hw-opal-factory-reset[wipe WHOLE OPAL disk on luksErase]' \ @@ -52,8 +53,12 @@ _arguments -s \ '--keep-key[do not change volume key]' \ '--link-vk-to-keyring=[set keyring where to link volume key]:string' \ '--new-keyfile=[read the key for a new slot from a file]:file:_files' \ + '--new-key-description=[specify keyring new key description]:description' \ + '--new-key-size=[specify size of the new encryption key]:size (bits)' \ '--new-key-slot=[specify slot number for new key]:slot [first free]' \ '--new-token-id=[token number]:number [any]' \ + '--new-volume-key-file=[use new volume key from file]: :_files' \ + '--new-volume-key-keyring=[use specified keyring key as new volume key]:key' \ '--progress-json[print progress data in json format]' \ "--test-args[don't run action, just validate all command line parameters]" \ '--volume-key-file=[use the volume key from file]:file:_files' \ @@ -76,6 +81,7 @@ _arguments -s \ '--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-high_priority[set dm-crypt workqueues and writer thread to high priority]' \ '--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]' \ @@ -88,12 +94,14 @@ _arguments -s \ '--disable-locks[disable locking of on-disk metadata]' \ '--disable-keyring[disable loading volume keys via kernel keyring]' \ '(-I --integrity)'{-I+,--integrity=}'[specify data integrity algorithm (LUKS2 only)]:algorithm' \ + '--integrity-inline[use inline mode (use HW integrity field)]' \ + '--integrity-key-size=[specify size of the data integrity key]:size (bits)' \ '--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' \ + '--key-description=[specify keyring 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]' \ diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index 8cff24e96..f1f67a357 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -6,14 +6,24 @@ local -A opt_args _arguments -C -A "-*" \ '--debug[turn on debugging messages]:mask:((1\:parser\ information))' \ - '--json[output results in JSON]' \ + '(-j --json)'{-j,--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' \ + '(cmds cmdp)'{-Q,--per-queue}'[apply per-queue command]: :(queue_mask):queue mask' \ + '(cmds cmdc)--phy=[target a PHY within the interface]:phy' \ "1:interface:_net_interfaces" \ '*:: :->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]' \ + '(cmdp cmds)'{-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \ + '(cmdp cmds)'{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \ + + '(cmdp)' \ + '(cmds cmdc)--cable-test[perform cable test and report the results]' \ + '(cmds cmdc)--cable-test-tdr[perform cable test and report Time Domain Reflectometer data]' \ + '(cmds cmdc)--get-plca-cfg[get PLCA configuration]' \ + '(cmds cmdc)--set-plca-cfg[set PLCA configuration]' \ + '(cmds cmdc)--get-plca-status[get PLCA status information]' \ + '(cmds cmdc)--show-pse[show settings for power sourcing equipment]' \ + '(cmds cmdc)--set-pse[set power sourcing equipment settings]' \ + '(cmds cmdc)--show-mse[show Mean Square Error (MSE) diagnostics]' \ + '(cmds)' \ '(1)'{-h,--help}'[display help information]' \ '(1)--version[display version information]' \ @@ -36,6 +46,8 @@ _arguments -C -A "-*" \ {-n,--show-nfc,-u,--show-ntuple}'[retrieve receive network flow classification options or rules]' \ {-N,--config-nfc,-U,--config-ntuple}'[configure receive network flow classification options or rules]' \ {-T,--show-time-stamping}"[show device's time stamping capabilities]" \ + '--get-hwtimestamp-cfg[get selected hardware time stamping]' \ + '--set-hwtimestamp-cfg[select hardware time stamping]' \ {-x,--show-rxfh-indir,--show-rxfh}'[show Rx flow hash indirection table and/or RSS hash key]' \ {-X,--set-rxfh-indir,--rxfh}'[set Rx flow hash indirection table and/or RSS hash key]' \ {-f,--flash}'[flash firmware image from the specified file]' \ @@ -56,24 +68,20 @@ _arguments -C -A "-*" \ '--reset[reset hardware components]' \ '--show-fec[query device for forward error correction support]' \ '--set-fec[configure forward error correction for device]' \ - '--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]' \ '--show-module[show transceiver module settings]' \ '--set-module[set transceiver module settings]' \ - '--get-plca-cfg[get PLCA configuration]' \ - '--set-plca-cfg[set PLCA configuration]' \ - '--get-plca-status[get PLCA status information]' \ '--show-mm[show MAC merge layer state]' \ '--set-mm[set MAC merge layer parameters]' \ - '--show-pse[show settings for power sourcing equipment]' \ - '--set-pse[set power sourcing equipment settings]' \ + '--flash-module-firmware[flash transceiver module firmware]' \ + '--show-phys[list PHYs]' \ '--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 --show-module --set-module + --get-plca-cfg --set-plca-cfg --pse-event )' && return if [[ -n $state ]]; then @@ -97,17 +105,18 @@ if [[ -n $state ]]; then rx-frames-low|tx-usecs-low|tx-frames-low|pkt-rate-high|rx-usecs-high) ;& rx-frames-high|tx-usecs-high|tx-frames-high|sample-interval|dmac) ;& tx-aggr-max-bytes|tx-aggr-max-frame|tx-aggr-time-usec) ;& - rx-mini|rx-jumbo|rx-buf-len|cqe-size|tx-push-buf-len) ;& + rx-mini|rx-jumbo|rx-buf-len|cqe-size|tx-push-buf-len|hds-thresh) ;& offset|length|magic|value|phyad|proto|tos|tclass|l4proto|src-port) ;& dst-port|spi|l4data|vlan-etype|vlan|user-def|action|vf|queue|loc) ;& + index) ;& page|bank|i2c|first|last|step|pair|lanes) ;& rx-copybreak|tx-copybreak|tx-buf-size|pfc-prevention-tout) ;& other|combined|tx-timer|count|msecs) ;& node-id|node-cnt|to-tmr|burst-cnt|burst-tmr) ;& - tx-min-frag-size) + tx-min-frag-size|c33-pse-avail-pw-limit|prio) _message -e numbers 'number' ;; - podl-pse-admin-control) + (podl-pse|c33-pse)-admin-control) _wanted values expl 'value' compadd enable disable ;; speed) @@ -168,6 +177,12 @@ if [[ -n $state ]]; then src|src-ip|dst|dst-ip|dst-mac) _message -e addresses address ;; + qualifier) + _wanted qualifiers expl qualifier compadd precise approx + ;; + rx-filter) + _message -e values value + ;; m) _message -e masks mask ;; @@ -178,7 +193,7 @@ if [[ -n $state ]]; then _message -e functions 'hash function' ;; xfrm) - _wanted transformations expl transformation compadd symmetric-xor none + _wanted transformations expl transformation compadd symmetric-xor symmetric-or-xor none ;; flags) _message -e masks mask @@ -192,6 +207,9 @@ if [[ -n $state ]]; then tcp-data-split) _wanted states expl state compadd auto on off ;; + pass) + _message -e passwords password + ;; *) case ${${(Mk)opt_args:#cmd?*}[1]#cmd?-} in -a|--show-pause) @@ -215,7 +233,8 @@ if [[ -n $state ]]; then 'rx-mini[change number of ring entries for the RX Mini ring]' \ 'rx-jumbo[change number of ring entries for the RX Jumbo ring]' \ 'tx[change number of ring entries for the TX ring]' \ - rx-buf-len tcp-data-split cqe-size tx-push rx-push tx-push-buf-len + rx-buf-len tcp-data-split cqe-size tx-push rx-push tx-push-buf-len \ + hds-thresh ;; -d|--register-dump) _values -S ' ' -w 'option' \ @@ -303,6 +322,12 @@ if [[ -n $state ]]; then queue context loc fi ;; + -T|--show-time-stamping) + _wanted options expl option compadd index qualifier + ;; + --set-hwtimestamp-cfg) + _wanted options expl option compadd index qualifier tx rx-filter + ;; -x|--show-rxfh-indir|--show-rxfh) _wanted options expl option compadd -F line - context ;; @@ -381,6 +406,17 @@ if [[ -n $state ]]; then _wanted options expl tunable compadd enable node-id node-cnt \ to-tmr burst-cnt burst-tmr ;; + --set-mm) + _wanted options expl option compadd verify-enabled verify-time \ + tx-enabled pmac-enabled tx-min-frag-size + ;; + --set-pse) + _wanted options expl option compadd {podl-pse,c33-pse}-admin-control \ + c33-pse-avail-pw-limit prio + ;; + --flash-module-firmware) + _wanted options expl option compadd file pass + ;; esac ;; esac diff --git a/Completion/Linux/Command/_findmnt b/Completion/Linux/Command/_findmnt index 6155d4dc1..b9cb04dc7 100644 --- a/Completion/Linux/Command/_findmnt +++ b/Completion/Linux/Command/_findmnt @@ -19,6 +19,7 @@ _arguments -s -C \ '(H -e --evaluate)'{-e,--evaluate}'[convert LABEL/UUID/PARTLABEL/PARTUUID to the device name]' \ '(H -F --tab-file)*'{-F+,--tab-file=}'[search in the specified tab file]:tab file:_files' \ '(H -f --first-only)'{-f,--first-only}'[print the first matching filesystem only]' \ + '(H)--hyperlink=-[print paths as hyperlinks]::when:(always never auto)' \ '(H -i --invert)'{-i,--invert}'[invert the sense of matching]' \ '(H -M --mountpoint :)'{-M+,--mountpoint=}'[specify the mountpoint]: :->targets' \ '(H -n --noheadings)'{-n,--noheadings}'[do not print a header line]' \ @@ -52,7 +53,8 @@ _arguments -s -C \ '(H)'{-P,--pairs}'[use key="value" output format]' \ '(H)'{-r,--raw}'[use raw output format]' \ + '(S)' \ - '(H)'{-k,--kernel}'[search in /proc/self/mountinfo (default)]' \ + '(H)-k[search in /proc/self/mountinfo (default)]' \ + '(H)--kernel=-[search in /proc/self/mountinfo (default)]::method:(mountinfo listmount)' \ '(H)'{-m,--mtab}'[search in /etc/mtab]' \ '(H)'{-N+,--task=}'[search /proc/<pid>/mountinfo]: :_pids' \ '(H)'{-s,--fstab}'[search in /etc/fstab]' \ diff --git a/Completion/Linux/Command/_gpasswd b/Completion/Linux/Command/_gpasswd index d5d16ebba..24fe361b0 100644 --- a/Completion/Linux/Command/_gpasswd +++ b/Completion/Linux/Command/_gpasswd @@ -5,7 +5,7 @@ _arguments -s \ '(-d --delete -a --add)'{-d,--delete}'[remove user from group]: : _users' \ '(-)'{-h,--help}'[display help]' \ '(-Q --root)'{-Q,--root}'[specify directory to chroot into]: : _files -/' \ - '(-r --delete-password)'{-r,--delete-password}'[remove the group password]' \ + '(-r --remove-password)'{-r,--remove-password}'[remove the group password]' \ '(-R --restrict)'{-R,--restrict}'[restrict access to GROUP to its members]' \ '(-M --members -A --administrators)'{-M,--members}'[set the list of members of GROUP]: :_sequence _users' \ '(-A --administrators -M --members)'{-A,--administrators}'[set the list of admins for GROUP]: :_sequence _users' \ diff --git a/Completion/Linux/Command/_htop b/Completion/Linux/Command/_htop deleted file mode 100644 index e8d2fffb1..000000000 --- a/Completion/Linux/Command/_htop +++ /dev/null @@ -1,55 +0,0 @@ -#compdef htop pcp-htop - -# Notes: -# - htop allows long options to be passed with a single dash; we don't account -# for this -# - htop parses optional arguments to -H and -u 'cleverly' by allowing the next -# word to be the optarg if it doesn't begin with a '-'; this should work here -# - There is a special version of htop designed to be used with PCP (Performance -# CoPilot); we don't fully account for this -# - Some of the ranges and defaults listed here had to be found in the source - -local MATCH MBEGIN MEND ret=1 -local -a context line state state_descr args tmp - -args=( - '(-d --delay)'{-d+,--delay=}'[specify update frequency]:delay (tenths of seconds) (1-100) [15]' - '(-C --no-color --no-colour)'{-C,--no-colo{,u}r}'[use monochrome colour scheme]' - '(-F --filter)'{-F+,--filter=}'[show only commands matching specified filter]:case-insensitive command-line sub-string:_process_names -a' - '(-)'{-h,--help}'[display usage information]' - '(-H --highlight-changes)'{-H+,--highlight-changes=}'[highlight new and old processes (optionally specify delay)]::delay (seconds) (1-86400) [5]' - '(-M --no-mouse)'{-M,--no-mouse}'[disable mouse]' - \*{-p+,--pid=}'[show only specified PIDs]: : _sequence _pids' - '--readonly[disable all system and process changing features]' - '(-s --sort-key)'{-s+,--sort-key=}'[sort by specified column]: :->sort-keys' - '(-t --tree)'{-t,--tree}'[show tree view of processes]' - '(-u --user)'{-u+,--user=}'[show only processes of current or specified user]:: : _users' - '(-U --no-unicode)'{-U,--no-unicode}'[disable Unicode]' - '(-)'{-V,--version}'[display version information]' -) - -[[ $OSTYPE == linux* ]] && -(( ! EUID || $+_comp_priv_prefix )) && -_pick_variant libcap=drop-capabilities $OSTYPE --help && -args+=( - '--drop-capabilities=-[drop specified capabilities]::mode [basic]:(( - off\:"do not drop capabilities" - basic\:"drop capabilities not needed for standard functionality (retains kill, renice, etc.)" - strict\:"drop capabilities not needed for core functionality" - ))' -) - -_arguments -s -S : $args && ret=0 - -case $state in - sort-keys) - tmp=( ${(f)"$(_call_program sort-keys $words[1] --sort-key help)"} ) - tmp=( ${tmp/#[[:space:]]##} ) - tmp=( ${tmp//:/\\:} ) - tmp=( ${tmp/[[:space:]]##/:} ) - tmp=( ${tmp/(#m):[A-Z]/${(L)MATCH}} ) - _describe -t sort-keys 'column (key)' tmp && ret=0 - ;; -esac - -return ret diff --git a/Completion/Linux/Command/_ip b/Completion/Linux/Command/_ip new file mode 100644 index 000000000..d63ddedab --- /dev/null +++ b/Completion/Linux/Command/_ip @@ -0,0 +1,630 @@ +#compdef ip + +# This is based on iproute2-ss061214. +# The manual and help text summaries are not consistent with the main +# manual text. I have based this on the main manual text, except where +# it's obviously deficient. + +# +# Values encoding simple types +# +local -a subcmd_dev net_intf_disp net_intf_list +# subcmd_dev=(/$'[[:alnum:][:punct:][:cntrl:][:digit:]]##\0'/ ':interfaces:network interface:_net_interfaces') +_find_net_interfaces +subcmd_dev=(/"(${(j.|.)net_intf_list})"$'\0'/ + ':interfaces:network interface:_net_interfaces') + +local -a subcmd_onoff +subcmd_onoff=(/$'(on|off)\0'/ ':onoff:state (on or off):(on off)') + +local -a subcmd_string +subcmd_string=(/$'[^\0]#\0'/ ':string:arbitrary string:( )') + +local -a subcmd_number +subcmd_number=(/$'[0-9]##\0'/ ': _message -e numbers "decimal number"') + +local xp='[[:xdigit:]][[:xdigit:]]' +local -a subcmd_lladdr +subcmd_lladdr=(/"${xp}:${xp}:${xp}:${xp}:${xp}:${xp}"$'\0'/ + ': _message -e lladdresses "link layer (MAC) address"') + +local -a subcmd_ipaddr +subcmd_ipaddr=( + /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ + ':ipaddress:IP address (v4 or v6) with optional /<network-prefix-length>:( )' +) + +local -a subcmd_ipaddrs +local PATH=$PATH +PATH=/sbin:$PATH +subcmd_ipaddrs=( + /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ + ":ipaddress:IP address (v4 or v6) currently set:( $(ip addr show | sed -n 's/^ *inet6* \([0-9a-f\.:/]*\) .*$/\1/p') )" +) +local -a subcmd_prefix_label +subcmd_prefix_label=( + /$'(<->(.<->(.<->(.<->|)|)|)|[:[:xdigit]]#:[:[:xdigit:]]#)(|/<->)\0'/ + ":ipaddresslabel:IP addrlabel prefix currently set:( $(ip -6 addrlabel list 2>/dev/null | sed -n 's/^prefix \([0-9a-f\.:/]*\) .*$/\1/p') )" +) + + +local -a subcmd_scope +_regex_words scope "IP address scope" \ + 'global:address globally valid' \ + 'site:address valid for site (IPv6)' \ + 'link:address valid for single link' \ + 'host:address valid for this host' +subcmd_scope=("$reply[@]") + +local -a subcmd_nud +_regex_words nud "neighbour unreachability detection state" \ + 'permanent:valid forever' \ + 'noarp:valid, not validated, removed if expired' \ + 'reachable:valid until reachability timeout' \ + 'stale:valid but suspicious' +subcmd_nud=("$reply[@]") + +local -a subcmd_rttype +_regex_words route-type "route type" \ + 'unicast:real point-to-point route' \ + 'unreachable:generate Host Unreachable messages' \ + 'blackhole:silently discard' \ + 'prohibit:generate Communication Administratively Prohibited messages' \ + 'local:Loopback route' \ + 'broadcast:destinations are broadcast addresses' \ + 'throw:used with policy rules, generate Net Unreachable if no route' \ + 'nat:Network Address Translation route' \ + 'anycast:anycast addresses, not implemented' \ + 'multicast:multicast routing, not present in normal tables' +subcmd_rttype=("$reply[@]") + +local -a subcmd_route +# Route type is optional in route. +# There's an overall default but then the whole thing is missed +# out, and it's marked as optional anyway. +subcmd_route=("(" $subcmd_rttype "|" ")" $subcmd_ipaddr) + +local -a subcmd_tos +_regex_words tos "service type" \ + 'lowdelay:low latency' \ + 'throughput:high bulk throughput' \ + 'reliability:high reliability' +subcmd_tos=("(" "$reply[@]" "|" + /$'(|0x)[[:xdigit:]]##\0'/ ":hex-numbers:8-bit hex number:( )" ")") + +local -a subcmd_lockmtu +subcmd_lockmtu=("(" /$'lock\0'/ ":lock:lock:(lock)" "|" ")" $subcmd_number ) + +local -a subcmd_nexthop +_regex_words nexthop 'nexthop route keyword' \ + 'via:specify nexthop router:$subcmd_ipaddr' \ + 'dev:specify output device:$subcmd_dev' \ + 'weight:specify relative quality of route:$subcmd_number' +subcmd_nexthop=("$reply[@]" "#") + +local -a subcmd_rtprotocol +_regex_words rtprotocol 'route protocol' \ + 'redirect:installed from ICMP redirect' \ + 'kernel:installed automatically by kernel' \ + 'boot:installed during boot sequence' \ + 'static:installed by administrator' \ + 'ra:installed by Router Discovery protocol' +subcmd_rtprotocol=("$reply[@]") + +local -a subcmd_rttable +_regex_words rttable 'routing table' \ + 'local:local routes' \ + 'main:main routing table' \ + 'default:default routing table' \ + 'unspec:unspecified routing table' +subcmd_rttable=("(" "$reply[@]" "|" $subcmd_number ")") + +local -a subcmd_rtrealm subcmd_rtrealms +_regex_words -t / rtrealm 'routing realm' \ + 'cosmos:everywhere' +subcmd_rtrealms=("(" "$reply[@]" "|" /$'[0-9]##/'/ + ':numbers:decimal number:( )' ")") + +_regex_words rtrealm 'routing realm' \ + 'cosmos:everywhere' +subcmd_rtrealm=("(" "$reply[@]" "|" $subcmd_number ")") +subcmd_rtrealms+=($subcmd_rtrealm) + +local -a subcmd_rtselector +_regex_words rtselmod 'routing selector modifier' \ + 'root:select minimum route prefix length to match' \ + 'match:select maximum route prefix length to match' \ + 'exact:select exact prefix length to match' +subcmd_rtselector=("(" "$reply[@]" "|" ")" $subcmd_ipaddr) + +local -a subcmd_family +_regex_words family 'protocol family' \ + 'inet:IPv4' \ + 'inet6:IPv6' \ + 'link:local, no networking protocol' +subcmd_family=("$reply[@]") + +local -a subcmd_ruletypes +_regex_words ruletype 'rule type' \ + 'unicast:rule applies to a route' \ + 'blackhole:rule silently drops packet' \ + 'unreachable:rule generates Network Unreachable messages' \ + 'prohibit:rule generates Communication Administratively Prohibited messages' \ + 'nat:rule prescribes translation of source IP address' +subcmd_ruletypes=("$reply[@]") + +local -a subcmd_tunnelmode +_regex_words tunnelmode 'tunnel mode' \ + 'ipip:IPv4 in IPv4 tunnel' \ + 'sit:Simple Internet Transition - IPv6 in IPv4 tunnel' \ + 'gre:Generic Route Encapsulation - IPv4/IPv6 in IPv4 tunnel' +subcmd_tunnelmode=("$reply[@]") + +local -a subcmd_linktype +subcmd_linktype=(/$'[^\0]##\0'/ ':link-types:link type:(bridge bond dummy hsr ifb ipoib macvlan macvtap vcan veth vlan vxlan ip6tnl ipip sit gre gretap ip6gre ip6gretap vti nlmon ipvlan lowpan geneve macsec vrf)') + +local -a subcmd_files +subcmd_files=(/$'[^\0]##\0'/ ':files:file:_files') + +# +# The ip top-level commands. First link +# + +local -a link_common_cmds +link_common_cmds=( + 'txq*ueuelen:specify length of transmit queue:$subcmd_number' \ + 'ad*dress:specify unicast link layer (MAC) address:$subcmd_lladdr' \ + 'br*oadcast:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ + 'm*tu:specify maximum transmit unit:$subcmd_number' +) +local -a link_add_cmds +_regex_words \ + link-add-commands 'link add command' $link_common_cmds \ + 'link:specify device:$subcmd_dev' \ + 'name:specify name' \ + 'type:specify type:$subcmd_linktype' \ + 'numtxqueues:specify number of transmit queues:$subcmd_number' \ + 'numrxqueues:specify number of receive queues:$subcmd_number' \ + 'index:specify desired index' \ + 'group:multicast IP address to join:$subcmd_lladdr' +link_add_cmds=( "$reply[@]" "#" ) + +local -a link_set_cmds +_regex_words \ + link-set-commands 'link set command' \ + 'dev:specify device:$subcmd_dev' \ + 'u*p:change state to up' \ + 'do*wn:change state to down' \ + 'ar*p:change ARP flag on device:$subcmd_onoff' \ + 'mu*lticast:change MULTICAST flag on device:$subcmd_onoff' \ + 'allmulticast:change allmulticast flag on device:$subcmd_onoff' \ + 'pr*omisc:set promiscuous mode:$subcmd_onoff' \ + 'protodown:change the PROTODOWN state on the device:$subcmd_onoff' \ + 'dy*namic:change DYNAMIC flag on device:$subcmd_onoff' \ + 'n*ame:change name of device:$subcmd_string' \ + 'txq*ueuelen:specify length of transmit queue:$subcmd_number' \ + 'txql*en:specify length of transmit queue:$subcmd_number' \ + 'm*tu:specify maximum transmit unit:$subcmd_number' \ + 'ad*dress:specify unicast link layer (MAC) address:$subcmd_lladdr' \ + 'br*oadcast:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ + 'brd:specify broadcast link layer (MAC) address:$subcmd_lladdr' \ + 'p*eer:specify peer link layer (MAC) address:$subcmd_lladdr' +# can complete interface with no dev, subcommands can repeat... +link_set_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) + +local -a link_show_cmds +_regex_words link-show-commands 'link show command' \ + 'dev:specify device:$subcmd_dev' \ + 'up:limit display to running devices' +link_show_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) + +local -a link_cmds +_regex_words \ + link-commands "link command" \ + 'a*dd:add virtual link:$link_add_cmds' \ + 'h*elp:show help for command' \ + 'se*t:change device attributes:$link_set_cmds' \ + 'sh*ow:display device attributes:$link_show_cmds' +link_cmds=("$reply[@]") + +# +# addr +# + +local -a addr_add_cmds +# TODO: broadcast can take + or = +_regex_words addr-add-commands "addr add/remove/change/replace commands" \ + 'dev:specify device:$subcmd_dev' \ + 'lo*cal:specify local IP address:$subcmd_ipaddr' \ + 'p*eer:specify peer IP address (point-to-point):$subcmd_ipaddr' \ + 'b*roadcast:specify broadcast IP address:$subcmd_ipaddr' \ + 'la*bel:specify tag for device:$subcmd_string' \ + 's*cope:specify scope for address:$subcmd_scope' \ + 'valid_lft:specify valid lifetime of this address' \ + 'preferred_lft:specify valid lifetime of this address' \ + 'home:designate this address as the "home address" (IPv6)' \ + 'mngtmpaddr:manage temporary addresses created from this one as template on behalf of Privacy Extensions' + +# can complete IP address with no keyword +addr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" ) + +local -a addr_del_cmds +addr_del_cmds=("(" $subcmd_ipaddrs "|" "$reply[@]" ")" "#" ) + +local -a addr_show_cmds +# TODO: broadcast can take + or = +_regex_words addr-show-commands "addr show commands" \ + 'dev:specify device:$subcmd_dev' \ + 'up:limit display to running devices' \ + 's*cope:specify scope for address:$subcmd_scope' \ + 't*o:limit to given IP address/prefix:$subcmd_ipaddr' \ + 'la*bel:list tags matching glob pattern:$subcmd_string' \ + 'dynamic:list addresses from stateless configuration (IPv6)' \ + 'permanent:list non-dynamic addresses (IPv6)' \ + 'tentative:list addresses failing duplicate address detection (IPv6)' \ + 'deprecated:list deprecated addresses (IPv6)' \ + 'primary:list only primary addresses' \ + 'secondary:list only secondary addresses' +# can complete device with no keyword +addr_show_cmds=("(" $subcmd_dev "|" ")" "$reply[@]" "#" ) + +local -a addr_cmds +_regex_words \ + addr-commands "addr command" \ + 'h*elp:show help for command' \ + 'a*dd:add new protocol address:$addr_add_cmds' \ + 'c*hange:change existing protocol address:$addr_add_cmds' \ + 'r*eplace:add or update protocol address:$addr_add_cmds' \ + 'd*elete:delete protocol address:$addr_del_cmds' \ + 's*how:show protocol address:$addr_show_cmds' \ + 'f*lush:flush protocol address:$addr_show_cmds' +addr_cmds=("$reply[@]") + +# +# addrlabel +# + +local -a addrlabel_add_cmds +_regex_words addrlabel-add-commands "addlabel add command" \ + 'p*refix: limit to given IP address/prefix' \ + 'd*ev: specify device:$subcmd_dev' \ + 'l*abel: number' +addrlabel_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") + +local -a addrlabel_del_cmds +_regex_words addrlabel-add-commands "addlabel del command" \ + 'p*refix: limit to given IP address/prefix:$subcmd_prefix_label' \ + 'd*ev: specify device:$subcmd_dev' \ + 'l*abel: number:$subcmd_number' +addrlabel_del_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") + + +local -a addrlabel_cmds +_regex_words \ + addrlabel-commands "addrlabel command" \ + 'h*elp: show help for command' \ + 'a*dd: add an address labels:$addrlabel_add_cmds' \ + 'd*el: delete an address labels:$addrlabel_del_cmds' \ + 'l*ist: list address labels' \ + 'f*lush: flush address labels' +addrlabel_cmds=("$reply[@]") + +# +# neigh +# + +local -a neigh_add_cmds +_regex_words neigh-add-commands "neighbour add command" \ + 't*o:add new neighbour IP address:$subcmd_ipaddr' \ + 'dev:specify network device:$subcmd_dev' \ + 'l*laddr:specify link layer (MAC) address or null:$subcmd_lladdr' \ + 'n*ud:specify neighbour unreachability detection state:$subcmd_nud' +# to-address without keyword can appear first +neigh_add_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") + +local -a neigh_del_cmds +_regex_words neigh-add-commands "neighbour delete command" \ + 't*o:remove neighbour IP address:$subcmd_ipaddr' \ + 'dev:specify network device:$subcmd_dev' +neigh_del_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") + +local -a neigh_show_cmds +_regex_words neigh-show-commands "neighbour show command" \ + 't*o:select neighbours by prefix:$subcmd_ipaddr' \ + 'dev:select neighbours by device:$subcmd_dev' \ + 'u*nused:only list unused neighbours' \ + 'n*ud:only list neighbours in given state:$subcmd_nud' +neigh_show_cmds=( "(" $subcmd_ipaddr "|" ")" "$reply[@]" "#" ) + +local -a neigh_cmds +_regex_words \ + neigh-commands "neigh command" \ + 'h*elp:show help for command' \ + 'a*dd:add new neighbour entry:$neigh_add_cmds' \ + 'c*hange:change existing neighbour entry:$neigh_add_cmds' \ + 'r*eplace:add or change neighbour entry:$neigh_add_cmds' \ + 'd*elete:delete neighbour entry:$neigh_del_cmds' \ + 's*how:list neighbour entries:$neigh_show_cmds' \ + 'f*lush:flush neighbour entries:$neigh_show_cmds' +neigh_cmds=("$reply[@]") + + +# +# route +# + +local -a route_add_cmds +_regex_words route-add-commands "route add/change/replace command" \ + 'to:route destination prefix:$subcmd_route' \ + 'tos:type of service:$subcmd_tos' \ + 'ds*field:type of service:$subcmd_tos' \ + 'me*tric:preference value of route:$subcmd_number' \ + 'pre*ference:preference value of route:$subcmd_number' \ + 'ta*ble:select table by ID:$subcmd_rttable' \ + 'dev:select device:$subcmd_dev' \ + 'v*ia:select nexthop router:$subcmd_ipaddr' \ + 'sr*c:select preferred source address:$subcmd_ipaddr' \ + 're*alm:select routing realm:$subcmd_rtrealm' \ + 'mtu:select maximum transport unit:$subcmd_lockmtu' \ + 'w*indow:select maximal window in bytes:$subcmd_number' \ + 'rtt:select round trip time estimate:$subcmd_number' \ + 'rttv*ar:select initial round trip variance estimate:$subcmd_number' \ + 'ss*thresh:select initial slow start threshold estimate:$subcmd_number' \ + 'cw*nd:select clamp for congestion window (only if locked):$subcmd_number' \ + 'in*itcwnd:select max initial cwnd in MSS:$subcmd_number' \ + 'ad*vmss:select maximal segment size advertised:$subcmd_number' \ + 're*ordering:select maximal reordering for path:$subcmd_number' \ + 'ne*xthop:select nexthop of multipath route:$subcmd_nexthop' \ + 'sc*ope:select scope of destinations:$subcmd_scope' \ + 'pro*tocol:select routing protocol identifier:$subcmd_rtprotocol' \ + 'onl*ink:pretend nexthop is directly attached' \ + 'eq*ualize:allow packet by packet randomization' +# route can appear with no "to" +route_add_cmds=("(" $subcmd_route "|" ")" "$reply[@]" "#") + +local -a route_show_cmds +_regex_words route-show-commands "route show command" \ + 'to:select route via prefix:$subcmd_rtselector' \ + 'tos:type of service:$subcmd_tos' \ + 'ta*ble:select table by ID:$subcmd_rttable' \ + 'cl*oned:list only dynamically forked routes' \ + 'ca*ched:list only dynamically forked routes' \ + 'f*rom:select route via source address prefix:$subcmd_rtselector' \ + 'p*rotocol:select routing protocol identifier:$subcmd_rtprotocol' \ + 'sc*ope:select scope of destinations:$subcmd_scope' \ + 'ty*pe:route type:$subcmd_rttype' \ + 'dev:select device:$subcmd_dev' \ + 'v*ia:select nexthop router:$subcmd_ipaddr' \ + 'sr*c:select route via source prefix:$subcmd_ipaddr' \ + 'realm:select routing realm:$subcmd_rtrealm' \ + 'realms:select from/to routing realms:$subcmd_rtrealms' +# route selector can appear with no "to" +route_show_cmds=("(" $subcmd_rtselector "|" ")" "$reply[@]" "#") + +local -a route_get_cmds +_regex_words route-get-commands "route get commands" \ + 'to:route destination:$subcmd_ipaddr' \ + 'f*rom:route source:$subcmd_ipaddr' \ + 'tos:select type of service:$subcmd_tos' \ + 'ds*field:type of service:$subcmd_tos' \ + 'iif:select input interface (device):$subcmd_dev' \ + 'oif:select output interface (device):$subcmd_dev' \ + 'c*onnected:use preferred address as source' +route_get_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") + +local -a route_cmds +_regex_words \ + route-commands "route command" \ + 'h*elp:show help for command' \ + 'a*dd:add new network route:$route_add_cmds' \ + 'c*hange:change existing network route:$route_add_cmds' \ + 'r*eplace:add or change network route:$route_add_cmds' \ + 'd*elete:delete network route:$route_add_cmds' \ + 's*how:list network routes:$route_show_cmds' \ + 'f*lush:flush network routes:$route_show_cmds' \ + 'g*et:get a single network route:$route_get_cmds' +route_cmds=("$reply[@]") + +# +# rule +# + +local -a rule_add_cmds +_regex_words rule-add-commands 'ip rule add/delete commands' \ + 'ty*pe:type of rule:$subcmd_ruletypes' \ + 'fr*om:select source prefix:$subcmd_ipaddr' \ + 'to:select destination prefix:$subcmd_ipaddr' \ + 'iif:select input interface (device):$subcmd_dev' \ + 'tos:select type of service:$subcmd_tos' \ + 'ds*field:select type of service:$subcmd_tos' \ + 'fw*mark:select fwmark:$subcmd_string' \ + 'pr*iority:select unique priority for rule:$subcmd_number' \ + 'ta*ble:select routing table by ID:$subcmd_rttable' \ + 're*alms:select from/to routing realms:$subcmd_rtrealms' \ + 'nat:select base of IP block to translate:$subcmd_ipaddr' + +rule_add_cmds=("(" $subcmd_ruletypes "|" ")" "$reply[@]" "#") + +local -a rule_cmds +_regex_words \ + rule-commands "rule command" \ + 'h*elp:show help for command' \ + 'a*dd:insert a new routing rule:$rule_add_cmds' \ + 'd*elete:delete a routing rule:$rule_add_cmds' \ + 'f*lush:flush rules and dump deleted rules' \ + 's*how:list routing rules' +rule_cmds=("$reply[@]") + +# +# tunnel +# + +local -a tunnel_add_cmds +_regex_words tunnel-add-commands 'tunnel add/change/delete commands' \ + 'na*me:select tunnel device name:$subcmd_dev' \ + 'm*ode:select tunnel mode:$subcmd_tunnelmode' \ + 'r*emote:select remote endpoint address:$subcmd_ipaddr' \ + 'l*ocal:select local address:$subcmd_ipaddr' \ + 'ttl:set fixed time to live, 1 to 255 or 0 (inherit):$subcmd_number' \ + 'tos:select type of service:$subcmd_tos' \ + 'ds*field:select type of service:$subcmd_tos' \ + 'dev:select device to bind tunnel to:$subcmd_dev' \ + 'no*pmtudisc:disable path maximum transport unit discovery' \ + 'ik*ey:set input key for GRE tunnel:$subcmd_ipaddr' \ + 'ok*ey:set output key for GRE tunnel:$subcmd_ipaddr' \ + 'k*ey:set bidirectional key for GRE tunnel:$subcmd_ipaddr' \ + 'ic*sum:enable input checksums for GRE tunnel' \ + 'oc*sum:enable output checksums for GRE tunnel' \ + 'c*sum:enable bidirectional checksums for GRE tunnel' \ + 'is*eq:serialize input packets on GRE tunnel' \ + 'os*eq:serialize output packets on GRE tunnel' \ + 's*eq:serialize packets bidirectionally on GRE tunnel' +# name is default... we always complete it as an interface, +# although that's not really right for "add". +tunnel_add_cmds=("$reply[@]" "#") + +local -a tunnel_cmds +_regex_words \ + tunnel-commands "tunnel command" \ + 'h*elp:show help for command' \ + 'a*dd:add a new IP tunnel:$tunnel_add_cmds' \ + 'c*hange:change an existing IP tunnel:$tunnel_add_cmds' \ + 'd*el:destroy an IP tunnel:$tunnel_add_cmds' \ + 's*how:list IP tunnels' +tunnel_cmds=("$reply[@]") + +# +# maddr +# + +local -a maddr_add_cmds +_regex_words maddr-add-commands "maddr add/delete command" \ + 'a*ddress:select link layer (MAC) address:$subcmd_lladdr' \ + 'dev:select device to bind multicast address to:$subcmd_dev' +maddr_add_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]" "#") + +local -a maddr_show_cmds +_regex_words maddr-show-commands 'maddr show command' \ + 'dev:select device with multicast address(es):$subcmd_dev' +# device is default argument but if given the "dev" is useless +maddr_show_cmds=("(" $subcmd_dev "|" "$reply[@]" ")") + +local -a maddr_cmds +_regex_words \ + maddr-commands "maddr command" \ + 'h*elp:show help for command' \ + 'a*dd:add multicast address:$maddr_add_cmds' \ + 'd*elete:delete multicast address:$maddr_add_cmds' \ + 's*how:list multicast addresses:$maddr_show_cmds' +maddr_cmds=("$reply[@]") + +# +# mroute +# + +local -a mroute_show_cmds +_regex_words mroute-show-commands "mroute show command" \ + 'to:select destination prefix:$subcmd_ipaddr' \ + 'iif:select input interface (device):$subcmd_dev' \ + 'from:select source prefix:$subcmd_ipaddr' +mroute_show_cmds=("(" $subcmd_ipaddr "|" ")" "$reply[@]") + +local -a mroute_cmds +_regex_words \ + mroute-commands "mroute command" \ + 'h*elp:show help for command' \ + 's*how:list multicast routing cache entries:$mroute_show_cmds' +mroute_cmds=("$reply[@]") + +# +# monitor +# + +local -a monitor_cmds +_regex_words \ + monitor-commands "monitor command" \ + 'h*elp:show help for command' \ + 'all:monitor all changes' \ + 'link:monitor changes to links' \ + 'address:monitor changes to addresses' \ + 'route:monitor changes to routes' \ + 'file:read rtmon-generated log:$subcmd_files' +monitor_cmds=("$reply[@]") + +# +# Global argument handling +# + +# Arguments to _regex_arguments, built up in array $args. +local -a args reply +args=( + # Command word. Don't care what that is. + /$'[^\0]#\0'/ +) + +_regex_words options "ip option" \ + '-V*ersion:display version information' \ + '-h*uman-readable:output statistics with human readable values' \ + '-b*atch:read commands from specified file:$subcmd_files' \ + '-force:do not terminate on errors in batch mode' \ + '-i*ec:print human readable rates in IEC units (ie. 1K = 1024)' \ + '-s*tatistics:output statistics' \ + '-d*etails:output more detailed information' \ + '-c*olor:color output' \ + '-br*ief:brief output' \ + '-a*ll:executes specified command over all objects' \ + '-l*oops:specify maximum loops ip address flush logic will attempt:$subcmd_number' \ + '-f*amily:select protocol family:$subcmd_family' \ + '-4:IPv4' \ + '-6:IPv6' \ + '-B:family bridge' \ + '-D:family DECnet' \ + '-I:family IPX' \ + '-M:family MPLS' \ + '-0:link protocol, no networking' \ + '-o*neline:output one record per line' \ + '-j*son:output results in JSON' \ + '-p*retty:pretty print JSON' \ + '-r*esolve:use system resolver for DNS names' \ + '-n*etns:switch to specified network namespace:$subcmd_string' \ + '-N*umeric:print numbers instead of converting to text forms' \ + '-a*ll:execute specified command over all objects' \ + '-c*olor:use color output' \ + '-t*imestamp:display current time when using monitor option' \ + '-ts*hort:like -timestamp, but use shorter format' \ + '-rc*vbuf:set the netlink socket receive buffer size:$subcmd_number' \ + '-iec:print human readable rates in IEC units' \ + '-j*son:output results in JSON format' \ + '-echo:request the kernel to send applied changes back' +args+=("$reply[@]" "#") + +_regex_words \ + commands "ip command" \ + 'l*ink:configure network device:$link_cmds' \ + 'addrlabel:manage addrlabel:$addrlabel_cmds' \ + 'a*ddr:manage protocol address:$addr_cmds' \ + 'r*oute:manage routing table:$route_cmds' \ + 'ru*le:manage routing policy database:$rule_cmds' \ + 'n*eigh:manage neighbour/ARP tables:$neigh_cmds' \ + 'nt*able:manage the neighbor cache operation' \ + 't*unnel:configure tunnel:$tunnel_cmds' \ + 'net*ns:manage network namespaces' \ + 'l2*tp:tunnel ethernet over IP (L2TPv3)' \ + 'f*ou:UDP receive port configuration' \ + 'mac*sec:MACsec device configuration' \ + 'tcp_metrics:manage TCP metrics' \ + 'token:manage tokenized interface identifiers' \ + 'netc*onf:network configuration monitoring' \ + ila ioam mptcp nexthop vrf sr stats \ + 'm*addr:manage multicast addresses:$maddr_cmds' \ + 'mr*oute:manage multicast routing cache:$mroute_cmds' \ + 'mru*le:multicast routing policy database' \ + 'mo*nitor:monitor state:$monitor_cmds' \ + 'tunt*ap:manage TUN/TAP devices' \ + 'x*frm:manage IPSec policies' \ + 'help' +args+=("$reply[@]") + +_regex_arguments _ip "${args[@]}" + +_ip "$@" diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset index a40480904..1f29c63ec 100644 --- a/Completion/Linux/Command/_ipset +++ b/Completion/Linux/Command/_ipset @@ -45,9 +45,9 @@ hash=( '--hashsize[the initial hash size aligned to a power of 2]:hashsize [1024 '--resize[ratio of increasing hash size after unsuccessful <probes> of double-hashing, altering discouraged]:percent' ) -case $words[offset+2]; in +case $words[offset+2] in -N|--create) - case $words[offset+4]; in + case $words[offset+4] in bitmap\:ip) args=( $from_to '--netmask[store network addresses instead of IP addresses]:CIDR' diff --git a/Completion/Linux/Command/_iptables b/Completion/Linux/Command/_iptables index 0a901f0f2..2ac13b481 100644 --- a/Completion/Linux/Command/_iptables +++ b/Completion/Linux/Command/_iptables @@ -29,7 +29,7 @@ ropts=( ) prev=( ${words[1,CURRENT-1]} ) -case ${prev[${prev[(I)-p|--proto|--protocol]}+1]}; in +case ${prev[${prev[(I)-p|--proto|--protocol]}+1]} in tcp) args=( '--tcp-flags[match based on TCP flags in a packet]: :->tcp-flags: :->tcp-flags' @@ -46,7 +46,7 @@ case ${prev[${prev[(I)-p|--proto|--protocol]}+1]}; in icmp) args=( '--icmp-type[match specified ICMP type]:*^!:ICMP type:->icmp-types' ) ;; esac -case ${prev[${prev[(I)-j|--jump]}+1]}; in +case ${prev[${prev[(I)-j|--jump]}+1]} in DNAT) args+=( '(--to --to-destination)'{--to,--to-destination}':address' ) ;; DSCP) args+=( @@ -91,7 +91,7 @@ typeset -U args while (( i=words[(ib.i.)-m|--match]+1 )) (( i<CURRENT )); do - case ${words[i]}; in + case ${words[i]} in addrtype) args+=( '--src-type[match if the source address is of given type]:type:->address-types' diff --git a/Completion/Linux/Command/_kbd b/Completion/Linux/Command/_kbd new file mode 100644 index 000000000..d0a87b6f6 --- /dev/null +++ b/Completion/Linux/Command/_kbd @@ -0,0 +1,19 @@ +#compdef loadkeys + +case $OSTYPE in + linux*) + _arguments \ + '(--clearcompose -c)'{--clearcompose,-c}'[clear kernel compose table]' \ + '(--default -d)'{--default,-d}'[load default keymap file]' \ + '(--help -h)'{--help,-h}'[display help information]' \ + '(--mktable -m)'{--mktable,-m}'[output a "defkeymap.c" to stdout]' \ + '(--clearstrings)'{--clearstrings,-s}'[clear kernel string table]' \ + '*'{--verbose,-v}'[print more details]' \ + ':keymap:_files -W /usr/share/keymaps' + ;; + solaris*) + _files -W /usr/share/lib/keytables + ;; + + *) _default;; +esac diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_kmod index f19784dff..4e87c4767 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_kmod @@ -38,11 +38,15 @@ _modutils() { ) case "$service" in - lsmod) _arguments -s "$args[@]" && return ;; + lsmod) + _arguments -s "$args[@]" \ + '(-s --syslog)'{-s,--syslog}'[report via syslog instead of stderr]' \ + '(-v --verbose)'{-v,--verbose}'[enable more messages]' && return + ;; modinfo) _arguments -s -C "$args[@]" \ - '(-)'{-k+,--set-version=}'[use modules from a different kernel version]:kernel_version:($(echo $modules_dir/*(/\:t)))' \ + '(-)'{-k+,--set-version=}'[use modules from a different kernel version]:kernel_version:compadd $modules_dir/*(/\:t)' \ {-b+,--basedir=}'[use specified directory as filesystem root]:path:_directories' \ '1:module file:->all-modules' \ + '(field)' \ @@ -59,13 +63,14 @@ _modutils() { ign='-h --help -V --version -c --showconfig --show-config' _arguments -s -C "$args[@]" \ "(-a --all $ign)"{-a,--all}'[load all matching modules]' \ - "(-n --show $ign)"{-n,--show}"[don't actually perform action]" \ "(-q --quiet $ign)"{-q,--quiet}"[don't complain about insmod failures]" \ "(-s --syslog $ign)"{-s,--syslog}'[report via syslog instead of stderr]' \ "(-v --verbose $ign)"{-v,--verbose}'[print all commands as executed]' \ '(-C --config)'{-C+,--config=}'[specify config file]:config file:_files' \ "(-r --remove -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \ - '--remove-dependencies[also remove modules depending on it]' \ + '!--remove-dependencies' \ + '--remove-holders[also remove module holders]' \ + '(-w --wait)'{-w+,--wait=}"[wait for module's refcount to become 0 so it can be removed (with -r)]:delay (msecs)" \ '(* -R --resolve-alias)'{-R,--resolve-alias}'[only lookup and print alias and exit]' \ '--first-time[fail if module already inserted or removed]' \ "(-a --all $ign)"{'-i[ignore install/remove commands in config file]','--ignore-install[ignore install commands in config file]','--ignore-remove[ignore remove commands in config file]'} \ @@ -76,8 +81,8 @@ _modutils() { '(-D --show-depends)'{-D,--show-depends}'[only print module dependencies and exit]' \ '(-)'{-c,--showconfig,--show-config}'[show current configuration]' \ --{show,dump}'-modversions[dump module symbol version and exit]' \ - {-d+,--dirname=}'[use specified directory as filesystem root]:path:_directories' \ - {-S+,--set-version=}'[use modules from a different kernel version]:kernel_version:($(echo $modules_dir/*(/\:t)))' \ + '(-d --dirname)'{-d+,--dirname=}'[use specified directory as filesystem root]:path:_directories' \ + '(-S --set-version)'{-S+,--set-version=}'[use modules from a different kernel version]:kernel_version:($(echo $modules_dir/*(/\:t)))' \ '--show-exports[only print module exported symbol versions and exit]' \ '(-n --dry-run --show)'{-n,--dry-run,--show}"[don't execute operations, just print]" \ "(-c $ign)1:modules:->loadable-modules" \ @@ -87,17 +92,20 @@ _modutils() { ;; rmmod) - _arguments -s -C "$args[@]" \ + _arguments -s "$args[@]" \ '(-f --force)'{-f,--force}'[allow modules that are in use to be removed]' \ '(-s --syslog)'{-s,--syslog}'[send errors to syslog]' \ '(-v --verbose)'{-v,--verbose}'[be verbose]' \ - '*:loaded module:->loaded-modules' && ret=0 + '*:loaded module:->loaded-modules' && return ;; insmod) - _arguments "$args[@]" \ - '1:module file:_files' \ - '*:module parameters' && ret=0 + _arguments -s "$args[@]" \ + '(-f --force)'{-f,--force}'[forces a module load (dangerous)]' \ + '(-s --syslog)'{-s,--syslog}'[report via syslog instead of stderr]' \ + '(-v --verbose)'{-v,--verbose}'[enable more messages]' \ + '1:module file:_files -g "*.ko(|.gz|.xz|.zst)(-.)"' \ + '*:module option' && return ;; esac diff --git a/Completion/Linux/Command/_analyseplugin b/Completion/Linux/Command/_ladspa index f7f36db50..f7f36db50 100644 --- a/Completion/Linux/Command/_analyseplugin +++ b/Completion/Linux/Command/_ladspa diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup index affbc58f3..aab9adbcd 100644 --- a/Completion/Linux/Command/_losetup +++ b/Completion/Linux/Command/_losetup @@ -8,7 +8,7 @@ fi local device offset -device='1:device:_files -g "/dev/loop<->"' +device=':device:_files -g "/dev/loop<->"' offset=( {-o,--offset}'+[specify data start is offset]:offset (bytes)' ) _arguments -s -S \ @@ -28,7 +28,8 @@ _arguments -s -S \ {-c,--set-capacity}'[reread the size of the file associated with the loop device]' \ - 'detach' \ '(-)'{--detach,-d}'[detach from specified loop device]' \ - "$device" \ + '(-)--remove[remove one or more devices]:device' \ + "*$device" \ - '(detach-all)' \ {-D,--detach-all}'[detach all associated loop devices]' \ - 'create' \ diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk index c8b30eb5e..c2c67c9a6 100644 --- a/Completion/Linux/Command/_lsblk +++ b/Completion/Linux/Command/_lsblk @@ -13,16 +13,18 @@ _arguments -C -s -S \ '(H)*--ct-filter=[restrict the next counter]:expression' \ '(H)*--ct=[define a custom counter]:name\:param\:func' \ '(H -a --all)'{-a,--all}'[print all devices]' \ - '(H -b --bytes)'{-b,--bytes}'[print size in bytes rather than in human readable format]' \ + '(H -b --bytes)'{-b,--bytes}'[print size in bytes instead of a human readable format]' \ '(H -d --nodeps)'{-d,--nodeps}"[don't print slaves or holders]" \ '(H -I --include)*'{-e,--exclude}'[exclude devices by major number]:major device number:->majorlist' \ '(H -e --exclude)*'{-I+,--include=}'[show only devices with specified major numbers]:major device number:->majorlist' \ + '(H)--hyperlink=-[print paths as hyperlinks]::when:(always never auto)' \ '(H -n --noheadings -y --shell)'{-n,--noheadings}"[don't print headings]" \ '(H -p --paths)'{-p,--paths}'[print complete device path]' \ '(H -s --inverse)'{-s,--inverse}'[reverse dependency order]' \ '(H -w --width)'{-w+,--width=}'[specify output width]:width' \ '(H -x --sort)'{-x+,--sort=}'[sort output by specified column]:column:->columns' \ '(H -y --shell -n --noheadings)'{-y,--shell}'[use column names usable as shell variable identifiers]' \ + '--properties-by=[specify methods used to gather data]:method [file,udev,blkid]:_sequence compadd - udev blkid file none' \ '(H)--sysroot=[use specified directory as system root]:directory:_directories' \ '*:device:_files -g "*(-%b)" -P / -W /' \ + fields \ diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm index 5b73ef4be..89c3ac036 100644 --- a/Completion/Linux/Command/_mdadm +++ b/Completion/Linux/Command/_mdadm @@ -71,14 +71,14 @@ _layouts () { if (( $+words[(r)-(A|-assemble)] )); then args=( '(--bitmap)'--bitmap='[bitmap file to use with the array]::bitmap file:_files' - '(--uuid -u)'{--uuid=,-u}'[UUID of array to assemble]:UUID' - '(--super-minor -m)'{--super-minor=,-m}'[minor number to look for in super-block]:minor number' - '(--name -N)'{--name=,-N}'[array name to look for in super-block]:array name' - '(--config -c)'{--config=,-c}'[config file]::config file:_files' + '(--uuid -u)'{--uuid=,-u+}'[UUID of array to assemble]:UUID' + '(--super-minor -m)'{--super-minor=,-m+}'[minor number to look for in super-block]:minor number' + '(--name -N)'{--name=,-N+}'[array name to look for in super-block]:array name' + '(--config -c)'{--config=,-c+}'[config file]::config file:_files' '(--scan -s)'{--scan,-s}'[scan config file for missing information]' '(--run -R)'{--run,-R}'[try to start the array even if not enough devices for a full array are present]' '(--force -f)'{--force,-f}'[assemble the array even if some superblocks appear out-of-date]' - '(--update -U)'{--update=,-U}'[update superblock]::update the superblock:(sparc2.2 summaries uuid resync byteorder super-minor)' + '(--update -U)'{--update=,-U+}'[update superblock]::update the superblock:(sparc2.2 summaries uuid resync byteorder super-minor)' ) fi diff --git a/Completion/Linux/Command/_mondo b/Completion/Linux/Command/_mondo deleted file mode 100644 index 047a04129..000000000 --- a/Completion/Linux/Command/_mondo +++ /dev/null @@ -1,54 +0,0 @@ -#compdef mondoarchive - -local curcontext="$curcontext" state line expl ret=1 -typeset -A opt_args - -_arguments -C \ - '(-V)-O[create backup]' \ - '(-O)-V[verify backup]' \ - '(-c -C -i -n -w)-c[use CD-R as backup media]:CD-R burn speed' \ - '(-c -C -i -n -w)-C[use CD-R as streaming device (experimental)]:CD-R burn speed' \ - '(-c -C -i -n -w)-i[use ISO image as backup media]' \ - '(-c -C -i -n -w)-n[use NFS mountpoint as backup media]:NFS mountpoint' \ - '(-c -C -i -n -w)-w[use CD-RW as backup media]:CD-RW burn speed' \ - '-D[differential backup]' \ - '-E[exclude path(s) from backup]:paths to exclude from backup:->quoted_path' \ - '-I[path(s) to backup]:paths to include in backup:->quoted_path' \ - '-d[backup device]:backup device' \ - '-g[run in fullscreen mode]' \ - '-k[path to kernel]:path to kernel:->kernel_or_magic' \ - '-m[manual eject]' \ - '-s[media size]:media size]' \ - '-x[non-linux partition]:non-linux partition:_files -g "*(%b)"' \ - '(-1 -2 -3 -4 -5 -6 -7 -8 -9)-'{1,2,3,4,5,6,7,8,9}'[compression level]' \ - '-A[post ISO-creation command]:pre ISO-creation command' \ - '-B[pre iSO-creation command]:post ISO-creation command' \ - '-F[do not create floppy]' \ - '-H[create autorestore image]' \ - '-L[use lzo instead of bzip2]' \ - '-P[post-nuke tarball]:post-nuke tarball:_files -g "*.(#i)(tar.gz|tgz)(-.)"' \ - '-S[scratch directory]:scratch directory:_files -/' \ - '-T[temporary directory]:temporary directory:_files -/' \ - '-f[device with MBR]:device with MBR:_files -g "*(%b)"' \ - '-l[bootloader type]:bootloader type:(GRUB LILO)' && ret=0 - -case $state in - quoted_path) - local suf="/ \t\n" - [[ -n $compstate[quote] ]] && { suf="$compstate[quote]$suf"; compset -q; } - _files -r $suf && ret=0 - ;; - kernel_or_magic) - _tags kernel magic - while _tags; do - _requested magic expl "keyword" \ - compadd -- FAILSAFE && ret=0 - _requested kernel expl "path to kernel image" \ - _files && ret=0 - - (( ret )) || break - done - ;; -esac - -return ret diff --git a/Completion/Linux/Command/_namei b/Completion/Linux/Command/_namei new file mode 100644 index 000000000..6f3533eec --- /dev/null +++ b/Completion/Linux/Command/_namei @@ -0,0 +1,15 @@ +#compdef namei + +local ign + +(( $#words > 2 )) && ign='!(* -)' +_arguments -s -S \ + '(-x --mountpoints)'{-x,--mountpoints}"[mark mount point directories with a 'D']" \ + '(-m --modes -l --long)'{-m,--modes}'[show the permission bits of each file]' \ + '(-o --owners -l --long)'{-o,--owners}'[show owner and group of each file]' \ + '(-l --long -m --modes -o --owners -v --vertical)'{-l,--long}'[use long listing format (-m -o -v)]' \ + '(-n --nosymlinks)'{-n,--nosymlinks}"[don't follow symlinks]" \ + '(-v --vertical -l --long)'{-v,--vertical}'[align modes and owners vertically]' \ + "$ign"{-h,--help}'[display usage information]' \ + "$ign"{-V,--version}'[display version information]' \ + '*: :_files' diff --git a/Completion/Linux/Command/_opkg b/Completion/Linux/Command/_opkg index ddaefe1eb..f726a3e32 100644 --- a/Completion/Linux/Command/_opkg +++ b/Completion/Linux/Command/_opkg @@ -181,7 +181,7 @@ _opkg_dest_path() { _opkg_pkg_all() { local -a upd copts - zparseopts -a upd -D -E -update + zparseopts -a upd -D -E - -update copts=( "$@" ) { (( ! $#_opkg_cache_pkg_all )) || _cache_invalid opkg-pkg-all } && @@ -207,7 +207,7 @@ _opkg_pkg_all() { _opkg_pkg_inst() { local -a upd copts - zparseopts -a upd -D -E -update + zparseopts -a upd -D -E - -update copts=( "$@" ) { (( ! $#_opkg_cache_pkg_inst )) || _cache_invalid opkg-pkg-inst } && @@ -233,7 +233,7 @@ _opkg_pkg_inst() { _opkg_pkg_new() { local -a upd copts - zparseopts -a upd -D -E -update + zparseopts -a upd -D -E - -update copts=( "$@" ) { (( ! $#_opkg_cache_pkg_new )) || _cache_invalid opkg-pkg-new } && @@ -257,7 +257,7 @@ _opkg_pkg_new() { _opkg_pkg_upgr() { local -a upd copts - zparseopts -a upd -D -E -update + zparseopts -a upd -D -E - -update copts=( "$@" ) { (( ! $#_opkg_cache_pkg_upgr )) || _cache_invalid opkg-pkg-upgr } && diff --git a/Completion/Linux/Command/_selinux b/Completion/Linux/Command/_selinux index 22d78db7d..1b2c25468 100644 --- a/Completion/Linux/Command/_selinux +++ b/Completion/Linux/Command/_selinux @@ -148,6 +148,7 @@ case $service in '(-o --output -M --module-package)'{-o+,--output=}'[append output to file]:file:_files' '(-D --dontaudit)'{-D,--dontaudit}'[generate policy with dontaudit rules]' '(-R --reference)'{-R,--reference}'[use installed macros in generated policy]' + '(-C --cil)'{-C,--cil}'[generate CIL output]' '!(-R --reference -N --noreference)'{-N,--noreference} '(-v --verbose)'{-v,--verbose}'[explain generated output]' '(-e --explain)'{-e,--explain}'[fully explain generated output]' @@ -196,7 +197,7 @@ case $service in args+=( "${ign}(-)"{-V,--version}'[show policy versions created by this program]' '-m[build a policy module instead of a base module]' - '-c+[build a policy module targeting a modular policy version]:version (4-21)' + '-c+[build a policy module targeting a modular policy version]:version (4-22)' ) ;; @@ -548,7 +549,7 @@ case $service in ;; fcontext) args+=( - '(-e --equal)'{-e+,--equal=}'[substitute target path with sourcepath when generating default label]:equal' + '(-e --equal)'{-e+,--equal=}'[substitute target path with source path when generating default label]:equivalent path:_files' '(-f --ftype)'{-f+,--ftype=}'[specify file type]:file type:(( f\:regular\ file d\:directory diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index 2a1cfcb78..ac21c3bcb 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -13,23 +13,29 @@ _arguments -C -s \ "($info -r --resolve)"{-r,--resolve}'[resolve host addresses]' \ "($info -a --all -l --listening)"{-a,--all}'[display all sockets]' \ "($info -l --listening -a --all)"{-l,--listening}'[display listening sockets]' \ + "($info -B --bound-inactive)"{-B,--bound-inactive}'[display TCP bound but inactive sockets]' \ "($info -o --options -e --extended)"{-o,--options}'[show timer information]' \ "($info -e --extended -o --options)"{-e,--extended}'[show detailed information]' \ "($info -m --memory)"{-m,--memory}'[show socket memory usage]' \ "($info -p --processes)"{-p,--processes}'[show process using each socket]' \ + "($info -T --threads)"{-T,--threads}'[show thread using socket]' \ "($info -i --info)"{-i,--info}'[show internal TCP information]' \ "($info)--tipcinfo[show internal tipc socket information]" \ "($info -s --summary)"{-s,--summary}'[print summary statistics]' \ "($info)--tos[show tos and priority information]" \ + "($info)--cgroup[show cgroup information]" \ "($info -b --bpf)"{-b,--bpf}'[show bpf filter socket information]' \ + "($info)--bpf-maps[show all BPF socket-local storage maps]" \ + "($info)--bpf-map-id=[show a BPF socket-local storage map]:map ID" \ "($info -E --events)"{-E,--events}'[continually display sockets as they are destroyed]' \ - "($info -Z --context)"{-Z,--context}'[display process SELinux security contexts]' \ - "($info -z --contexts)"{-z,--contexts}'[display process and socket SELinux security contexts]' \ + "($info -Z --context)"{-Z,--context}'[display task SELinux security contexts]' \ + "($info -z --contexts)"{-z,--contexts}'[display task and socket SELinux security contexts]' \ "($info -N --net)"{-N,--net}'[switch to specified network namespace]:network namespace' \ "($info -4 --ipv4 -6 --ipv6)"{-4,--ipv4}'[display only IP version 4 sockets]' \ "($info -4 --ipv4 -6 --ipv6)"{-6,--ipv6}'[display only IP version 6 sockets]' \ "($info -0 --packet)"{-0,--packet}'[display PACKET sockets]' \ "($info -t --tcp)"{-t,--tcp}'[display TCP sockets]' \ + "($info -M --mptcp)"{-M,--mptcp}'[display only MPTCP sockets]' \ "($info -S --sctp)"{-S,--sctp}'[display SCTP sockets]' \ "($info -u --udp)"{-u,--udp}'[display UDP sockets]' \ "($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \ @@ -41,7 +47,9 @@ _arguments -C -s \ "($info -f --family)"{-f+,--family=}'[display sockets of specified type]:family:(inet inet6 link unix netlink vsock tipc xdp help)' \ "($info -K --kill)"{-K,--kill}'[forcibly close sockets, display what was closed]' \ "($info -H --no-header)"{-H,--no-header}'[suppress header line]' \ + "($info -Q --no-queues)"{-Q,--no-queues}'[suppress sending and receiving queue columns]' \ "($info -O --oneline)"{-O,--oneline}"[print socket's data on a single line]" \ + "($info)--inet-sockopt[show various inet socket options]" \ "($info -A --query --socket)"{-A+,--query=,--socket=}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram tipc' \ "($info -D)"{-D+,--diag=}'[dump raw info to file]:file:_files' \ "($info -F)"{-F+,--filter=}'[read filter information from a file]:file:_files' \ diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index 37e14b6d6..149a1dddb 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -23,9 +23,13 @@ _arguments -C -s \ '(-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]' \ + '--color=[control use of color]:color [auto]:(never always auto)' \ '(-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]' \ + '(-c --summary-only)*-k[obtain stack trace between each syscall]' \ + '(-c --summary-only -k)--stack-trace=-[obtain stack trace between each syscall]::symbol' \ + '(-c --summary-only)--stack-trace-frame-limit=[specify limit on stack trace frames to print]:frames [256]' \ '(-n --syscall-number)'{-n,--syscall-number}'[print syscall number]' \ + '(-N --arg-names)'{-N,--arg-names}'[print syscall argument names]' \ '(-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)]' \ @@ -51,11 +55,12 @@ _arguments -C -s \ '(-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 signalfd' \ + '(-c --summary-only -y -yy)--decode-fds=-[print information associated with file descriptors]::information [none]:_sequence compadd - none all path socket dev eventfd pidfd signalfd' \ '(-c --summary-only -Y)--decode-pids=[print information associated with process IDs]:information [none]:_sequence compadd - none comm pidns' \ '!(-c --summary-only -Y --decode-pids)--pidns-translation' \ '(-c --summary-only --decode-pids)-Y[print command names for PIDs]' \ - '(-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]' \ + '--always-show-pid' \ + '(-c --summary-only -C --summary -i --instruction-pointer -k --stack-trace --stack-trace-frame-limit -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)' \ @@ -66,6 +71,11 @@ _arguments -C -s \ '(-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]' \ + '--secontext=[print SELinux contexts]: : _values -s, format + "(none mismatch full)all[equivalent to full,mismatch]" + "(all none)full[print the full context instead of the type only]" + "(all none)mismatch[print expected context when actual is not matching]" + "(all none mismatch full)none[equivalent to not specifying the option at all]"' \ '--tips=-[show strace tips, tricks, and tweaks before exit]:tip [id\:random,format\:compact]' \ '(- 1 *)'{-V,--version}'[display version information]' \ '(-):command name: _command_names -e' \ @@ -87,7 +97,9 @@ case $state in 'status[trace system calls with given return status]:status:->status' \ '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 signalfd' \ + 'namespace=new[print namespace IDs that the tracee enters]' \ + 'decode-fds[print information associated with file descriptors]:information [none]:_sequence compadd - none all path socket dev eventfd pidfd signalfd' \ + 'secontext' \ 'decode-pids[print information associated with process IDs]:information [none]:_sequence compadd - none comm pidns' && ret=0 if [[ $state = status ]]; then _values -s , 'return status [all]' \ diff --git a/Completion/Linux/Command/_tracepath b/Completion/Linux/Command/_tracepath index f0f777d96..68a3d6ee6 100644 --- a/Completion/Linux/Command/_tracepath +++ b/Completion/Linux/Command/_tracepath @@ -1,9 +1,12 @@ #compdef tracepath tracepath6 _arguments -s -S \ + '(-6)-4[use IPv4]' \ + '(-4)-6[use IPv6]' \ '-n[print IP addresses numerically]' \ '-b[print both host names and IP addresses]' \ '-l+[set the initial packet length]:length (bytes)' \ '-m+[set maximum hops]:maximum [30]' \ '-p+[set initial destination port to use]:port:_ports' \ + '-V[display version information]' \ ':destination:_hosts' diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind index 6bf0e4450..638b29cf5 100644 --- a/Completion/Linux/Command/_valgrind +++ b/Completion/Linux/Command/_valgrind @@ -2,7 +2,7 @@ local curcontext="$curcontext" state line local -a cmd common_{own_malloc,read_varinfo,report_errors,partial} -local -a args args_{addrcheck,drd,memcheck,cachegrind,helgrind,lackey,massif,none,exp_{bbv,dhat,sgcheck}} +local -a args args_{{addr,mem}check,drd,{cache,call,hel}grind,lackey,massif,none,exp_{bbv,dhat,sgcheck}} cmd=( '1: : _command_names -e' @@ -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 @@ -124,7 +124,39 @@ 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_callgrind=( + '--callgrind-out-file=-[specify output file name]:file name [callgrind.out.%p]:_files' + '--dump-line=-[perform event counting at source line granularity]:enable [yes]:(yes no)' + '--dump-instr=-[perform event counting at instruction granularity]:enable [no]:(yes no)' + '--compress-strings=-[identify file and function names by numbers]:enable [yes]:(yes no)' + '--compress-pos=-[compress positions in profile dump]:enable [yes]:(yes no)' + '--compress-dumps=-[concatenate all dumps into same file]:enable [no]:(yes no)' + '--dump-every-bb=-[specify dump period in basic blocks]:blocks [0, never]' + '*--dump-before=-[dump when entering specified function]:function' + '*--zero-before=-[zero all costs when entering specified function]:function' + '*--dump-after=-[dump when leaving specified function]:function' + '--instr-atstart=-[do instrumentation at callgrind start]:enable [yes]:(yes no)' + '--collect-atstart=-[collect at process/thread start]:enable [yes]:(yes no)' + '*--toggle-collect=-[toggle collection on enter/leave specified function]:function' + '--collect-jumps=-[collect jumps]:enable [no]:(yes no)' + '--collect-bus=-[collect global bus events]:enable [no]:(yes no)' + '--collect-systime=-[collect system call time info]:enable [no]:(no yes msec usec nsec)' + '--separate-threads=-[separate data per thread]:enable [no]:(yes no)' + '--separate-callers=-[separate functions by call chain length]:length [0]' + '--separate-recs=-[separate function recursions up to level]:level [2]' + '--skip-plt=-[ignore calls to/from PLT sections]:enable [yes]:(yes no)' + '--skip-direct-rec=-[ignore direct recursio]:enable [yes]:(yes no)' + '*--fn-skip=-[ignore calls to/from specified function]:function' + '--branch-sim=-[collect branch prediction stats]:enable [no]:(yes no)' + '--cache-sim=-[collect cache stats]:enable [no]:(yes no)' + '--simulate-wb=-[count write-back events]:enable [no]:(yes no)' + '--simulate-hwpref=-[simulate hardware prefetch]:enable [no]:(yes no)' + '--cacheuse=-[collect cache block use]:enable [no]:(yes no)' + '--I1=-[set I1 cache manually]:size,assoc,line_size' + '--D1=-[set D1 cache manually]:size,assoc,line_size' ) args_helgrind=( @@ -170,7 +202,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=( @@ -217,7 +249,8 @@ _arguments -C ${(P)args} $cmd \ '--vgdb=-[activate gdbserver]:enable [yes]:(yes no full)' \ '--vgdb-error=-[invoke gdbserver after specified number of errors]:errors [999999999]:errors' \ '--vgdb-stop-at=-[invoke gdbserver for given events]:event:_sequence compadd - startup exit abexit valgrindabexit all none' \ - '--track-fds=-[track open file descriptors]:enable [no]:(yes no all)' \ + '--track-fds=-[track open file descriptors]:enable [no]:(yes no all bad)' \ + '--modify-fds=-[modify newly open file descriptors]:enable:(yes no high)' \ '--time-stamp=-[add timestamps to log messages]:enable:(yes no)' \ '--log-fd=-[log messages to specified file descriptor]:file descriptor:_file_descriptors' \ '--log-file=-[log messages to specified file with pid appended]:file:_files' \ |
