diff options
Diffstat (limited to 'Completion/Linux/Command')
-rw-r--r-- | Completion/Linux/Command/_ethtool | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_iptables | 4 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsblk | 58 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsusb | 30 | ||||
-rw-r--r-- | Completion/Linux/Command/_mdadm | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_ss | 1 | ||||
-rw-r--r-- | Completion/Linux/Command/_sshfs | 68 | ||||
-rw-r--r-- | Completion/Linux/Command/_strace | 3 |
8 files changed, 129 insertions, 39 deletions
diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index 5d607741f..71f5ed3bf 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -1,6 +1,6 @@ #compdef ethtool -local -a cmds +local -a expl cmds if [[ $CURRENT -ge 4 ]]; then case $words[CURRENT-1] in diff --git a/Completion/Linux/Command/_iptables b/Completion/Linux/Command/_iptables index 8f990030c..4178a1a2e 100644 --- a/Completion/Linux/Command/_iptables +++ b/Completion/Linux/Command/_iptables @@ -47,7 +47,7 @@ case ${prev[${prev[(I)-p|--protocol]}+1]}; in esac case ${prev[${prev[(I)-j|--jump]}+1]}; in - DNAT) args+=( '(--to,--to-destination)'{--to,--to-destination}':address:_users-ports' ) ;; + DNAT) args+=( '(--to --to-destination)'{--to,--to-destination}':address:_users-ports' ) ;; DSCP) args+=( '--set-dscp[set the DSCP field]:value' @@ -67,7 +67,7 @@ case ${prev[${prev[(I)-j|--jump]}+1]}; in MARK) args+=( '--set-mark[set fwmark in packet]:number' ) ;; REDIRECT|MASQUERADE) args+=( '--to-ports[port (range) to map to]:port range:_ports' ) ;; REJECT) args+=( '--reject-with[drop packet and send reply]:reject type:->reject-types' ) ;; - SNAT) args+=( '(--to,--to-source)*'{--to,--to-source}'[specify address to map source to]:address:_users-ports' ) ;; + SNAT) args+=( '(--to --to-source)*'{--to,--to-source}'[specify address to map source to]:address:_users-ports' ) ;; TCPMSS) args+=( '--set-mss[explicitly set MSS option]:value' diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk new file mode 100644 index 000000000..c8fbb27c7 --- /dev/null +++ b/Completion/Linux/Command/_lsblk @@ -0,0 +1,58 @@ +#compdef lsblk + +local sep ret=1 +local -a values dedup suf=( -qS , ) +local curcontext="$curcontext" state line expl +typeset -A opt_args + +_arguments -C -s -S \ + '(H -a --all)'{-a,--all}'[print all devices]' \ + '(H -b --bytes)'{-b,--bytes}'[print size in bytes rather than in 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 -n --noheadings)'{-n,--noheadings}"[don't print headings]" \ + '(H -p --paths)'{-p,--paths}'[print complete device path]' \ + '(H -s --inverse)'{-s,--inverse}'[reverse dependency order]' \ + '(H -x --sort)'{-x+,--sort=}'[sort output by specified column]:column:->columns' \ + '*:device:_files -g "*(-%b)" -P / -W /' \ + + fields \ + '(H -D --discard -o --output -O --output-all)'{-D,--discard}'[output discard capabilities]' \ + '(H -z --zoned -o --output -O --output-all)'{-z,--zoned}'[output zone model]' \ + '(H -f --fs -o --output -O --output-all)'{-f,--fs}'[output info about filesystems]' \ + '(H -m --perms -o --output -O --output-all)'{-m,--perms}'[output info about permissions]' \ + '(H -S --scsi -o --output -O --output-all)'{-S,--scsi}'[output info about SCSI devices]' \ + '(H -t --topology -o --output -O --output-all)'{-t,--topology}'[output info about topology]' \ + '(H fields)'{-o+,--output=}'[specify output columns]:output column:->columnlist' \ + '(H fields)'{-O,--output-all}'[output all columns]' \ + + '(format)' \ + '(H)'{-i,--ascii}'[output ascii characters only]' \ + '(H)'{-J,--json}'[use JSON output format]' \ + '(H)'{-l,--list}'[use list format output]' \ + '(H)'{-P,--pairs}'[use key="value" output format]' \ + '(H)'{-r,--raw}'[use raw output format]' \ + + 'H' \ + '(* -)'{-h,--help}'[display help information]' \ + '(* -)'{-V,--version}'[display version information]' && ret=0 + +case $state in + *list) + dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} ) + compset -S ',*' && suf=() + compset -P '*,' + ;| + column*) + values=( + ${${${${(f)"$(_call_program columns lsblk -h)"}[(r)Available*,-3]## #}[2,-1]//:/\\:}/ /:} + ) + _describe -t fields column values -M 'm:{a-z}={A-Z}' $suf -F dedup && ret=0 + ;; + major*) + zstyle -s ":completion:${curcontext}:" list-separator sep || sep=-- + values=( ${${${(f)"$(</proc/devices)"}[(r)Block*,-1]## #}[2,-1]/ /:} ) + zformat -a values " $sep " $values + _wanted -V devices expl 'major device number' compadd $suf -d values -F dedup ${values%% *} && ret=0 + ;; +esac + +return ret diff --git a/Completion/Linux/Command/_lsusb b/Completion/Linux/Command/_lsusb index 17240e03d..129309b8b 100644 --- a/Completion/Linux/Command/_lsusb +++ b/Completion/Linux/Command/_lsusb @@ -1,19 +1,21 @@ #compdef lsusb -local context state line usbidsline vendorid pair +local usbidsline vendorid pair ret=1 +local curcontext="$curcontext" state line expl typeset -A opt_args -_arguments \ - '(-v --verbose)'{-v,--verbose}'[be verbose]' \ - '-s:bus and/or devnum to show:' \ - '-d:vendor and product to show:->vendorproduct' \ - '-D:device to show:_files' \ - '-t[dump the physical USB device hierarchy as a tree]' \ - '(-V --version)'{-V,--version}'[print version info and exit]' && return 0 +_arguments -C \ + '(-v --verbose -t --tree)'{-v,--verbose}'[be verbose]' \ + '-s+[filter devices by bus and/or device number]:bus and/or devnum to show' \ + '-d+[filter devices by vendor/product ID]:vendor and product to show:->vendorproduct' \ + '-D+[display only specified device]:device:_files -g "*(-%)" -P / -W /' \ + '(-t --tree -v --verbose)'{-t,--tree}'[dump the physical USB device hierarchy as a tree]' \ + '(-)'{-V,--version}'[print version information]' \ + '(-)'{-h,--help}'[print help information]' && ret=0 - if [[ ${+_lsusb_vendors} -eq 0 ]]; then - typeset -A _lsusb_vendors _lsusb_devices - while IFS="" read usbidsline +if [[ -n $state && ${+_lsusb_vendors} -eq 0 ]]; then + typeset -A _lsusb_vendors _lsusb_devices + cat /usr/share/(misc|hwdata)/usb.ids | while IFS="" read usbidsline do case "$usbidsline" in ((#b)([0-9a-f]##) ##(*)) @@ -25,7 +27,9 @@ _arguments \ _lsusb_devices[${pair}]="$match[2]" ;; esac - done < /usr/share/misc/usb.ids + done fi -compadd -k _lsusb_devices +_wanted products expl 'vendor ID:product ID' compadd -k _lsusb_devices && ret=0 + +return ret diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm index b2af3269d..b6dce7ccb 100644 --- a/Completion/Linux/Command/_mdadm +++ b/Completion/Linux/Command/_mdadm @@ -78,7 +78,7 @@ if (( $+words[(r)-(A|-assemble)] )); then '(--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/_ss b/Completion/Linux/Command/_ss index 90d83a4c4..e5289b0a7 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -28,6 +28,7 @@ _arguments -C -s \ "($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 -S --sctp)"{-S,--sctp}'[display SCTP sockets]' \ "($info -u --udp)"{-u,--udp}'[display UDP sockets]' \ "($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \ "($info -w --raw)"{-w,--raw}'[display RAW sockets]' \ diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs index 534e806e3..fe976288d 100644 --- a/Completion/Linux/Command/_sshfs +++ b/Completion/Linux/Command/_sshfs @@ -1,39 +1,65 @@ #compdef sshfs -local context state state_descr line +local curcontext="$curcontext" state state_descr line typeset -A opt_args -local curcontext="$curcontext" integer ret=1 _arguments -C \ - '-V[version]' \ - '-p:tcp port:' \ - '-C[compression]' \ - '-o:options:->options' \ - '-d[debug]' \ + '(-)'{-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' \ + '(-f)-d[enable debug output]' \ '-f[foreground]' \ '-s[disable multithreaded operation]' \ - '-r[mount read-only]' \ - '-h[help]' \ ':remote directory:_user_at_host -S:' \ ':mountpoint:_files -/' && ret=0 if [[ $state == options ]]; then _values -s , "sshfs or fuse or mount options" \ - reconnect sshfs_sync no_readahead sshfs_debug \ + debug reconnect delay_connect sshfs_sync no_readahead sync_readdir sshfs_debug \ 'cache:cache setting:(yes no)' \ - cache_timeout:seconds: \ - cache_stat_timeout:seconds: \ - cache_dir_timeout:seconds: \ - cache_link_timeout:seconds: \ + 'cache_max_size:size [10000]' \ + 'cache_timeout:timeout (seconds) [20]' \ + cache_{stat,dir,link}_timeout:'timeout (seconds)' \ + 'cache_clean_interval:interval [60]' \ + 'cache_min_clean_interval:interval [5]' \ + 'workaround:workaround:(none all rename delaysrv truncate nobuflimit)' \ + 'idmap:user/group mapping:(none user file)' \ + uidfile:file:_files \ + gidfile:file:_files \ + 'nomap:type:(ignore error)' \ 'ssh_command:ssh command:_command_names' \ - directport:port: \ - 'SSHOPT:ssh option:' \ - default_permissions allow_other allow_root kernel_cache large_read direct_io \ - max_read:size: \ - hard_remove debug \ - fs_name:name: \ - use_ino readdir_ino && ret=0 + 'ssh_protocol:version:(1 2)' \ + sftp_server:path:_files \ + directport:port:_ports \ + slave disable_hardlink transform_symlinks follow_symlinks no_check_root password_stdin \ + allow_other allow_root auto_unmount nonempty default_permissions \ + fsname:filesystem\ name \ + subtype:filesystem\ type \ + large_read \ + max_read:max\ size \ + hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache \ + 'umask:permissions' \ + 'uid:owner' 'gid:group' \ + 'entry_timeout:timeout (seconds) [1]' \ + 'negative_timeout:timeout (seconds) [0]' \ + 'attr_timeout:timeout (seconds) [1]' \ + 'ac_attr_timeout:timeout (seconds) [= attr_timeout]' \ + noforget \ + 'remember:time (seconds)' \ + nopath intr \ + 'intr_signal:signal [10]' \ + modules:module \ + max_write:size \ + max_readahead:readahead \ + max_background:number \ + congestion_threshold:threshold \ + async_read sync_read atomic_o_trunc big_writes no_remote_lock no_remote_flock \ + no_remote_posix_lock splice_write splice_move splice_read \ + from_code:charset to_code:charset subdir:_directories rellinks && ret=0 fi return ret diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index cbf95d6c4..cff9a49c6 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -53,7 +53,8 @@ case $state in 'raw[print raw, undecoded arguments for the specified set of system calls]:system call:_sequence _sys_calls -a -n' \ 'signal[trace only the specified subset of signals]:signal:_sequence _signals -s -M "B\:!="' \ 'read[perform a full hex and ASCII dump of all the data read from listed file descriptors]:file descriptor:_sequence _file_descriptors' \ - 'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptor:_sequence _file_descriptors' && ret=0 + 'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptor:_sequence _file_descriptors' \ + 'fault[perform syscall fault injection]:system call:_sys_calls -a -n' && ret=0 if [[ $words[CURRENT] != *=* || $state = syscalls ]]; then local dedup sets suf="-qS," compset -P '!' |