From 359a8fce0085888306330354e567f1d0523d230d Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 19 Aug 2019 16:15:49 +0200 Subject: 44587: completion option updates --- Completion/Linux/Command/_btrfs | 18 ++++++++---- Completion/Linux/Command/_networkmanager | 20 ++++++++++++-- Completion/Linux/Command/_ss | 3 +- Completion/Linux/Command/_sshfs | 18 ++++++------ Completion/Linux/Command/_strace | 47 +++++++++++++++++++++++--------- 5 files changed, 75 insertions(+), 31 deletions(-) (limited to 'Completion/Linux') diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs index cc42dd153..bc941621e 100644 --- a/Completion/Linux/Command/_btrfs +++ b/Completion/Linux/Command/_btrfs @@ -172,11 +172,17 @@ while (( $#state )); do ) [[ ${${(P)group}[cmd]} == add ]] && args+=( - {-K,--nodiscard}"[don't perform discard]" + {-K,--nodiscard}"[don't perform whole device TRIM]" {-f,--force}'[force overwrite of existing filesystem]' ) ;; - device:scan) args+=( '(1 -)'{-d,--all-devices}'[scan all devices in /dev]' '1:device:_files -g "*(-%)"' );; + device:scan) + args+=( + '(-)'{-u,--forget}'[unregister all stale devices or a given device]' + '(1 -)'{-d,--all-devices}'[enumerate and register all devices]' + '1:device:_files -g "*(-%)"' + ) + ;; device:stats) args+=( '(-c --check)'{-c,--check}'[return non-zero if any stat counter is not zero]' @@ -214,7 +220,7 @@ while (( $#state )); do '(-d -s)-m+[act on metadata chunks]:filter:->filters' '(-d -m)-s+[act on system chunks (only under -f)]:filters:->filters' '-v[verbose mode]' - '-f[force reducing of metadata integrity]' + '-f[force a reduction of metadata integrity]' "--full-balance[don't print warning and don't delay start]" '(--background --bg)'{--background,--bg}'[run balance operation asynchronously in the background]' '1:path:_files -/' @@ -286,7 +292,7 @@ while (( $#state )); do '(-r --roots)'{-r,--roots}'[print only short root node info]' '(-R --backups)'{-R,--backups}'[same as --roots plus print backup root info]' '(-u --uuid)'{-u,--uuid}'[print only the uuid tree]' - '(-b --block)'{-b,--block}'[print info from the specified block only]:block' + \*{-b,--block}'[print info from the specified block only]:block number' '(-t --tree)'{-t,--tree}'[print only tree with the given id (string or number)]:tree id' '--follow[use with -b, to show all children tree blocks of the block]' ) @@ -366,6 +372,9 @@ while (( $#state )); do '2:path:_files -/' ) ;; + send|receive) + args+=( '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' ) + ;| send) args+=( '*-v[verbose mode]' @@ -375,7 +384,6 @@ while (( $#state )); do '-f[specify output file]:file:_files' '--no-data[send in NO_FILE_DATA mode]' '(-v --verbose)'{-v,--verbose}'[enable verbose output]' - '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' '1:subvolume:_files -/' ) ;; diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager index fa9301971..c9b09d145 100644 --- a/Completion/Linux/Command/_networkmanager +++ b/Completion/Linux/Command/_networkmanager @@ -4,6 +4,7 @@ _networkmanager() { local curcontext="$curcontext" state line + local nmcli="$words[1]" _arguments -C \ '(-o -overview)-o'{,verview}'[overview mode (hide default values)]' \ @@ -107,10 +108,22 @@ _nm_connection_down() { } _nm_connection_modify() { - # TODO: add support for options and properties - _arguments \ + local curcontext="$curcontext" ret=1 + local -a state line expl properties + + _arguments -A "-*" \ "--temporary" \ - "1:connection:_nm_connection_specs" + "1:connection:_nm_connection_specs" \ + '2:option:->properties' \ + '3:value' && ret=0 + + if [[ -n "$state" ]]; then + properties=( ${${(f)"$(_call_program properties $nmcli -t connection show $line[1])"}%%:*} ) + _description properties expl property + _multi_parts "$expl[@]" . properties && ret=0 + fi + + return ret } _nm_connection_clone() { @@ -245,6 +258,7 @@ _nm_device_wifi() { _nm_device_wifi_list() { # TODO: support bssid on its own _arguments \ + '--rescan[force or disable network scan]:network scan:(yes no auto)' \ "1: :(ifname)" \ "2:interface:_nm_device_ifnames" \ "3: :(bssid)" \ diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index f19b94995..1dbd717eb 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -36,8 +36,9 @@ _arguments -C -s \ "($info -w --raw)"{-w,--raw}'[display RAW sockets]' \ "($info -x --unix)"{-x,--unix}'[display Unix domain sockets]' \ "($info)--tipc[display only TIPC sockets]" \ + "($info)--xdp[display only XDP sockets]" \ "($info)--vsock[display only vsock sockets]" \ - "($info -f --family)"{-f+,--family=}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock tipc)' \ + "($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 -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' \ diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs index 6e889cf49..3363ecdc0 100644 --- a/Completion/Linux/Command/_sshfs +++ b/Completion/Linux/Command/_sshfs @@ -12,7 +12,7 @@ _arguments -C -S : \ '-C[enable compression]' \ '-F[specify ssh config file]:file:_files' \ '*-o[specify mount options]:options:->options' \ - '(-f)-d[enable debug output]' \ + '(-d --debug -f)'{-d,--debug}'[enable debug output]' \ '-f[foreground]' \ '-s[disable multithreaded operation]' \ ':remote directory:_user_at_host -S:' \ @@ -20,14 +20,14 @@ _arguments -C -S : \ if [[ $state == options ]]; then _values -s , "sshfs or fuse or mount options" \ - debug reconnect delay_connect sshfs_sync no_readahead sync_readdir sshfs_debug \ - 'cache:cache setting:(yes no)' \ - '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)' \ + reconnect delay_connect sshfs_sync no_readahead sync_readdir \ + 'dir_cache:cache setting:(yes no)' \ + 'dcache_max_size:size [10000]' \ + 'dcache_timeout:timeout (seconds) [20]' \ + dcache_{stat,dir,link}_timeout:'timeout (seconds)' \ + 'dcache_clean_interval:interval [60]' \ + 'dcache_min_clean_interval:interval [5]' \ + 'workaround:workaround:(none all rename renamexdev delaysrv truncate nobuflimit fstat createmode)' \ 'idmap:user/group mapping:(none user file)' \ uidfile:file:_files \ gidfile:file:_files \ diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index e6dc88659..683673fdd 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -29,6 +29,8 @@ _arguments -C -s \ '-w[summarise syscall latency]' \ '*-e+[select events to trace or how to trace]:system call:->expressions' \ '*-P+[trace only system calls accessing given path]:path:_files' \ + '(-Z)-z[trace only system calls that return success]' \ + '(-z)-Z[trace only system calls that return an error]' \ '-b+[detach from process on specified syscall]:syscall:(execve)' \ '-f[trace child processes as they are created by currently traced processes]' \ '(-c -C)-ff[write each process trace to . (when using -o ]' \ @@ -57,25 +59,44 @@ case $state in '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' \ 'inject[perform syscall tampering]:system call:_sys_calls -a -n' \ + 'status[trace system calls with given return status]:status:->status' \ 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' && ret=0 - if [[ $words[CURRENT] != *=* || $state = syscalls ]]; then + if [[ $state = status ]]; then + _values -s , 'return status [all]' \ + all successful failed \ + "unfinished[system calls that don't return]" \ + 'unavailable[system calls that return but strace fails to fetch the error]' \ + 'detached[system calls where strace detaches before the return]' && ret=0 + elif [[ $words[CURRENT] != *=* || $state = syscalls ]]; then local dedup sets suf="-qS," compset -P '!' dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} ) compset -S ',*' || suf="" compset -P '*,' - sets=( - 'file:trace all system calls which take a file name as an argument' - 'process:trace all system calls which involve process management' - 'network:trace all the network related system calls' - 'signal:trace all signal related system calls' - 'ipc:trace all IPC related system calls' - 'desc:trace all file descriptor related system calls' - 'memory:trace all memory mapping related system calls' - ) - _alternative \ - "related system call:sets: _describe -t traces 'related system call' sets -F dedup $suf" \ - "system call:syscalls:_sys_calls -a -n $suf -F dedup" && ret=0 + if compset -P /; then + _wanted syscalls expl "system call (regex)" _sys_calls -a -n $suf -F dedup && ret=0 + else + sets=( + {%,}'file:trace all system calls which take a file name as an argument' + {%,}'process:trace all system calls which involve process management' + {%net,{%,}network}':trace all the network related system calls' + {%,}'signal:trace all signal related system calls' + {%,}'ipc:trace all IPC related system calls' + {%,}'desc:trace all file descriptor related system calls' + {%,}'memory:trace all memory mapping related system calls' + '%stat:trace variants of stat' + '%lstat:trace variants of lstat' + '%fstat:trace variants of fstat and fstatat' + '%%stat:trace variants of all syscalls used for requesting file status' + '%statfs:trace variants of statfs' + '%fstatfs:trace variants of fstatfs' + '%%statfs:trace variants of all syscalls used for file system statistics' + '%pure:trace syscalls that always succeed and have no arguments' + ) + _alternative \ + "sets:related system call: _describe -t traces 'related system call' sets -F dedup $suf" \ + "syscalls:system call:_sys_calls -a -n $suf -F dedup" && ret=0 + fi fi ;; file-pipe) -- cgit 1.4.1