diff options
Diffstat (limited to 'Completion/Linux')
-rw-r--r-- | Completion/Linux/Command/_chattr | 42 | ||||
-rw-r--r-- | Completion/Linux/Command/_chrt | 99 | ||||
-rw-r--r-- | Completion/Linux/Command/_cryptsetup | 107 | ||||
-rw-r--r-- | Completion/Linux/Command/_ethtool | 446 | ||||
-rw-r--r-- | Completion/Linux/Command/_ionice | 35 | ||||
-rw-r--r-- | Completion/Linux/Command/_ipset | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_losetup | 65 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsattr | 11 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsblk | 1 | ||||
-rw-r--r-- | Completion/Linux/Command/_mii-tool | 7 | ||||
-rw-r--r-- | Completion/Linux/Command/_modutils | 1 | ||||
-rw-r--r-- | Completion/Linux/Command/_networkmanager | 373 | ||||
-rw-r--r-- | Completion/Linux/Command/_nmcli | 244 | ||||
-rw-r--r-- | Completion/Linux/Command/_ss | 7 | ||||
-rw-r--r-- | Completion/Linux/Command/_sshfs | 5 | ||||
-rw-r--r-- | Completion/Linux/Command/_sysstat | 70 | ||||
-rw-r--r-- | Completion/Linux/Command/_tracepath | 9 | ||||
-rw-r--r-- | Completion/Linux/Command/_tune2fs | 46 | ||||
-rw-r--r-- | Completion/Linux/Command/_valgrind | 4 | ||||
-rw-r--r-- | Completion/Linux/Command/_wipefs | 25 |
20 files changed, 1036 insertions, 563 deletions
diff --git a/Completion/Linux/Command/_chattr b/Completion/Linux/Command/_chattr new file mode 100644 index 000000000..bf46d8b89 --- /dev/null +++ b/Completion/Linux/Command/_chattr @@ -0,0 +1,42 @@ +#compdef chattr + +local ret=1 +local -a context line state state_descr +local -A opt_args val_args + +_arguments -s -S : \ + '-f[suppress most error messages]' \ + "-p+[set file's project number]:project number" \ + '-R[act recursively]' \ + '-V[output verbosely]' \ + "-v+[set file's version/generation number]:version/generation number" \ + '1: :->attrs' \ + '*: :_files' \ +&& ret=0 + +[[ $state == attrs ]] && +if compset -P '*[=+-]'; then + # These modes can't be changed with chattr: [EhINXZ] + _values -S '' attribute \ + 'A[no atime updates]' \ + 'a[append only]' \ + 'C[no copy on write]' \ + 'c[compressed]' \ + 'D[no synchronous directory updates]' \ + 'd[no dump]' \ + 'e[extent format]' \ + 'i[immutable]' \ + 'j[data journalling]' \ + 'P[project hierarchy]' \ + 'S[synchronous updates]' \ + 's[secure deletion]' \ + 'T[top of directory hierarchy]' \ + 't[no tail-merging]' \ + 'u[undeletable]' \ + && ret=0 +else + compset -P '*' + _values -S '' operator = + - && ret=0 +fi + +return ret diff --git a/Completion/Linux/Command/_chrt b/Completion/Linux/Command/_chrt index f82ec8b81..6789b66cf 100644 --- a/Completion/Linux/Command/_chrt +++ b/Completion/Linux/Command/_chrt @@ -1,61 +1,68 @@ #compdef chrt -local context state line +local curcontext="$curcontext" cmd="$words[1]" ret=1 +local -a state line expl typeset -A opt_args -_arguments \ +_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)*::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]' \ - {-v,--verbose}'[display status information]' \ - {-p,--pid}'[interpret args as process ID]' \ - '(-b --batch -f --fifo -o --other -r --rr)'{-b,--batch}'[set scheduling policy to SCHED_BATCH]' \ - '(-b --batch -f --fifo -o --other -r --rr)'{-f,--fifo}'[set scheduling policy to SCHED_FIFO]' \ - '(-b --batch -f --fifo -o --other -r --rr)'{-o,--other}'[set policy scheduling policy to SCHED_OTHER]' \ - '(-b --batch -f --fifo -o --other -r --rr)'{-r,--rr}'[set scheduling policy to SCHED_RR]' \ - '(* -)'{-m,--max}'[show minimum and maximum valid priorities, then exit]' \ - '*::command or priority:->cmd_or_prio' \ - && return 0 + + '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]' \ + + '(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 -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 _chrt_priority() { - local ty - if (( $+opt_args[-b] || $+opt_args[--batch] )) - then - ty=BATCH - elif (( $+opt_args[-f] || $+opt_args[--fifo] )) - then - ty=FIFO - elif (( $+opt_args[-o] || $+opt_args[--other] )) - then - ty=OTHER - else - ty=RR - fi - local range - range=${${"$(_call_program priorities chrt --max)"#*SCHED_$ty*: }%$'\n'*} - if [[ $range = 0/0 ]] - then - compadd 0 - else - _message -e priority "priority in the range $range" - fi + local ty + [[ -prefix - ]] && return 1 + if (( $+opt_args[policy--b] || $+opt_args[policy---batch] )); then + ty=BATCH + elif (( $+opt_args[policy--f] || $+opt_args[policy---fifo] )); then + ty=FIFO + elif (( $+opt_args[policy--o] || $+opt_args[policy---other] )); then + ty=OTHER + else + ty=RR + fi + local range + range=${${(M)${(f)"$(_call_program priorities $cmd --max)"}:#*_${ty}*}#*: } + if [[ $range = 0/0 ]]; then + _wanted priorites expl 'priority' compadd 0 + else + _message -e priorities "priority (range $range)" + fi } if (( $+opt_args[-p] || $+opt_args[--pid] )) then - if [[ $CURRENT -eq 1 ]] - then - _alternative \ - 'priority:priority:_chrt_priority' \ - 'processes:process IDs:_pids' - else - _pids - fi -elif [[ $CURRENT -eq 1 ]] -then - _chrt_priority + if (( CURRENT == 1 )); then + _alternative \ + 'priority:priority:_chrt_priority' \ + 'processes:process IDs:_pids' && ret=0 + else + _pids && ret=0 + fi +elif (( CURRENT == 1 )); then + _chrt_priority && ret=0 else - shift words - (( CURRENT-- )) - _normal + shift words + (( CURRENT-- )) + _normal && ret=0 fi + +return ret diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index 0e7a5d37e..ea7152ea1 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -3,47 +3,86 @@ local curcontext="$curcontext" ret=1 local -a actions state line expl -_arguments \ +_arguments -s \ '(-v --verbose)'{-v,--verbose}'[enable verbose mode]' \ '--debug[enable debug mode]' \ - '(-h --hash)'{-h,--hash}'[hash algorithm]:hash algorithm' \ - '(-c --cipher)'{-c,--cipher}'[set cipher]:cipher specification' \ + '(-c --cipher)'{-c+,--cipher=}'[set cipher]:cipher specification' \ + '(-h --hash)'{-h+,--hash=}'[hash algorithm]:hash algorithm' \ '(-y --verify-passphrase)'{-y,--verify-passphrase}'[query for password twice]' \ - '(-d --key-file)'{-d,--key-file}'[set keyfile]:key file:_files' \ - '(-l --keyfile-size)'{-l,--keyfile-size}'[set keyfile size]:size (bytes)' \ - '--new-keyfile-size[set new keyfile size (luksAddKey)]:size (bytes)' \ - '--master-key-file[set master key]:key file:_files' \ + '(-d --key-file)'{-d+,--key-file=}'[set keyfile]:key file:_files' \ + '--master-key-file=[set master key]:key file:_files' \ '--dump-master-key[dump luks master key]' \ + '(-s --key-size)'{-s+,--key-size=}'[set key size]:size (bits)' \ + '(-l --keyfile-size)'{-l+,--keyfile-size=}'[set keyfile size]:size (bytes)' \ + '--keyfile-offset=[specify number of bytes to skip in keyfile]:offset (bytes)' \ + '--new-keyfile-size=[set new keyfile size (luksAddKey)]:size (bytes)' \ + '--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' \ + '(-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]' \ + '(-i --iter-time)'{-i+,--iter-time=}'[set password processing duration]:duration (milliseconds)' \ + '(-q --batch-mode)'{-q,--batch-mode}"[don't ask for confirmation]" \ + '(-t --timeout)'{-t+,--timeout=}'[set password prompt timeout]:timeout (seconds)' \ + '--progress-frequency=[specify progress line update interval]:interval (seconds)' \ + '(-T --tries)'{-T+,--tries=}'[set maximum number of retries]:number of retries' \ + '--align-payload=[set payload alignment]:sectors' \ + '--header-backup-file=[specify file with LUKS header and keyslots backup]:file:_files' \ '(--use-urandom)--use-random[use /dev/random to generate volume key]' \ '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \ - '(-S --key-slot)'{-S,--key-slot}'[select key slot]:key slot' \ - '(-s --key-size)'{-s,--key-size}'[set key size]:size (bits)' \ - '(-b --size)'{-b,--size}'[force device size]:sectors' \ - '(-o --offset)'{-o,--offset}'[set start offset]:sectors' \ - '(-p --skip)'{-p,--skip}'[data to skip at beginning]:sectors' \ - '--readonly[set up read-only mapping]' \ - '(-i --iter-time)'{-i,--iter-time}'[set password processing duration]:duration (milliseconds)' \ - '(-q --batch-mode)'{-q,--batch-mode}'[do not ask for confirmation]' \ - '(-t --timeout)'{-t,--timeout}'[set password prompt timeout]:timeout (seconds)' \ - '(-T --tries)'{-T,--tries}'[set maximum number of retries]:number of retries' \ - '--align-payload[set payload alignment]:sectors' \ - '--uuid[set device UUID]:uuid' \ + '--shared[share device with another non-overlapping crypt segment]' \ + '--uuid=[set device UUID]:uuid' \ + '--allow-discards[allow discards (aka TRIM) requests for device]' \ + '--header=[device or file with separated LUKS header]:file:_files' \ + '--test-passphrase[do not activate device, just check passphrase]' \ + '--tcrypt-hidden[use hidden header (hidden TCRYPT device)]' \ + '--tcrypt-system[device is system TCRYPT drive (with bootloader)]' \ + '--tcrypt-backup[use backup (secondary) TCRYPT header]' \ + '--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)' \ + '--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]' \ + '--deferred[device removal is deferred until the last user closes it]' \ + '--pbkdf=[specify PBKDF algorithm for LUKS2]:algorithm:(argon2i argon2id pbkdf2)' \ + '--pbkdf-memory=[specify PBKDF memory cost limit]:limit (kilobytes)' \ + '--pbkdf-parallel=[specify PBKDF parallel cost]:threads' \ + '--pbkdf-force-iterations=[specify PBKDF iterations cost]:cost' \ + '--priority=[specify keyslot priority]:priority:(ignore normal prefer)' \ + '--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-no-journal[disable journal for integrity device]' \ + "--integrity-no-wipe[don't wipe device after format]" \ + "--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]' \ + '--persistent[set activation flags persistent for device]' \ + '--label=[set label for the LUKS2 device]:label' \ + '--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \ '(- : *)--version[show version information]' \ + '(- : *)'{-\?,--help}'[display help information]' \ + '(- : *)--usage[display brief usage]' \ ':action:->actions' \ '*::arguments:->action-arguments' && ret=0 case $state in actions) actions=( - 'create:create a mapping' - 'remove:remove an existing mapping' + 'open:open device with named mapping' + 'close:close device (remove mapping)' 'status:report mapping status' 'resize:resize an active mapping' + 'benchmark:benchmark cipher' + 'repair:try to repair on-disk metadata' + 'erase:erase all keyslots' + 'convert:convert LUKS from/to LUKS2 format' + 'config:set permanent configuration options for LUKS2' 'luksFormat:initialize a LUKS partition' - 'luksOpen:open LUKS partition' - 'luksClose:remove an existing mapping' - 'luksSuspend:suspend active device' - 'luksResume:resume suspended device' 'luksAddKey:add a new key' 'luksRemoveKey:remove a key' 'luksChangeKey:change a key' @@ -51,6 +90,9 @@ case $state in 'luksUUID:print/change device UUID' 'isLuks:check if device is a LUKS partition' 'luksDump:dump header information' + 'tcryptDump:dump TCRYPT device information' + 'luksSuspend:suspend LUKS device and wipe key' + 'luksResume:resume suspended LUKS device' 'luksHeaderBackup:store binary backup of headers' 'luksHeaderRestore:restore header backup' ) @@ -61,18 +103,21 @@ case $state in local mapping=':mapping:_path_files -W /dev/mapper' local device=':device:_files' case ${words[1]} in - create) args=( $mapping $device );; + create) args=( $mapping $device '--type=:type' );; + open) args=( $device $mapping '--type=:type' );; + (plain|luks|loopaes|tcrypt)Open) args=( $device $mapping '--type=:type' );; + benchmark) args=( '--cipher=:cipher' );; luksKillSlot) args=( $device ':key slot number' );; - luksOpen) args=( $device $mapping );; - remove|status|resize|luksClose|luksSuspend|luksResume) args=( $mapping );; - luks(AddKey|RemoveKey|DelKey|UUID|Dump)|isLuks) args=( $device );; + remove|status|resize|*lose|luksSuspend|luksResume) args=( $mapping );; + erase|convert|config|repair|(luks(AddKey|Erase|RemoveKey|DelKey|UUID|Dump)|isLuks)) + args=( $device ) + ;; luks(Format|AddKey|RemoveKey|ChangeKey)) args=( $device ':key file:_files' ) ;; luksHeader*) args=( $device '--header-backup-file:file:_files' );; *) - _default - return + _default && ret=0 ;; esac _arguments $args && ret=0 diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index 71f5ed3bf..52b8f0451 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -1,164 +1,290 @@ #compdef ethtool -local -a expl cmds +local curcontext="$curcontext" +local -a state line expl cmds +local -A opt_args -if [[ $CURRENT -ge 4 ]]; then - case $words[CURRENT-1] in - rx|tx) - [[ $words[2] = '-G' ]] && _message -e n 'number of ring entries' || _wanted -x onoff expl 'enabled' compadd off on - ;; - autoneg|adaptive-rx|adaptive-tx|raw|hex|sg|tso|ufo|gso) - _wanted -x onoff expl 'enabled' compadd off on - ;; - rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames|tx-usecs-irq|tx-frames-irq|stats-block-usecs|pkt-rate-low|rx-usecs-low|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|rx-mini|rx-jumbo|offset|length|magic|value|phyad|msglvl) - _message -e n 'number' - ;; - speed) - _wanted -x speed expl 'speed' compadd 10 100 1000 - ;; - duplex) - _wanted -x duplex expl 'duplex mode' compadd half full - ;; - port) - _wanted -x port expl 'device port' compadd tp aui bnc mii - ;; - advertise) - _values 'hexidecimal value (or a combination of the following)' \ - '0x001[10 half]' \ - '0x002[10 full]' \ - '0x004[100 half]' \ - '0x008[100 full]' \ - '0x010[1000 half(not supported by IEEE standards)]' \ - '0x020[1000 full]' \ - '0x8000[2500 full(not supported by IEEE standards)]' \ - '0x800[10000 full]' \ - '0x03F[auto]' - ;; - xcvr) - _wanted -x xcvr expl 'transceiver type' compadd internal external - ;; - wol) - _values -s '' 'Wake-on-LAN options' \ - '(d)p[wake on phy activity]' \ - '(d)u[wake on unicast messages]' \ - '(d)m[wake on multicast messages]' \ - '(d)b[wake on broadcast messages]' \ - '(d)a[wake on ARP]' \ - '(d)g[wake on MagicPacket(tm)]' \ - '(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \ - '(p u m b a g s)d[disable (wake on nothing)]' - ;; - sopass) - _message -e secureon 'password - 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc)' - ;; - file) - _wanted files expl 'raw register dump files' _files - ;; - *) - case $words[2] in - -A|--pause) - _values -S ' ' -w 'pause options' \ - 'autoneg[specify if pause autonegotiation is enabled]' \ - 'rx[specify if RX pause is enabled]' \ - 'tx[specify if TX pause is enabled]' - ;; - -C|--coalesce) - _values -S ' ' -w 'coalescing settings' \ - 'adaptive-rx' 'adaptive-tx' \ - 'rx-usecs' 'rx-frames' 'rx-usecs-irq' 'rx-frames-irq' \ - 'tx-usecs' 'tx-frames' 'tx-usecs-irq' 'tx-frames-irq' \ - 'stats-block-usecs' \ - 'pkt-rate-low' \ - 'rx-usecs-low' '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' - ;; - -G|--set-ring) - _values -S ' ' -w 'ring parameters' \ - 'rx[change number of ring entries for the RX ring]' \ - '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]' - ;; - -d|--register-dump) - _values -S ' ' -w 'register dump options' \ - 'hex[dump hex register data]' \ - 'raw[dump raw register data]' \ - 'file[use contents from file rather than device]' - ;; - -e|--eeprom-dump) - _values -S ' ' -w 'EEPROM dump options' \ - 'raw[dump raw EEPROM data]' \ - 'offset[dump certain portions of the EEPROM]' \ - 'length[dump certain portions of the EEPROM]' - ;; - -E|--change-eeprom) - _values -S ' ' -w 'EEPROM values' \ - 'magic[device-specific key]' \ - 'offset[select byte]' \ - 'value[new value]' - ;; - -K|--offload) - _values -S ' ' -w 'offload options' \ - 'rx[specify if RX checksumming is enabled]' \ - 'tx[specify if TX checksumming is enabled]' \ - 'sg[specify if scatter-gather is enabled]' \ - 'tso[specify if TCP segmentation offload is enabled]' \ - 'ufo[specify if UDP segmentation offload is enabled]' \ - 'gso[specify if generic segmentation offload is enabled]' - ;; - -p|--identify) - [[ $CURRENT -eq 4 ]] && _message -e length 'seconds' - ;; - -t|--test) - _values -S ' ' -w 'selftest option' \ - '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \ - '(offline)online:perform limited set of tests do not interrupting normal adapter operation]' - ;; - -s|--change) - _values -S ' ' -w 'change setting' \ - 'speed[set speed in Mb/s]' \ - 'duplex[set full or half duplex mode]' \ - 'port[select device port]' \ - 'autoneg[specify if autonegotiation is enabled]' \ - 'advertise[set the speed and duplex advertised by autonegotiation]' \ - 'phyad[PHY address]' \ - 'xcvr[select transceiver type]' \ - 'wol[set Wake-on-LAN options]' \ - 'sopass[set the SecureOn(tm) password]' \ - 'msglvl[set the driver message level]' - ;; - esac - ;; - esac -fi - -cmds=(-h -a -A -c -C -g -G -i -d -e -E -k -K -p -r -S -t -s - --help --show-pause --pause --show-coalesce --coalesce --show-ring - --set-ring --driver --register-dump --eeprom-dump --change-eeprom - --show-offload --offload --identify --negotiate --statistics --test --change) +_arguments -C \ + "1:interface:_net_interfaces" \ + '*: :->args' \ + + '(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]' \ + {-K,--features,--offload}'[change the offload parameters of the specified ethernet device]' \ + {-i,--driver}'[query the specified ethernet device for associated driver information]' \ + {-d,--register-dump}'[retrieve and prints a register dump for the specified ethernet device]' \ + {-e,--eeprom-dump}'[retrieve and prints an EEPROM dump for the specified ethernet device]' \ + {-E,--change-eeprom}'[change EEPROM byte for the specified ethernet device]' \ + {-r,--negotiate}'[restart auto-negotiation on the specified ethernet device]' \ + {-p,--identify}'[initiate adapter-specific action intended to identify the adapter by sight]' \ + {-t,--test}'[execute adapter selftest on the specified ethernet device]' \ + {-S,--statistics}'[query specified ethernet device for NIC- and driver-specific statistics]' \ + '--phy-statistics[show phy statistics]' \ + {-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]" \ + {-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]' \ + {-P,--show-permaddr}'[show permanent hardware address]' \ + {-w,--get-dump}'[get dump flag, data]' \ + {-W,--set-dump}'[set device dump flag]' \ + {-l,--show-channels}'[query channels]' \ + {-L,--set-channels}'[set channels]' \ + '--show-priv-flags[query private flags]' \ + '--set-priv-flags[set private flags]' \ + {-m,--dump-module-eeprom,--module-info}'[show module EEPROM information]' \ + '--show-eee[show EEE settings]' \ + '--set-eee[set EEE settings]' \ + '--set-phy-tunable[set PHY tunable]' \ + '--get-phy-tunable[get PHY tunable]' \ + '--reset[reset hardware components]' \ + '--show-fec[query device for forward error correction support]' \ + '--set-fec[configure forward error correction for device]' && return -_arguments \ - "($cmds)1:interface:_net_interfaces" \ - "($cmds 1)"{-h,--help}'[shows a short help message]' \ - "($cmds)"{-a,--show-pause}'[queries the specified ethernet device for pause parameter information]' \ - "($cmds)"{-A,--pause}'[change the pause parameters of the specified ethernet device]' \ - "($cmds)"{-c,--show-coalesce}'[queries the specified ethernet device for coalescing information]' \ - "($cmds)"{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \ - "($cmds)"{-g,--show-ring}'[queries the specified ethernet device for RX/TX ring parameter information]' \ - "($cmds)"{-G,--set-ring}'[change the RX/TX ring parameters of the specified ethernet device]' \ - "($cmds)"{-i,--driver}'[queries the specified ethernet device for associated driver information]' \ - "($cmds)"{-d,--register-dump}'[retrieves and prints a register dump for the specified ethernet device]' \ - "($cmds)"{-e,--eeprom-dump}'[retrieves and prints an EEPROM dump for the specified ethernet device]' \ - "($cmds)"{-E,--change-eeprom}'[changes EEPROM byte for the specified ethernet device]' \ - "($cmds)"{-k,--show-offload}'[queries the specified ethernet device for offload information]' \ - "($cmds)"{-K,--offload}'[change the offload parameters of the specified ethernet device]' \ - "($cmds)"{-p,--identify}'[initiates adapter-specific action intended to identify the adapter by sight]' \ - "($cmds)"{-r,--negotiate}'[restarts auto-negotiation on the specified ethernet device]' \ - "($cmds)"{-S,--statistics}'[queries the specified ethernet device for NIC- and driver-specific statistics]' \ - "($cmds)"{-t,--test}'[executes adapter selftest on the specified ethernet device]' \ - "($cmds)"{-s,--change}'[allows changing some or all settings of the specified ethernet device]' \ - '*:' && ret=0 +if [[ -n $state ]]; then + case $words[CURRENT-1] in + rx|tx) + if (( $+opt_args[cmds--G] + $+opt_args[cmds---set-ring] )); then + _message -e numbers 'number of ring entries' + elif (( $+opt_args[cmds--L] + $+opt_args[cmds---set-channels] )); then + _message -e numbers 'number of channels' + else + _wanted onoff expl 'enabled' compadd off on + fi + ;; + autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift) + _wanted onoff expl 'enabled' compadd off on + ;; + rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames) ;& + tx-usecs-irq|tx-frames-irq|stats-block-usecs|pkt-rate-low|rx-usecs-low) ;& + 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|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|delete) ;& + other|combined|tx-timer|count) + _message -e numbers 'number' + ;; + speed) + _wanted -x speed expl 'speed' compadd 10 100 1000 + ;; + duplex) + _wanted duplex expl 'duplex mode' compadd half full + ;; + port) + _wanted port expl 'device port' compadd tp aui bnc mii fibre + ;; + advertise) + _values 'hexadecimal value (or a combination of the following)' \ + '0x001[10 half]' \ + '0x002[10 full]' \ + '0x004[100 half]' \ + '0x008[100 full]' \ + '0x010[1000 half(not supported by IEEE standards)]' \ + '0x020[1000 full]' \ + '0x8000[2500 full(not supported by IEEE standards)]' \ + '0x800[10000 full]' \ + '0x03F[auto]' + ;; + xcvr) + _wanted xcvr expl 'transceiver type' compadd internal external + ;; + wol) + _values -s '' 'Wake-on-LAN option' \ + '(d)p[wake on phy activity]' \ + '(d)u[wake on unicast messages]' \ + '(d)m[wake on multicast messages]' \ + '(d)b[wake on broadcast messages]' \ + '(d)a[wake on ARP]' \ + '(d)g[wake on MagicPacket(tm)]' \ + '(d)s[enable SecureOn(tm) password for MagicPacket(tm)]' \ + '(p u m b a g s)d[disable (wake on nothing)]' + ;; + sopass) + _message -e secureon 'password - 6 bytes in ethernet MAC hex format (xx:yy:zz:aa:bb:cc)' + ;; + data|file) + _wanted files expl 'file' _files + ;; + rx-flow-hash) + _wanted flow-types expl 'flow type' compadd {tcp,udp,ah,esp,sctp}{4,6} + ;; + rule) + _message -e ids 'rule id' + ;; + flow-type) + _wanted flow-types expl 'flow type' compadd ether {tcp,udp,ah,esp,sctp}{4,6} + ;; + src|src-ip|dst|dst-ip|dst-mac) + _message -e addresses address + ;; + m) + _message -e masks mask + ;; + hkey) + _message -e keys expl 'hash key' + ;; + hfunc) + _message -e functions expl 'hash function' + ;; + flags) + _message -e masks expl mask + ;; + encoding) + _wanted encodings expl encoding compadd auto off rs baser + ;; + *) + case $words[2] in + -A|--pause) + _values -S ' ' -w 'pause parameter' \ + 'autoneg[specify if pause autonegotiation is enabled]' \ + 'rx[specify if RX pause is enabled]' \ + 'tx[specify if TX pause is enabled]' + ;; + -C|--coalesce) + _wanted settings expl 'coalescing setting' compadd -F line -M 'r:|-=* r:|=*' - \ + adaptive-{r,t}x {r,t}x-{usecs,frames}{,-irq,-high,-low} \ + stats-block-usecs pkt-rate-{low,high} sample-interval + ;; + -G|--set-ring) + _values -S ' ' -w 'ring parameter' \ + 'rx[change number of ring entries for the RX ring]' \ + '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]' + ;; + -d|--register-dump) + _values -S ' ' -w 'option' \ + 'hex[dump hex register data]' \ + 'raw[dump raw register data]' \ + 'file[use contents from file rather than device]' + ;; + -e|--eeprom-dump) + _values -S ' ' -w 'option' \ + 'raw[dump raw EEPROM data]' \ + 'offset' 'length' + ;; + -E|--change-eeprom) + _values -S ' ' -w 'option' \ + 'magic[device-specific key]' \ + 'offset' 'length' + 'value[new value]' + ;; + -K|--features|--offload) + if (( CURRENT % 2 )); then + _wanted values expl enable compadd on off + else + _wanted features expl feature compadd -F line - \ + ${${${${(f)"$(_call_program features $words[1] -k $line[1])"}%%:*}#$'\t'}[2,-1]} \ + rx tx sg tso ufo gso gro rxvlan txvlan ntuple rxhash + fi + ;; + -p|--identify) + (( CURRENT = 4 )) && _message -e length 'duration (seconds)' + ;; + -t|--test) + _values -S ' ' -w 'test mode' \ + '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \ + '(offline)online:perform limited set of tests without interrupting normal adapter operation]' \ + 'external_lb[perform full set of tests plus external-loopback test]' + ;; + -s|--change) + if (( ! $words[(I)msglvl] )); then + _values -S ' ' -w 'generic option' \ + 'speed[set speed in Mb/s]' \ + 'duplex[set full or half duplex mode]' \ + 'port[select device port]' \ + 'autoneg[specify if autonegotiation is enabled]' \ + 'advertise[set the speed and duplex advertised by autonegotiation]' \ + 'phyad[PHY address]' \ + 'xcvr[select transceiver type]' \ + 'wol[set Wake-on-LAN options]' \ + 'sopass[set the SecureOn(tm) password]' \ + 'msglvl[set the driver message level]' + elif (( (CURRENT - $words[(I)msglvl]) % 2 )); then + [[ -prefix [^0-9]## ]] || _message -e numbers number + _wanted flags expl 'message type flag' compadd drv probe link timer \ + if{down,up} rx_{err,status} tx_{err,queued,done} intr pktdata hw wol + else + _wanted onoff expl 'enabled' compadd off on + fi + ;; + -n|-u|--show-nfc|--show-ntuple) + _wanted options expl option compadd -F line - rx-flow-hash rule + ;; + -N|-U|--config-nfc|--config-ntuple) + if [[ $words[CURRENT-2] = rx-flow-hash ]]; then + _values -S ' ' 'rx packet hash' \ + 'm[layer 2 destination address]' \ + 'v[VLAN tag]' \ + 't[layer 3 protocol field]' \ + 's[IP source address]' \ + 'd[IP destination address]' \ + 'f[bytes 0 and 1 of the Layer 4 header]' \ + 'n[bytes 2 and 3 of the Layer 4 header]' \ + 'r[discard all packets of this flow type]' + else + _wanted options expl option compadd -F line - rx-flow-hash flow-type \ + delete src dst proto src-ip dst-ip tos m tclass l4proto src-port \ + dst-port spi l4data vlan-etype vlan user-def dst-mac action vf \ + queue loc + fi + ;; + -X|--set-rxfh-indir|--rxfh) + _values -S ' ' -w 'option' \ + '(weight default)equal' \ + '(equal default)weight' \ + '(equal weight)default' \ + hkey hfunc + ;; + -f|--flash) + if (( CURRENT = 4 )); then + _files + else + _message -e regions region + fi + ;; + -w|--get-dump) + _wanted options expl option compadd data + ;; + -L|--set-channels) + _wanted options expl option compadd -F line - rx tx other combined + ;; + --set-priv-flags) + if (( CURRENT % 2 )); then + _wanted values expl enable compadd on off + else + _message -e flags 'private flag' + fi + ;; + -m|--dump-module-eeprom|--module-info) + _wanted options expl option compadd -F line - raw hex offset length + ;; + --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 + ;; + --get-phy-tunable) + _wanted options expl tunable compadd downshift + ;; + --reset) + _wanted components expl component compadd flags dedicated all \ + {mgmt,irq,dma,filter,offload,mac,phy,ram,ap}{,-shared} + ;; + --set-fec) + _wanted options expl tunable compadd -F line - encoding + ;; + esac + ;; + esac +fi diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice index a3d49ec99..d64f1c496 100644 --- a/Completion/Linux/Command/_ionice +++ b/Completion/Linux/Command/_ionice @@ -1,12 +1,35 @@ #compdef ionice -_arguments \ - '(* -)-h[display usage information]' \ - '(*)-p[interpret args as process ID]:pid:_pids' \ - '-c+[scheduling class]:class:(( 1\:realtime 2\:best-effort 3\:idle ))' \ - '-n+[scheduling class priority]:class-priority:(( +local curcontext="$curcontext" state line expl ret=1 +local -A opt_args + +_arguments -C -s -S \ + '(H -c --class)'{-c+,--class=}'[scheduling class]:class:((0\:none 1\:realtime 2\:best-effort 3\:idle))' \ + '(H -m --classdata)'{-n+,--classdata=}'[scheduling class priority]:class-priority:(( 0\:high\ priority {6..1}\: 7\:low\ priority ))' \ - '*::command:_normal' + '(H -t --ignore)'{-t,--ignore}'[ignore failures]' \ + '(H)*:: :->args' \ + + 'H' \ + '(- *)'{-V,--version}'[display version information]' \ + '(- *)'{-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)'{-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' + elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then + _message -e uids 'user id' + else + _normal && ret=0 + fi +fi + +return ret diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset index 0d6afc08e..d05f13caf 100644 --- a/Completion/Linux/Command/_ipset +++ b/Completion/Linux/Command/_ipset @@ -1,7 +1,7 @@ #compdef ipset local offset=0 -local -a args from_to hash cmds listopts +local -a args from_to hash cmds listopts addopts _set_types () { _values -S \ "Set type" \ diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup index 359a9e0ea..9cfaaf5bf 100644 --- a/Completion/Linux/Command/_losetup +++ b/Completion/Linux/Command/_losetup @@ -1,28 +1,45 @@ -#compdef losetup -# based on util-linux 2.26.2 +#lcompdef losetup -value-,LOOPDEV_DEBUG,-default- -_arguments -S -A '-*' \ +if [[ $service = *LOOPDEV_DEBUG* ]]; then + local expl + _wanted values expl value compadd all + return +fi + +local device offset + +device='1:device:_files -g "/dev/loop<->"' +offset=( {-o,--offset}'+[specify data start is offset]:offset (bytes)' ) + +_arguments -s -S \ + - '(H)'\ + {-V,--version}'[display version information]' \ + {-h,--help}'[display help]' \ + - 'info' \ + '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ + '(-o --offset -a --all)'{-a,--all}'[show the status of all loop devices]' \ + '(-O --output)'{-O+,--output=}'[specify columns to be printed with --list]:column:_sequence -s , compadd - name autoclear back-file back-ino back-maj\:min maj\:min offset partscan ro sizelimit dio log-sec' \ + '(-J --json --raw -O --output -n --noheadings)'{-J,--json}'[use JSON --list output format]' \ '(-l --list)'{-l,--list}'[list currently used loop devices]' \ - '(-n --noheadings)'{-n,--noheadings}'[do not print heading for --list output]' \ - '(-d --delete --detach -o --offset -a --all)'{-o,--offset}'+[specify data start is offset]:offset (bytes)' \ - '(-O --output)'{-O,--output}'[specify columns to be printed with --list]:column: _values -s , column name sizelimit offset autoclear ro back-file' \ + '(-J --json)--raw[raw output format]' \ + '(-n --noheadings -J --json)'{-n,--noheadings}"[don't print headings in --list output]" \ + - '(resize)' \ + {-c,--set-capacity}'[reread the size of the file associated with the loop device]' \ + - 'detach' \ + '(-)'{--delete,--detach,-d}'[detach from specified loop device]' \ + "$device" \ + - '(detach-all)' \ + {-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]' \ + '(-L --nooverlap)'{-L,--nooverlap}'[avoid possible conflict between devices]' \ '(-P --partscan)'{-P,--partscan}'[scan the partition table of newly created loop devices]' \ - '--raw[raw output format]' \ + '--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]' \ - '(-v --verbose)'{-v,--verbose}'[verbose mode]' \ - '(-V --version)'{-V,--version}'[display version information]' \ - '(-h --help)'{-h,--help}'[display help]' \ - '1:device:_files -g "/dev/loop<->"' \ - '(-d --delete --detach)2:file:_files' \ - - '(set1)' \ - '(-o --offset)'{-a,--all}'[show the status of all loop devices]' \ - - '(set2)' \ - {-c,--set-capacity}'[reread the size of the file associated with the loop device]' \ - - '(set3)' \ - '(- 2)'{--delete,--detach,-d}'[detach from specified loop device]' \ - - '(set4)' \ - '(-D --detach-all)'{-D,--detach-all}'[detach all associated loop devices]' \ - - '(set5)' \ - {-f,--find}'[find the first unused loop device]' \ - - '(set6)' \ - {-j,--associated}'[show the status of all loop devices associated with an file]: : _files' + '1: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/_lsattr b/Completion/Linux/Command/_lsattr new file mode 100644 index 000000000..def0bd3d9 --- /dev/null +++ b/Completion/Linux/Command/_lsattr @@ -0,0 +1,11 @@ +#compdef lsattr + +_arguments -s -S : \ + '-a[show all files, including hidden ones]' \ + '-d[list directory entries instead of contents]' \ + '-l[use long option names]' \ + "-p[show file's project number]" \ + '-R[act recursively]' \ + '-V[display version information]' \ + "-v[show file's version/generation number]" \ + '*: :_files' diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk index c8fbb27c7..f37305445 100644 --- a/Completion/Linux/Command/_lsblk +++ b/Completion/Linux/Command/_lsblk @@ -29,6 +29,7 @@ _arguments -C -s -S \ '(H)'{-i,--ascii}'[output ascii characters only]' \ '(H)'{-J,--json}'[use JSON output format]' \ '(H)'{-l,--list}'[use list format output]' \ + '(H)'{-t,--tree}'[use tree format output]' \ '(H)'{-P,--pairs}'[use key="value" output format]' \ '(H)'{-r,--raw}'[use raw output format]' \ + 'H' \ diff --git a/Completion/Linux/Command/_mii-tool b/Completion/Linux/Command/_mii-tool index 8da6da69d..72c47a479 100644 --- a/Completion/Linux/Command/_mii-tool +++ b/Completion/Linux/Command/_mii-tool @@ -1,12 +1,13 @@ #compdef mii-tool -_arguments -s \ - '(-V --version)'{-V,--version}'[display version information]' \ +_arguments -s -S \ + '(- *)'{-V,--version}'[display version information]' \ '(-v --verbose)'{-v,--verbose}'[verbose output]' \ '(-R --reset)'{-R,--reset}'[reset MII to poweron state]' \ '(-r --restart)'{-r,--restart}'[restart autonegotiation]' \ '(-w --watch)'{-w,--watch}'[monitor for link status changes]' \ '(-l --log)'{-l,--log}'[write events to syslog]' \ - '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:medium:_values -s , medium 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT' \ + '(-A --advertise)'{-A,--advertise=}'[advertise only specified media]:medium:_values -s , medium 1000baseTx-HD 1000baseTx-FD 100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 1000baseTx 100baseTx 10baseT' \ '(-F --force)'{-F,--force=}'[force specified medium]:medium:(100baseT4 100baseTx-FD 100baseTx-HD 10baseT-FD 10baseT-HD 100baseTx 10baseT)' \ + '(-p --phy)'{-p,--phy=}'[set PHY (MII address) to report]:MII address' \ '*:interface:_net_interfaces' diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index 5aa4c9cc7..9a37fcae1 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -119,6 +119,7 @@ _modutils() { while _tags; do _requested files expl "module file" _files -g '*.ko(-.)' && ret=0 _requested modules expl module compadd -a modules && ret=0 + (( ret )) || break done ;; diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager new file mode 100644 index 000000000..881445abb --- /dev/null +++ b/Completion/Linux/Command/_networkmanager @@ -0,0 +1,373 @@ +#compdef nmcli + +# compatible with NetworkManager 1.8.4 + +_networkmanager() { + local curcontext="$curcontext" state line + + _arguments -C \ + '(-p -pretty -t -terse)-t'{,erse}'[terse output]' \ + '(-p -pretty -t -terse)-p'{,retty}'[pretty output]' \ + '(-m -mode)-m'{,ode}'[output mode]:mode:(tabular multiline)' \ + '(-c -colors)-c'{,olors}'[whether to use colors in output]:value:(auto yes no)' \ + '(-f -fields)-f'{,ields}'[specify fields to output]:field:_nm_fields' \ + '(-f -fields -g -get-values -m -mode -p -pretty -t -terse)-g'{,et-values}'[shortcut for -m tabular -t -f]:field:_nm_fields' \ + '(-e -escape)-e'{,scape}'[escape column separators in values]:value:(yes no)' \ + '(-a -ask)-a'{,sk}'[ask for missing parameters]' \ + '(-s -show-secrets)-s'{,how-secrets}'[allow passwords to be displayed]' \ + '(-w -wait)-w'{,ait}'[set time limit on wait for operations to finish]:timeout (seconds)' \ + '(- *)-v'{,ersion}'[show program version]' \ + '(- *)-h'{,elp}'[print help]' \ + '1:command:(general networking radio connection device agent monitor help)' \ + '*::arg:->args' + + case $line[1] in + g*) _nm_general ;; + n*) _nm_networking ;; + r*) _nm_radio ;; + c*) _nm_connection ;; + d*) _nm_device ;; + a*) _nm_agent ;; + esac +} + +_nm_fields() { + _values -s , 'field to output' \ + all common \ + RUNNING VERSION STATE STARTUP CONNECTIVITY NETWORKING WIFI-HW WIFI WWAN-HW WWAN \ + NAME UUID TYPE TIMESTAMP TIMESTAMP-REAL AUTOCONNECT AUTOCONNECT-PRIORITY READONLY DBUS-PATH ACTIVE DEVICE STATE ACTIVE-PATH SLAVE \ + DEVICE CONNECTION CON-UUID CON-PATH BSSID SSID MODE CHAN RATE SIGNAL BARS SECURITY +} + +_nm_general() { + _arguments "1:command:(status hostname permissions logging help)" + # TODO: provide completions for logging +} + +_nm_networking() { + local curcontext="$curcontext" state line + + _arguments -C \ + "1:command:(on off connectivity help)" \ + "*::arg:->args" + + case $line[1] in + c*) _nm_networking_connectivity ;; + esac +} + +_nm_networking_connectivity() { + _arguments "1:flag:(check)" +} + +_nm_radio() { + _arguments \ + "1:type:(all wifi wwan help)" \ + "2:switch:(on off)" +} + +_nm_connection() { + local curcontext="$curcontext" state line + + _arguments -C \ + "1:command:(show up down add modify clone edit delete monitor reload load import export help)" \ + "*::arg:->args" + + case $line[1] in + s*) _nm_connection_show ;; + u*) _nm_connection_up ;; + d*) _nm_connection_down ;; + # TODO: a*) _nm_connection_add ;; + m*) _nm_connection_modify ;; + c*) _nm_connection_clone ;; + e*) _nm_connection_edit ;; + de*) _nm_connection_delete ;; + mon*) _nm_connection_monitor ;; + l*) _nm_connection_load ;; + i*) _nm_connection_import ;; + ex*) _nm_connection_export ;; + esac +} + +_nm_connection_show() { + # TODO: add support for --order + _arguments \ + "--active" \ + "1:connection:_nm_connection_specs" +} + +_nm_connection_up() { + # TODO: add support for ifname, ap and passwd-file parameters + _arguments "1:connection:_nm_connection_specs" +} + +_nm_connection_down() { + _arguments "1:connection:_nm_connection_specs" +} + +_nm_connection_modify() { + # TODO: add support for options and properties + _arguments \ + "--temporary" \ + "1:connection:_nm_connection_specs" +} + +_nm_connection_clone() { + _arguments \ + "--temporary" \ + "1:connection:_nm_connection_specs" \ + "2:new name" +} + +_nm_connection_edit() { + # TODO: add support for adding new connections (type and con-name parameters) + _arguments "1:connection:_nm_connection_specs" +} + +_nm_connection_delete() { + _arguments "*:connection:_nm_connection_specs" +} + +_nm_connection_monitor() { + _arguments "*:connection:_nm_connection_specs" +} + +_nm_connection_load() { + _files +} + +_nm_connection_import() { + _arguments \ + "--temporary" \ + "1: :(type)" \ + "2:type:(vpnc openvpn pptp openconnect openswan libreswan ssh l2tp iodine)" \ + "3: :(file)" \ + "4:file:_files" +} + +_nm_connection_export() { + _arguments \ + "1:connection:_nm_connection_specs" \ + "2:file:_files" +} + +_nm_connection_specs() { + # TODO: add support for uuids and D-Bus paths + _nm_connection_ids +} + +_nm_connection_ids() { + local -a con_ids + con_ids=(${(f)"$(_call_program nmcli nmcli -t -f name connection)"}) + _describe 'select connection' con_ids +} + +_nm_device() { + local curcontext="$curcontext" state line + + _arguments -C \ + "1:command:(status show set connect reapply modify disconnect delete monitor wifi lldp help)" \ + "*::arg:->args" + + case $line[1] in + sh*) _nm_device_show ;; + se*) _nm_device_set ;; + c*) _nm_device_connect ;; + r*) _nm_device_reapply ;; + mod*) _nm_device_modify ;; + d*) _nm_device_disconnect ;; + de*) _nm_device_delete ;; + m*) _nm_device_monitor ;; + w*) _nm_device_wifi ;; + l*) _nm_device_lldp ;; + esac +} + +_nm_device_show() { + _arguments "1:interface:_nm_device_ifnames" +} + +_nm_device_set() { + # TODO: allow specifying both options, and in any order + _arguments \ + "1:interface:_nm_device_ifnames" \ + "2:property:(autoconnect managed)" \ + "3:switch:(yes no)" +} + +_nm_device_connect() { + _arguments "1:interface:_nm_device_ifnames" +} + +_nm_device_reapply() { + _arguments "1:interface:_nm_device_ifnames" +} + +_nm_device_modify() { + # TODO: add support for settings + _arguments "1:interface:_nm_device_ifnames" +} + +_nm_device_disconnect() { + _arguments "*:interface:_nm_device_ifnames" +} + +_nm_device_delete() { + _arguments "*:interface:_nm_device_ifnames" +} + +_nm_device_monitor() { + _arguments "*:interface:_nm_device_ifnames" +} + +_nm_device_wifi() { + local curcontext="$curcontext" state line + + _arguments -C \ + "1:command:(list connect hotspot rescan)" \ + "*::arg:->args" + + case $line[1] in + l*) _nm_device_wifi_list ;; + c*) _nm_device_wifi_connect ;; + ho*) _nm_device_wifi_hotspot ;; + r*) _nm_device_wifi_rescan ;; + esac +} + +_nm_device_wifi_list() { + # TODO: support bssid on its own + _arguments \ + "1: :(ifname)" \ + "2:interface:_nm_device_ifnames" \ + "3: :(bssid)" \ + "4:bssid:_nm_device_wifi_bssids" +} + +_nm_device_wifi_connect() { + local curcontext="$curcontext" state line + + _arguments -C \ + "1:ssid:_nm_device_wifi_ssids" \ + "*::arg:->args" + + if [[ -n $line[1] ]]; then + _nm_device_wifi_connect_opts + fi +} + +_nm_device_wifi_connect_opts() { + # TODO: there must be a cleaner way to implement this + local curcontext="$curcontext" state line + + _arguments -C \ + "1:property:(password wep-key-type ifname bssid name private hidden)" \ + "*::arg:->args" + + local min_line_len=2 + case $line[-2] in + password) + _arguments -C "1:password" "*::arg:->args" + ;; + wep-key-type) + _arguments -C "1:wep key type:(key phrase)" "*::arg:->args" + ;; + ifname) + _arguments -C "1:device:_nm_device_ifnames" "*::arg:->args" + ;; + bssid) + _arguments -C "1:bssid:_nm_device_wifi_bssids" "*::arg:->args" + ;; + name) + _arguments -C "1:name" "*::arg:->args" + ;; + private) + _arguments -C "1:private:(yes no)" "*::arg:->args" + ;; + hidden) + _arguments -C "1:hidden:(yes no)" "*::arg:->args" + ;; + *) + min_line_len=1 + ;; + esac + if [[ $#line > $min_line_len ]]; then + _nm_device_wifi_connect_opts + fi +} + +_nm_device_wifi_hotspot() { + local curcontext="$curcontext" state line + + _arguments -C \ + "1:property:(ifname con-name ssid band channel password)" \ + "*::arg:->args" + + local min_line_len=2 + case $line[-2] in + ifname) + _arguments -C "1:device:_nm_device_ifnames" "*::arg:->args" + ;; + con-name) + _arguments -C "1:connection name" "*::arg:->args" + ;; + ssid) + _arguments -C "1:ssid" "*::arg:->args" + ;; + band) + _arguments -C "1:band:(a bg)" "*::arg:->args" + ;; + channel) + _arguments -C "1:channel" "*::arg:->args" + ;; + password) + _arguments -C "1:password" "*::arg:->args" + ;; + *) + min_line_len=1 + ;; + esac + if [[ $#line > $min_line_len ]]; then + _nm_device_wifi_hotspot + fi +} + +_nm_device_wifi_rescan() { + # TODO: support ssid on its own and multiple ssids + _arguments \ + "1: :(ifname)" \ + "2:interface:_nm_device_ifnames" \ + "3: :(ssid)" \ + "4:ssid:_nm_device_wifi_ssids" +} + +_nm_device_wifi_bssids() { + local -a bssids + bssids=(${(f)"$(_call_program nmcli nmcli -t -f bssid device wifi list)"}) + _describe 'select network' bssids +} + +_nm_device_wifi_ssids() { + local -a ssids + ssids=(${(f)"$(_call_program nmcli nmcli -t -f ssid device wifi list)"}) + _describe 'select network' ssids +} + +_nm_device_lldp() { + _arguments \ + "1: :(list)" \ + "2: :(ifname)" \ + "3:interface:_nm_device_ifnames" +} + +_nm_device_ifnames() { + local -a ifnames + ifnames=(${(f)"$(_call_program nmcli nmcli -t -f device device)"}) + _describe 'select device' ifnames +} + +_nm_agent() { + _arguments "1:type:(secret polkit all help)" +} + +_networkmanager "$@" diff --git a/Completion/Linux/Command/_nmcli b/Completion/Linux/Command/_nmcli deleted file mode 100644 index a6b97a36c..000000000 --- a/Completion/Linux/Command/_nmcli +++ /dev/null @@ -1,244 +0,0 @@ -#compdef nmcli - -local context state line expl -typeset -A opt_args - -if [[ -z $_nmcli_version ]]; then - _nmcli_version="${"$(_call_program nmcli $words[1] --version)"##*version }" -fi - -(( $+functions[_nmcli_is_running] )) || _nmcli_is_running() { - [[ $(_call_program nmcli $words[1] -f running nm) != *'not running'* ]] -} - -(( $+functions[_nmcli_con_ids] )) || _nmcli_con_ids() { - _nmcli_is_running || return - local -a con_ids - con_ids=(${(f)"$(_call_program nmcli $words[1] -f name con)"}) - con_ids=(${con_ids[2,-2]}) - con_ids=(${con_ids[@]%%\ ##}) - _describe 'select connection' con_ids -} - -(( $+functions[_nmcli_con_uuids] )) || _nmcli_con_uuids() { - _nmcli_is_running || return - local -a con_uuids - con_uuids=(${(f)"$(_call_program nmcli $words[1] -f uuid con)"}) - con_uuids=(${con_uuids[2,-2]}) - con_uuids=(${con_uuids[@]%%\ ##}) - _describe 'select connection' con_uuids -} - -(( $+functions[_nmcli_objects] )) || _nmcli_objects() { - local -a objects_array - objects_array=( - 'nm:NetworkManager status' - 'con:NetworkManager connections' - 'dev:devices managed by NetworkManager' - ) - _describe 'nmcli object' objects_array -} - -(( $+functions[_nmcli_nm] )) || _nmcli_nm() { - local -a nm_array - nm_array=( - 'status:show overall status of NetworkManager' - 'enable:get status or enable/disable networking' - 'sleep:get sleep status or put to sleep/awake NetworkManager' - 'wifi:inquire or set status of WiFi in NetworkManager' - 'wwan:inquire or set status of WWAN in NetworkManager' - ) - _describe 'inquire and change state of NetworkManager' nm_array -} - -(( $+functions[_nmcli_con] )) || _nmcli_con() { - local -a con_array - con_array=( - 'list:list configured connections' - 'status:print status of active connections' - 'up:activate a connection' - 'down:deactivate a connection' - ) - if [[ $_nmcli_version == 0.9.[1-9]* ]]; then - con_array[5]="delete:delete a connection" - fi - _describe "get information about NetworkManager's connections" con_array -} - -(( $+functions[_nmcli_con_list] )) || _nmcli_con_list() { - local -a con_list_array - con_list_array=( - 'id:get details on connection specified by id' - 'uuid:get details on connection specified by uuid' - ) - if [[ $_nmcli_version == 0.8* ]]; then - con_list_array[3]='system:only list system connections' - con_list_array[4]='user:only list user connections' - fi - _describe 'list configured connections' con_list_array -} - -(( $+functions[_nmcli_con_up] )) || _nmcli_con_up() { - local -a con_up_array - con_up_array=( - 'id:activate connection specified by id' - 'uuid:activate connection specified by uuid' - ) - _describe 'activate connection by id or uuid' con_up_array -} - -(( $+functions[_nmcli_con_down] )) || _nmcli_con_down() { - local -a con_down_array - con_down_array=( - 'id:deactivate connection specified by id' - 'uuid:deactivate connection specified by uuid' - ) - _describe 'deactivate connection by id or uuid' con_down_array -} - -(( $+functions[_nmcli_con_delete] )) || _nmcli_con_delete() { - local -a con_delete_array - con_delete_array=( - 'id:delete connection specified by id' - 'uuid:delete connection specified by uuid' - ) - _describe 'delete connection by id or uuid' con_delete_array -} - -(( $+functions[_nmcli_con_up_extraargs] )) || _nmcli_con_up_extraargs() { - local -a con_up_extraargs_array - con_up_extraargs_array=( - 'iface:require a particular interface' - 'ap:require a specific access point' - '--nowait:don''t wait for command completion' - '--timeout:specify how long to wait for operation to complete' - ) - _describe 'extra options for "con up"' con_up_extraargs_array -} - -(( $+functions[_nmcli_dev_disconnect_extraargs] )) || _nmcli_dev_disconnect_extraargs() { - local -a dev_disconnect_extraargs_array - dev_disconnect_extraargs_array=( - '--nowait:don''t wait for command completion' - '--timeout:specify how long to wait for operation to complete' - ) - _describe 'extra options for "dev disconnect"' dev_disconnect_extraargs_array -} - -(( $+functions[_nmcli_dev_wifi_list] )) || _nmcli_dev_wifi_list() { - local -a dev_wifi_list_array - dev_wifi_list_array=( - 'iface:list APs for a particular interface' - ) - if [[ $_nmcli_version == 0.8* || $_nmcli_version == 0.9.0* ]]; then - dev_wifi_list_array[2] = 'hwaddr:list a specific AP by MAC address' - elif [[ $_nmcli_version == 0.9.[1-9]* ]]; then - dev_wifi_list_array[2] = 'bssid:list a specific AP by BSSID' - fi - _describe 'options for specifying the AP to list' dev_wifi_list_array -} - -(( $+functions[_nmcli_dev] )) || _nmcli_dev() { - local -a dev_array - dev_array=( - 'status:print status of devices' - 'list:get detailed information about devices' - 'disconnect:disconnect device and prevent it from automatically activating' - 'wifi:list available WiFi access points' - ) - _describe "get information about devices" dev_array -} - -(( $+functions[_nmcli_truefalse] )) || _nmcli_truefalse() { - _wanted boolean expl 'use true/false to modify (nothing = query status)' compadd true false -} - -(( $+functions[_nmcli_onoff] )) || _nmcli_onoff() { - _wanted onoff expl 'use on/off to modify (nothing = query status)' compadd on off -} - -local w1="${words[$#words - 1]}" -local w2="${words[$#words - 2]}" -local w3="${words[$#words - 3]}" -local w4="${words[$#words - 4]}" - -if [[ $w2 == nm && $w1 == (sleep|enable) ]]; then - _nmcli_truefalse && return -elif [[ $w2 == nm && $w1 == (wifi|wwan) ]]; then - _nmcli_onoff && return -elif [[ $w1 == nm ]]; then - _nmcli_nm && return -elif [[ $w3 == con && $w2 == list && $w1 == id ]]; then - _nmcli_con_ids && return -elif [[ $w3 == con && $w2 == list && $w1 == uuid ]]; then - _nmcli_con_uuids && return -elif [[ $w2 == con && $w1 == list ]]; then - _nmcli_con_list && return -elif [[ $w3 == con && $w2 == (up|down) && $w1 == id ]]; then - _nmcli_con_ids && return -elif [[ $_nmcli_version == 0.9.[1-9]* && $w3 == con && $w2 == delete && $w1 == id ]]; then - _nmcli_con_ids && return -elif [[ $w3 == con && $w2 == (up|down) && $w1 == uuid ]]; then - _nmcli_con_uuids && return -elif [[ $_nmcli_version == 0.9.[1-9]* && $w3 == con && $w2 == delete && $w1 == uuid ]]; then - _nmcli_con_uuids && return -elif [[ ${(pj:\0:)words} == *$'\0con\0up\0'(id|uuid)$'\0'* ]]; then - if [[ $w1 == iface ]]; then - _net_interfaces && return - elif [[ $w1 == ap ]]; then - _message -e descriptions 'enter MAC address' && return - elif [[ $w1 == --timeout ]]; then - _message -e descriptions 'enter timeout' && return - else - _nmcli_con_up_extraargs && return - fi -elif [[ $w2 == con && $w1 == up ]]; then - _nmcli_con_up && return -elif [[ $w2 == con && $w1 == down ]]; then - _nmcli_con_down && return -elif [[ $_nmcli_version == 0.9.[1-9]* && $w2 == con && $w1 == delete ]]; then - _nmcli_con_delete && return -elif [[ $w1 == con ]]; then - _nmcli_con && return -elif [[ $w3 == dev && $w2 == (list|disconnect) && $w1 == iface ]]; then - _net_interfaces && return -elif [[ ${(pj:\0:)words} == *$'\0dev\0disconnect\0iface\0'* ]]; then - if [[ $w1 == --timeout ]]; then - _message -e descriptions 'enter timeout' && return - else - _nmcli_dev_disconnect_extraargs && return - fi -elif [[ $w2 == dev && $w1 == list ]]; then - compadd iface && return -elif [[ $w2 == dev && $w1 == disconnect ]]; then - compadd iface && return -elif [[ $w4 == dev && $w3 == wifi && $w2 == list && $w1 == iface ]]; then - _net_interfaces && return -elif [[ $w4 == dev && $w3 == wifi && $w2 == list && $w1 == hwaddr ]]; then - _message -e descriptions 'enter MAC address' && return -elif [[ $w3 == dev && $w2 == wifi && $w1 == list ]]; then - _nmcli_dev_wifi_list && return -elif [[ $w2 == dev && $w1 == wifi ]]; then - compadd list && return -elif [[ $w1 == dev ]]; then - _nmcli_dev && return -else - _arguments \ - {'(--terse)-t','(-t)--terse'}'[terse output]' \ - {'(--pretty)-p','(-p)--pretty'}'[pretty output]' \ - {'(--mode)-m','(-m)--mode'}'[output mode]:output mode:(tabular multiline)' \ - {'(--fields)-f','(-f)--fields'}'[specify fields to output]: :->fields' \ - {'(--escape)-e','(-e)--escape'}'[escape columns separators in values]:escape columns separators in values:(yes no)' \ - {'(--version)-v','(-v)--version'}'[show program version]' \ - {'(--help)-h','(-h)--help'}'[print this help]' \ - '*::nmcli object:_nmcli_objects' \ - && return -fi - -[[ "$state" == "fields" ]] && - _values -s , 'fields to be printed' \ - all common \ - autoconnect dbus-path device name net-enabled readonly running \ - scope state timestamp timestamp-real type uuid wifi wifi-hardware \ - wwan wwan-hardware \ - && return diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index e5289b0a7..afe00b6a3 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -33,10 +33,11 @@ _arguments -C -s \ "($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \ "($info -w --raw)"{-w,--raw}'[display RAW sockets]' \ "($info -x --unix)"{-x,--unix}'[display Unix domain sockets]' \ - "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix)' \ + "($info)--vsock[display only vsock sockets]' \ + "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock)' \ "($info -K --kill)"{-K,--kill}'[forcibly close sockets, display what was closed]' \ "($info -H --no-header)"{-H,--no-header}'[suppress header line]' \ - "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram' \ + "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram' \ "($info -D)"{-D,--diag=}'[dump raw info to file]:file:_files' \ "($info -F)"{-F,--filter=}'[read filter information from a file]:file:_files' \ "($info)*: :->filter" && ret=0 @@ -78,7 +79,7 @@ if [[ -n $state ]]; then state|exclude) _wanted states expl state compadd -M 'm:{a-zA-Z_}={A-Za-z-}' \ ESTABLISHED SYN-SENT SYN-RECV FIN-WAIT-1 FIN-WAIT-2 TIME-WAIT \ - CLOSED CLOSE-WAIT LAST-ACK LISTEN CLOSING \ + CLOSED CLOSE-WAIT LAST-ACK LISTENING CLOSING \ all connected synchronized bucket big && ret=0 ;; *) diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs index fe976288d..6e889cf49 100644 --- a/Completion/Linux/Command/_sshfs +++ b/Completion/Linux/Command/_sshfs @@ -4,13 +4,14 @@ local curcontext="$curcontext" state state_descr line typeset -A opt_args integer ret=1 -_arguments -C \ +# TODO: in the "user@host" argument, the "user@" part should be optional +_arguments -C -S : \ '(-)'{-h,--help}'[display help information]' \ '(-)'{-V,--version}'[display version information]' \ '-p[specify TCP port]:tcp port:_ports' \ '-C[enable compression]' \ '-F[specify ssh config file]:file:_files' \ - '-o[specify mount options]:options:->options' \ + '*-o[specify mount options]:options:->options' \ '(-f)-d[enable debug output]' \ '-f[foreground]' \ '-s[disable multithreaded operation]' \ diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index e976b4705..855bf0a70 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -1,15 +1,17 @@ #compdef mpstat cifsiostat isag sadf sar pidstat -# -V can appear with other options, so (- *) isn't needed. #TODO: # sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat. _mpstat() { - _arguments : \ - '-A[equivalent to -u -I ALL -P ALL]' \ - '-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \ - '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ + _arguments -S : \ + '(-n -u -I -N -P)-A[equivalent to -n -u -I ALL -N ALL -P ALL]' \ + '(-A)-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \ + '(-A)-N[specify NUMA nodes]:NUMA node' \ + '(-A)-n[report summary CPU statistics based on NUMA node placement]' \ + '-o[display statistics in JSON]:format:(JSON)' \ + '(-A)-P[specify processor number]:processor: _values -s "," processor ON ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ '-u[report CPU utilization]' \ - '-V[print version number]' \ + '(- 1 2)-V[display version information]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } @@ -20,7 +22,8 @@ _cifsiostat() { '(-m)-k[display statistics in kB/s]' \ '(-k)-m[display statistics in MB/s]' \ '-t[print timestamp for each report]' \ - '-V[print version number]' \ + '(- 1 2)-V[print version number]' \ + '--human[print sizes in human readable format]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } @@ -34,50 +37,62 @@ _isag() { } _sadf() { - local ret=1 + local i ret=1 # any options after `--' are for sar(1) - if ! (( CURRENT > $words[(i)--] )); then + if (( CURRENT <= $words[(i)--] )); then _arguments : \ '-C[display comments in file]' \ - '(-j -p -x)-d[output file in SQL format]' \ + '-c[convert an old datafile to the new format]' \ '-e[set ending time of report]:ending time (HH\:MM\:SS)' \ '-H[display only the header of the report]' \ - '(-j -p -x)-h[print on a single line when used with -d]' \ - '(-d -p -x)-j[output file in JSON]' \ + '(-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)' \ - '(-j -x -d)-p[print in format parsable by tools like awk]' \ '-s[set starting time of report]:starting time (HH\:MM\:SS)"' \ '(-t -U)-T[display timestamp in local time]' \ '(-T -U)-t[display timestamp in file\''s original localtime]' \ '(-t -T)-U[display in seconds since epoch (UTC)]' \ - '-V[print version number]' \ - '(-j -d -p)-x[output file in XML]' \ + '(- 1 2 3)-V[print version number]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' \ - '3:data file:_files' && ret=0 + '3:data file:_files' \ + + '(format)' \ + '-d[output file in SQL format]' \ + '-g[print data in SVG format]' \ + '-j[output file in JSON]' \ + '-p[print in format parsable by tools like awk]' \ + '-r[print raw contents of data file]' \ + '-x[output file in XML]' \ + && ret=0 else - _arguments : '*::sar: _sar' && ret=0 + (( i = words[(i)--] - 1, CURRENT -= i )) + shift i words + _sar && ret=0 fi return ret } _sar() { - _arguments : \ - '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL]' \ + _arguments -s : \ + '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -r ALL -u ALL -P ALL]' \ '-B[report paging statistics]' \ '-b[report I/O and transfer rate statistics]' \ '-C[display comments from sadc]' \ + '-D[use saYYYYMMDD instead of saDD as the standard system activity daily data file name]' \ '-d[report activity for each block device]' \ '-e[set ending time of report]:ending time (HH\:MM\:SS)' \ '-F[display statistics for mounted filesystems]' \ '-f[extract records from file]:record:_files' \ '-H[report hugepages utilization]' \ '-h[display help]' \ + '--human[print sizes in human readable format]' \ '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \ '-i[select records as close as possible to interval]:interval' \ '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \ '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \ '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \ + '-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]' \ @@ -85,8 +100,10 @@ _sar() { '-r[report memory utilization statistics]' \ '-S[report swap space utilization]' \ '-s[set starting time of report]:start time (HH\:MM\:SS)' \ + '--sadc[print name of data collector]' \ + '-t[display timestamps in original local time of file creator]' \ '-u[report CPU utilization]: :(ALL)' \ - '-V[print version number]' \ + '(- 1 2)-V[display version information]' \ '-v[report status of kernel tables]' \ '-W[report swapping statistics]' \ '-w[report task creation and system switching activity]' \ @@ -96,22 +113,27 @@ _sar() { } _pidstat() { - _arguments : \ + _arguments -s : \ '-C[filter tasks by string]:task filter' \ '-d[report I/O statistics]' \ - '-h[display on horizontally]' \ + '-e[execute specified program and monitor it with pidstat]:*::command: _normal' \ + '-H[display timestamp in seconds since the epoch]' \ + '-h[display horizontally]' \ '-I[divide CPU usage by number of processors]' \ '-l[display process name along with arguments]' \ - '-p[select pid]:pid: _sequence _pids' \ + '*-p[select pid]:pid: _sequence _pids' \ + '-R[report realtime priority and scheduling policy information]' \ '-r[report page faults and memory]' \ '-s[report stack utilization]' \ '-T[specifies what to monitor]:type:(TASK CHILD ALL)' \ '-t[display statistics for threads]' \ '-U[display real username of tasks]::username:_users' \ '-u[report cpu utilization]' \ - '-V[print version number]' \ + '(- 1 2)-V[display version information]' \ '-v[display values from kernel table]' \ '-w[report task switching activity]' \ + '-G[include only processes with specified name]:process name' \ + '--human[print sizes in human readable format]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } diff --git a/Completion/Linux/Command/_tracepath b/Completion/Linux/Command/_tracepath new file mode 100644 index 000000000..f0f777d96 --- /dev/null +++ b/Completion/Linux/Command/_tracepath @@ -0,0 +1,9 @@ +#compdef tracepath tracepath6 + +_arguments -s -S \ + '-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' \ + ':destination:_hosts' diff --git a/Completion/Linux/Command/_tune2fs b/Completion/Linux/Command/_tune2fs index 73ce2dd12..af120e279 100644 --- a/Completion/Linux/Command/_tune2fs +++ b/Completion/Linux/Command/_tune2fs @@ -1,23 +1,35 @@ #compdef tune2fs -_arguments \ - '-c[set max mounts between checks]:number of mounts' \ - '-C[set mount count]:number of mounts' \ - '-e[set error behavior]:error behavior:(continue remount-ro panic)' \ +_arguments -s -S \ + '-c+[set max mounts between checks]:number of mounts' \ + '-C+[set mount count]:number of mounts' \ + '-e+[set error behavior]:error behavior:(continue remount-ro panic)' \ + '-E+[set extended options]: :_values -s , "extended option" + clearmmp + "mmp_update_interval\:interval (seconds)" + "stride\:stride size (blocks)" + "stripe_width\:stipe width (blocks)" + "hash_alg\:hash algorithm\:(legacy half_md4 tea)" + "mount_opts\:mount option" + "(^test_fs)test_fs" + "(test_fs)^test_fs"' \ '-f[force tune2fs to complete even in the face of errors]' \ - '-g[set the group which can use reserved filesystem blocks]:group:_groups' \ - '-i[interval between checks]:duration' \ + '-g+[set the group which can use reserved filesystem blocks]:group:_groups' \ + '-i+[interval between checks]:duration' \ + '-I+[set inode size]:inode size' \ '-j[add an ext3 journal to the filesystem]' \ - '-J[journal options]: :_values -s , option "size[specify journal size]\:size" "device[use external journal]\:block device\:_files"' \ + '-J+[journal options]: :_values -s , option "size[specify journal size]\:size" "location\:location" "device[use external journal]\:block device\:_files"' \ '-l[list the contents of the filesystem superblock]' \ - '-L[set the volume label of the filesystem]:label' \ - '-m[set the percentage of reserved filesystem blocks]:percentage' \ - '-M[set the last-mounted directory for the filesystem]:directory:_files -/' \ - '-o[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback' \ - '-O[set or clear filesystem features]: :_values -s , feature dir_index filetype has_journal sparse_super' \ - '-r[set the number of reserved filesystem blocks]:number' \ - '-s[set sparse super feature]:state:((0\:off 1\:on))' \ - '-T[set time last checked]:time specifier' \ - '-u[set user who can use reserved filesystem blocks]:user:_users' \ - '-U[set filesystem UUID]:UUID or special:(clear random time)' \ + '-L+[set the volume label of the filesystem]:label' \ + '-m+[set the percentage of reserved filesystem blocks]:percentage' \ + '-M+[set the last-mounted directory for the filesystem]:directory:_files -/' \ + '-o+[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback nobarrier block_validity discard nodelalloc' \ + '-O+[set or clear filesystem features]: :_values -s , feature dir_index dir_nlink encrypt extentextent extra_isize filetype flex_bg has_journalhuge_file large_file metadata_csum mmp project quota read-only resize_inode sparse_super uninit_bg' \ + '-r+[set the number of reserved filesystem blocks]:number' \ + '-Q+[set quota feature on the superblock]: :_values -s , "quota option" usrquota grpquota prjquota' \ + '-s+[set sparse super feature]:state:((0\:off 1\:on))' \ + '-T+[set time last checked]:time specifier (YYYYMMDD[HH[MM[SS]]])' \ + '-u+[set user who can use reserved filesystem blocks]:user:_users' \ + '-U+[set filesystem UUID]:UUID or special:(clear random time)' \ + '-z+[save old contents of file system block to undo file]:undo file:_files' \ ':device:_files' diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind index 0284ff880..1ae228c94 100644 --- a/Completion/Linux/Command/_valgrind +++ b/Completion/Linux/Command/_valgrind @@ -1,8 +1,8 @@ #compdef valgrind -value-,VALGRIND_OPTS,-default- local curcontext="$curcontext" state line -local -a cmd common common_mem_null \ - args args_{addrcheck,memcheck,cachegrind,helgrind,lackey,massif,none} +local -a cmd common common_{mem_null,read_varinfo} +local -a args args_{addrcheck,memcheck,cachegrind,helgrind,lackey,massif,none} cmd=( '1:command name:_command_names -e' diff --git a/Completion/Linux/Command/_wipefs b/Completion/Linux/Command/_wipefs new file mode 100644 index 000000000..5142def8a --- /dev/null +++ b/Completion/Linux/Command/_wipefs @@ -0,0 +1,25 @@ +#compdef wipefs + +_arguments -s -S \ + '(H -a --all)'{-a,--all}'[wipe all magic strings]' \ + '(H -b --backup)'{-b,--backup}'[create a signature backup in $HOME]' \ + '(H -f --force)'{-f,--force}'[force erasure]' \ + '(H -i --no-headings -J --json -p --parsable)'{-i,--no-headings}"[don't print headings]" \ + '(H -J --json -i --no-headings -p --parsable)'{-J,--json}'[use JSON output format]' \ + '(H -n --no-act)'{-n,--no-act}'[do everything except the actual write() call]' \ + '(H -o --offset)'{-o+,--offset=}'[specify offset to erase]:offset (bytes)' \ + '(H -O --output)'{-O+,--output=}'[specify columns to display]: : _values -s, "column" + "uuid[partition/filesystem UUID]" + "label[filesystem label]" + "length[magic string length]" + "type[superblock type]" + "offset[magic string offset]" + "usage[type description]" + "device[block device name]"' \ + '(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)*:disk device:_files -g "*(-%)" -P / -W /' \ + + '(H)' \ + '(- *)'{-h,--help}'[display help information]' \ + '(- *)'{-V,--version}'[display version information]' |