diff options
Diffstat (limited to 'Completion/Linux/Command')
-rw-r--r-- | Completion/Linux/Command/_cpupower | 119 | ||||
-rw-r--r-- | Completion/Linux/Command/_ethtool | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_fusermount | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_gpasswd | 19 | ||||
-rw-r--r-- | Completion/Linux/Command/_iconvconfig | 13 | ||||
-rw-r--r-- | Completion/Linux/Command/_iwconfig | 4 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsblk | 57 | ||||
-rw-r--r-- | Completion/Linux/Command/_lsusb | 30 | ||||
-rw-r--r-- | Completion/Linux/Command/_ltrace | 35 | ||||
-rw-r--r-- | Completion/Linux/Command/_mdadm | 10 | ||||
-rw-r--r-- | Completion/Linux/Command/_modutils | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_pidof | 24 | ||||
-rw-r--r-- | Completion/Linux/Command/_pkgtool | 2 | ||||
-rw-r--r-- | Completion/Linux/Command/_ss | 11 | ||||
-rw-r--r-- | Completion/Linux/Command/_sshfs | 68 | ||||
-rw-r--r-- | Completion/Linux/Command/_strace | 210 | ||||
-rw-r--r-- | Completion/Linux/Command/_sysstat | 37 | ||||
-rw-r--r-- | Completion/Linux/Command/_vserver | 2 |
18 files changed, 445 insertions, 202 deletions
diff --git a/Completion/Linux/Command/_cpupower b/Completion/Linux/Command/_cpupower new file mode 100644 index 000000000..6713323cb --- /dev/null +++ b/Completion/Linux/Command/_cpupower @@ -0,0 +1,119 @@ +#compdef cpupower + +local curcontext="$curcontext" ret=1 +local -a state line expl cmds args +typeset -A opt_args + +_arguments -C \ + '(- :)'{-h,--help}'[print help information]' \ + '(- :)'{-v,--version}'[print version information]' \ + '(-d --debug)'{-d,--debug}'[enable debug output]' \ + '(-c --cpu)'{-c,--cpu}'[limit values to specific processor cores]:cpu' \ + ':cmd:->cmds' \ + '*::arg:->args' && ret=0 + +cmds=( + 'frequency-info:show current frequency info' + 'frequency-set:set frequency parameters' + 'idle-info:show current idle state info' + 'idle-set:set idle state parameters' + 'info:show global power parameters' + 'set:set global power parameters' + 'monitor:report frequency and idle statistics' + 'help:print usage information' +) +case $state in + cmds) + _describe command cmds && ret=0 + ;; + args) + curcontext="${curcontext%:*}-$words[1]" + case ${words[1]} in + help) + _describe command cmds + return + ;; + frequency-info) + args=( + '(-m --human)'{-m,--human}'[use human readable output]' + '(-n --no-rounding)'{-n,--no-rounding}'[disable rounding of values]' + - '(info)' + {-e,--debug}'[print debug info]' + {-f,--freq}'[show current frequency]' + {-w,--hwfreq}'[show current hardware frequency]' + {-l,--hwlimits}'[show min/max frequency allowed]' + {-d,--driver}'[show the kernel driver in use]' + {-p,--policy}'[show the current cpufreq policy]' + {-g,--governors}'[show available governers]' + {-r,--related-cpus}'[show cpus that run at the same frequency]' + {-a,--affected-cpus}'[show software controlled cpus]' + {-s,--stats}'[show cpufreq statistics]' + {-y,--latency}'[show frequency change latency]' + ) + [[ -n $opt_args[(i)-(c|-cpu)] ]] || args+=( + {-o,--proc}'[print old style proc info]' + ) + ;; + frequency-set) + args=( + '(-d --min)'{-d+,--min}'[new minimum frequency]:frequency:->frequencies' + '(-u --max)'{-u+,--max}'[new maximum frequency]:frequency:->frequencies' + '(-g --governor)'{-g+,--governor}'[new cpufreq governor]:governor:->governors' + '(-)'{-f+,--freq}'[new frequency for userspace governor]:frequency:->frequencies' + '(-r --related)'{-r,--related}'[modify all hardware related cpus]' + ) + ;; + idle-info) + args=( + '(-f --silent)'{-f,--silent}'[print summary only]' + '(-e --proc)'{-e,--proc}'[print old style proc info (deprecated)]' + ) + ;; + idle-set) + args=( + '(-d --disable)'{-d+,--disable}'[disable specific sleep state]:state no' + '(-e --enable)'{-e+,--enable}'[enable specific sleep state]:state no' + '(-D --disable-by-latency)'{-D+,--disable-by-latency}'[disable state based on latency]:latency' + '(-E --enable-all)'{-E,--enable-all}'[enable all idle states]' + ) + ;; + info) + args=( + '(-b --perf-bias)'{-b,--perf-bias}'[show intel performance bias value]' + ) + ;; + set) + args=( + '(-b --perf-bias)'{-b+,--perf-bias}'[set intel performance bias value]:performance bias' + ) + ;; + monitor) + args=( + '(-)-l[list available monitors]' + '-m+[display specified monitors]:monitor:->monitors' + '-i+[measurement interval]:interval (seconds)' + '-c[schedule on every core]' + '-v[increase verbosity]' + '*:::command: _normal' + ) + ;; + esac + _arguments -C -s "$args[@]" && ret=0 + case $state in + frequencies) + _wanted -x frequencies expl frequency compadd $(cpupower frequency-info | + sed -n 's/ //g; s/,/ /g; s/availablefrequencysteps://p') && ret=0 + ;; + governors) + _wanted governors expl 'scaling governor' compadd \ + ${=${"$(_call_program governors cpupower frequency-info -g)"}##*:} && ret=0 + ;; + monitors) + _sequence _wanted monitors expl 'monitor' compadd - ${${${(M)${(f)"$(_call_program monitors \ + cpupower monitor -l)"}:#Monitor *}#*\"}%%\"*} && ret=0 + ;; + esac + ;; +esac + +return ret 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/_fusermount b/Completion/Linux/Command/_fusermount index d3d1647fa..02cb57237 100644 --- a/Completion/Linux/Command/_fusermount +++ b/Completion/Linux/Command/_fusermount @@ -20,7 +20,7 @@ case "$state" in _files -/ else mtpts=(${${${"${(f)$(< /etc/mtab)}"}#* }%% *}) - _canonical_paths mounted 'mounted filesystem' $mtpts + _canonical_paths mounted 'mounted filesystem' "${(@g::)mtpts}" fi ;; esac diff --git a/Completion/Linux/Command/_gpasswd b/Completion/Linux/Command/_gpasswd index 9b4bedec6..24fe361b0 100644 --- a/Completion/Linux/Command/_gpasswd +++ b/Completion/Linux/Command/_gpasswd @@ -1,21 +1,12 @@ #compdef gpasswd -local curcontext=$curcontext state state_descr line -typeset -A opt_args -_arguments -C -w -s \ +_arguments -s \ '(-a --add -d --delete)'{-a,--add}'[add user to group]: : _users' \ '(-d --delete -a --add)'{-d,--delete}'[remove user from group]: : _users' \ - '(-h --help)'{-h,--help}'[display help]' \ - '(-Q --root)'{-Q,--root}'[directory to chroot into]: : _files -/' \ + '(-)'{-h,--help}'[display help]' \ + '(-Q --root)'{-Q,--root}'[specify directory to chroot into]: : _files -/' \ '(-r --remove-password)'{-r,--remove-password}'[remove the group password]' \ '(-R --restrict)'{-R,--restrict}'[restrict access to GROUP to its members]' \ - '(-M --members -A --administrators)'{-M,--members}'[set the list of members of GROUP]: :->users' \ - '(-A --administrators -M --members)'{-A,--administrators}'[set the list of admins for GROUP]: :->users' \ + '(-M --members -A --administrators)'{-M,--members}'[set the list of members of GROUP]: :_sequence _users' \ + '(-A --administrators -M --members)'{-A,--administrators}'[set the list of admins for GROUP]: :_sequence _users' \ '1: : _groups' - -if [[ $state == users ]]; then - local -a ignore - compset -P '*,'; compset -S ',*' - ignore=( ${(s:,:)IPREFIX} ${(s:,:)ISUFFIX} ) - _users -F ignore -qS , -fi diff --git a/Completion/Linux/Command/_iconvconfig b/Completion/Linux/Command/_iconvconfig new file mode 100644 index 000000000..a10e134e1 --- /dev/null +++ b/Completion/Linux/Command/_iconvconfig @@ -0,0 +1,13 @@ +#compdef iconvconfig + +local exargs="-? --help --usage -V --version" + +_arguments -S -s \ + "($exargs)--nostdlib[do not search system directory]" \ + "(-o --output $exargs)"{-o+,--output=}'[specify output file]:output file:_files' \ + "($exargs)--prefix=[specify system dir prefix]:prefix:_files" \ + '(- *)'{-\?,--help}'[display help information]' \ + '(- *)--usage[display a short usage message]' \ + '(- *)'{-V,--version}'[print program version]' \ + '*:directory:_files -/' \ + && return 0 diff --git a/Completion/Linux/Command/_iwconfig b/Completion/Linux/Command/_iwconfig index 30892fb6d..07c028be4 100644 --- a/Completion/Linux/Command/_iwconfig +++ b/Completion/Linux/Command/_iwconfig @@ -50,7 +50,7 @@ if [[ -n "$state" ]]; then 'essid[set the network name]' \ '(nwid domain)'{nwid,domain}'[set the network ID]' \ '(freq channel)'{freq,channel}'[set the operating frequency or channel]' \ - 'sens[set the sensitivity threhold]' \ + 'sens[set the sensitivity threshold]' \ 'mode[set operating mode]' \ 'ap[register with given access point]' \ '(nick nickname)'nick{,name}'[set the nickname]' \ @@ -62,7 +62,7 @@ if [[ -n "$state" ]]; then 'txpower[set transmit power]' \ 'retry[set number of retries]' \ 'modu[force a specific set of modulations]' \ - 'commit[apply changes imediately]' && ret=0 + 'commit[apply changes immediately]' && ret=0 ;; esac fi diff --git a/Completion/Linux/Command/_lsblk b/Completion/Linux/Command/_lsblk new file mode 100644 index 000000000..e1863cd06 --- /dev/null +++ b/Completion/Linux/Command/_lsblk @@ -0,0 +1,57 @@ +#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 -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/_ltrace b/Completion/Linux/Command/_ltrace new file mode 100644 index 000000000..e48d8ec98 --- /dev/null +++ b/Completion/Linux/Command/_ltrace @@ -0,0 +1,35 @@ +#compdef ltrace + +local root hlp="-h --help -V --version" + +(( EUID )) && root='!' + +_arguments -s -S $args \ + "(-c -a --align $hlp)"{-a+,--align=}"[align return values in a secific column]:column [$((COLUMNS*5/8))]" \ + "(-c $hlp)-A+[specify maximum number of array elements to print]:elements" \ + "(-c -b --no-signals $hlp)"{-b,--no-signals}"[don't print signals]" \ + "(-a --align -A -b --no-signals -i -n --indent -r -s -t -tt -ttt -T $hlp)-c[count time and calls, and report a summary on exit]" \ + "(-C --demangle $hlp)"{-C,--demangle}'[decode low-level symbol names into user-level names]' \ + "(-D --debug $hlp)"{-D+,--debug=}'[enable debugging]:mask:(help 77)' \ + "($hlp)*-e+[modify which library calls to trace]:filter" \ + "($hlp)-f[trace child processes]" \ + "($hlp)*"{-F+,--config=}'[load alternate configuration file]:file:_files' \ + '(- 1 *)'{-h,--help}'[display help information]' \ + "(-c $hlp)-i[print instruction pointer at time of call]" \ + "(-l --library $hlp)"{-l+,--library=}'[only trace symbols implemented by specified library]:library:_files' \ + "($hlp)-L[don't display library calls]" \ + "(-c -n --indent $hlp)"{-n+,--indent=}'[specify indent for each level of call nesting]:spaces' \ + "(-o --output $hlp)"{-o+,--output=}'[write the trace output to specified file]:file:_files' \ + "(: $hlp)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids" \ + "(-c $hlp)-r[print relative timestamps]" \ + "(-c $hlp)-s+[specify the maximum string size to print]:maximum string size [32]" \ + "($hlp)-S[trace system calls as well as library calls]" \ + "(-c -ttt $hlp)-t[prefix each line of the trace with the time of day]" \ + "(-c -ttt -tt $hlp)-tt[prefix each line of the trace with the time of day including the microseconds]" \ + "(-c -tt -t $hlp)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]" \ + "(-c $hlp)-T[show the time spent in each call]" \ + "${root}-u+[run as specified user]:user:_users" \ + '(- 1 *)'{-V,--version}'[display version information]' \ + "($hlp)*-x+[modify which static functions to trace]:filter" \ + '(-):command name: _command_names -e' \ + '*::arguments:_normal' diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm index 940eb6887..b6dce7ccb 100644 --- a/Completion/Linux/Command/_mdadm +++ b/Completion/Linux/Command/_mdadm @@ -56,15 +56,15 @@ _layouts () { 'f9[far copies]' ;; faulty) - _values -S \ "Failure mode" \ + _values -S \ "failure mode" \ {write-transient,wt}'[write-transient]' \ {read-transient,rt}'[read-transient]' \ - {write-presistent,wp}'[write-presistent]' \ - {read-presistent,rp}'[read-presistent]' \ + {write-persistent,wp}'[write-persistent]' \ + {read-persistent,rp}'[read-persistent]' \ write-all'[write-all]' \ {read-fixable,rf}'[read-fixable]' \ {clear,none}'[remove any pending or periodic failure modes]' \ - flush'[clear any persistant faults]' + flush'[clear any persistent faults]' esac } @@ -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/_modutils b/Completion/Linux/Command/_modutils index 0732aa106..7de97f60e 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -123,7 +123,7 @@ _modutils() { ;; params) - if compset -P '*='; then + if compset -P 1 '*='; then _message -e value 'parameter value' else local params diff --git a/Completion/Linux/Command/_pidof b/Completion/Linux/Command/_pidof new file mode 100644 index 000000000..6605e7e67 --- /dev/null +++ b/Completion/Linux/Command/_pidof @@ -0,0 +1,24 @@ +#compdef pidof + +local curcontext="$curcontext" state line expl ret=1 +typeset -A opt_args + +local exargs="-h --help -V --version" +_arguments -C -s -w \ + '(- *)'{-h,--help}'[display help information]' \ + '(- *)'{-V,--version}'[print program version]' \ + "(-s --single-shot $exargs)"{-s,--single-shot}'[return one PID only]' \ + "(-c --check-root $exargs)"{-c,--check-root}'[omit processes with different root]' \ + "(-x $exargs)"-x'[include shells running named scripts]' \ + "($exargs)"\*{-o+,--omit-pid}'[omit processes with PIDs]:pids:_sequence -s , _pids' \ + '*:process:->procnames' \ + && return 0 + +case $state in + procnames) + # Handle defunct processes and "avahi-daemon:" + _wanted process-names expl process compadd ${${${${${(@)${(f)"$(ps -N --ppid 2 -p 2 o args=)"}%% *}##*/}%:}#\[}%]} && ret=0 + ;; +esac + +return ret diff --git a/Completion/Linux/Command/_pkgtool b/Completion/Linux/Command/_pkgtool index 916e9e33f..cb14099b9 100644 --- a/Completion/Linux/Command/_pkgtool +++ b/Completion/Linux/Command/_pkgtool @@ -1,4 +1,4 @@ -#compdef installpkg upgradepkg removepkg pkgtool explodepkg makepkg +#compdef installpkg upgradepkg removepkg pkgtool explodepkg makepkg local expl diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index 95aa798db..90d83a4c4 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -19,6 +19,11 @@ _arguments -C -s \ "($info -p --processes)"{-p,--processes}'[show process using each socket]' \ "($info -i --info)"{-i,--info}'[show internal TCP information]' \ "($info -s --summary)"{-s,--summary}'[print summary statistics]' \ + "($info -b --bpf)"{-b,--bpf}'[show bpf filter socket information]' \ + "($info -E --events)"{-E,--events}'[continually display sockets as they are destroyed]' \ + "($info -Z --context)"{-Z,--context}'[display process SELinux security contexts]' \ + "($info -z --contexts)"{-z,--contexts}'[display process and socket SELinux security contexts]' \ + "($info -N --net)"{-N,--net}'[switch to specified network namespace]:network namespace' \ "($info -4 --ipv4 -6 --ipv6)"{-4,--ipv4}'[display only IP version 4 sockets]' \ "($info -4 --ipv4 -6 --ipv6)"{-6,--ipv6}'[display only IP version 6 sockets]' \ "($info -0 --packet)"{-0,--packet}'[display PACKET sockets]' \ @@ -27,8 +32,10 @@ _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)' \ - "($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 packet_raw packet_dgram' \ + "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix)' \ + "($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 -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 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 d6dabfd24..cbf95d6c4 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -1,119 +1,101 @@ -#compdef strace +#compdef strace strace64 -# TODO: -# - make _sys_calls system-dependent -# - allow negated calls (e.g. -e!write) -_sys_calls () { - local expl - local -a sys_calls +local curcontext="$curcontext" state line root expl ret=1 +typeset -A opt_args - sys_calls=(_llseek _newselect _sysctl accept access acct - adjtimex afs_syscall alarm bdflush bind break brk cacheflush - capget capset chdir chmod chown chown32 chroot clone close connect - creat create_module delete_module dup dup2 execve exit fchdir - fchmod fchown fchown32 fcntl fcntl64 fdatasync flock fork fstat - fstat64 fstatfs fsync ftime ftruncate ftruncate64 get_kernel_syms - getcwd getdents getdents64 getegid getegid32 geteuid geteuid32 - getgid getgid32 getgroups getgroups32 getitimer getpagesize getpeername - getpmsg getpgid getpgrp getpid getppid getpriority getresgid getresgid32 - getresuid getresuid32 getrlimit getrusage getsid getsockname getsockopt - gettid gettimeofday getuid getuid32 gtty idle init_module ioctl ioperm - iopl ipc kill lchown lchown32 link listen lock lseek lstat lstat64 - madvise mincore mkdir mknod mlock mlockall mmap modify_ldt mount mprotect - mpx mremap msync munlock munlockall munmap nanosleep nfsservctl nice - oldfstat oldlstat oldolduname oldstat oldumount olduname open pause - personality phys pipe pivot_root poll prctl pread prof profil ptrace - putpmsg pwrite query_module quotactl read readahead readdir readlink - readv reboot recv recvfrom recvmsg rename rmdir rt_sigaction - rt_sigpending rt_sigprocmask rt_sigqueueinfo rt_sigreturn rt_sigsuspend - rt_sigtimedwait sched_get_priority_max sched_get_priority_min - sched_getparam sched_getscheduler sched_rr_get_interval sched_setparam - sched_setscheduler sched_yield security select sendfile send sendmsg sendto - setdomainname setfsgid setfsgid32 setfsuid setfsuid32 setgid setgid32 - setgroups setgroups32 sethostname setitimer setpgid setpriority setregid - setregid32 setresgid setresgid32 setresuid setresuid32 setreuid setreuid32 - setrlimit setsid setsockopt settimeofday setuid setuid32 setup sgetmask - shutdown sigaction sigaltstack signal sigpending sigprocmask sigreturn - sigsuspend socket socketcall socketpair ssetmask stat stat64 statfs stime - stty swapoff swapon symlink sync sysfs sysinfo syslog time times truncate - truncate64 ulimit umask umount uname unlink uselib ustat utime vfork vhangup - vm86 vm86old wait4 waitpid write writev) +(( EUID )) && root='!' - for t in ${(s:,:)${PREFIX}}; do - sys_calls=( ${sys_calls:#$t} ) - done - compset -P '*,' - _wanted sys_calls expl 'System calls' compadd -qS , -a sys_calls -} +_arguments -C -s \ + '-a+[align return values in a specific column]:column number [40]' \ + '(-c)-i[print instruction pointer at time of syscall]' \ + '-o+[write the trace output to the file]:output file:->file-pipe' \ + '-q[suppress messages about attaching, detaching etc.]' \ + '(-q)-qq[suppress messages about process exit status]' \ + '(-c)-r[print a relative timestamp upon entry to each system call]' \ + '-s+[specify the maximum string size to print]:maximum string size [32]' \ + '(-c -ttt)-t[prefix each line of the trace with the time of day]' \ + '(-c -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ + '(-c -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ + '(-c)-T[show the time spent in system calls]' \ + '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \ + '(-x)-xx[print all strings in hexadecimal string format]' \ + '(-c -yy)-y[print paths associated with file descriptor arguments]' \ + '(-c -y)-yy[print protocol specific information associated with socket file descriptors]' \ + '(-C -i -k -r -ff -t -tt -ttt -T -y -yy)-c[count time, calls, and errors for each system call and report a summary]' \ + '(-c)-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ + '-O+[overhead for tracing system calls]:overhead (microseconds)' \ + '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort criterion:(time calls name nothing)' \ + '-w[summarise syscall latency]' \ + '*-e+[select events to trace or how to trace]:system call:->expressions' \ + '*-P+[trace only system calls accessing given path]:path:_files' \ + '-b+[detach from process on specified syscall]:syscall:(execve)' \ + '-f[trace child processes as they are created by currently traced processes]' \ + '(-c -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \ + '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ + '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default with -o)" 4\:"fatal signals and SIGTSTP are always blocked"))' \ + '*-E+[set or remove exported environment variable]:variable:->envars' \ + "${root}-u+[run as specified user]:user:_users" \ + '(:)*-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ + '-d[show debug output of strace itself on standard error]' \ + '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \ + '(- 1 *)-h[display help information]' \ + '(- 1 *)-V[display version information]' \ + '(-c)-k[obtain stack trace between each syscall]' \ + '(-):command name: _command_names -e' \ + '*::arguments:_normal' && ret=0 -_sets () { - _alternative \ - 'special:special values:(all none)' \ - 'calls::_sys_calls' -} +case $state in + expressions) + _values -C -S = 'qualifying expression' \ + 'trace[trace specified set of system calls only]:system calls:->syscalls' \ + 'abbrev[abbreviate the output from printing each member of large structures]:system call:_sequence _sys_calls -a -n' \ + 'verbose[dereference structures for the specified set of system calls]:system call:_sequence _sys_calls -a -n' \ + '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 + if [[ $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 + fi + ;; + file-pipe) + compset -P '\\' + if (( ! $+opt_args[-ff] )) && compset -P '(!|\|)'; then + compset -q + if (( CURRENT == 1 )); then + _command_names -e && ret=0 + else + _normal && ret=0 + fi + else + _files && ret=0 + fi + ;; + envars) + if [[ -prefix *=* ]]; then + compstate[parameter]="${PREFIX%%\=*}" + compset -P 1 '*=' + _value && ret=0 + else + _parameters -qS= -g "*export*" && ret=0 + fi + ;; +esac -_traces () { - local expl - traces=('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') - compset -P '*,' - _describe -t traces 'Related system calls' traces -qS , -} - -_traces_sets () { - _alternative \ - 'traces::_traces' \ - 'sets::_sets' -} - -_expression () { - _values -S = "Qualifying expression" \ - 'trace[trace specified set of system calls only]:system calls:_traces_sets' \ - 'abbrev[abbreviate the output from printing each member of large structures]:system calls:_sets' \ - 'verbose[dereference structures for the specified set of system calls]:system calls:_sets' \ - 'raw[print raw, undecoded arguments for the specified set of system calls]:system calls:_sets' \ - 'signal[trace only the specified subset of signals]:signal:{compset -P "*,"; _signals -s -qS ,}' \ - 'read[perform a full hex and ASCII dump of all the data read from listed file descriptors]:file descriptors:{compset -P "*,"; _file_descriptors -qS ,}' \ - 'write[perform a full hex and ASCII dump of all the data written to listed file descriptors]:file descriptors:{compset -P "*,"; _file_descriptors -qS ,}' - if [[ -z "$words[CURRENT]" || -n "${words[CURRENT]:#*=*}" ]]; then - _traces_sets - fi -} - -_arguments \ - '()-c[count time, calls, and errors for each system call and report a summary]' \ - '()-C[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ - '-d[show some debugging output of strace itself on the standard error]' \ - '-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ - '-f[trace child processes as they are created by currently traced processes]' \ - '-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \ - '(-c -d -f -ff -i -q -r -t -tt -ttt -T -v -V -x -xx -a -e -o -O -p -s -S -u -E)-h[print help]' \ - '-i[print the instruction pointer at the time of the system call]' \ - '-q[suppress messages about attaching, detaching etc.]' \ - '-r[print a relative timestamp upon entry to each system call]' \ - '(-ttt)-t[prefix each line of the trace with the time of day]' \ - '(-ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ - '(-tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ - '-T[show the time spent in system calls]' \ - '-y[print paths associated with file descriptor arguments]' \ - '-v[print unabbreviated versions of environment, stat, termios, etc. calls]' \ - '(-c -d -f -ff -h -i -q -r -t -tt -ttt -T -v -x -xx -a -e -o -O -p -s -S -u -E)-V[print the version number of strace]' \ - '(-xx)-x[print all non-ASCII strings in hexadecimal string format]' \ - '(-x)-xx[print all strings in hexadecimal string format]' \ - '-I+[when strace can be interrupted by signals]:interruptible:((1\:"no signals are blocked" 2\:"fatal signals are blocked while decoding syscall (default)" 3\:"fatal signals are always blocked (default if '\''-o FILE PROG'\''" 4\:"fatal signals and SIGTSTP are always blocked"))' \ - '*-P+[trace only system calls accessing given path]:path:_files' \ - '-a+[align return values in a specific column (default 40)]:column number' \ - '*-e+[select events to trace or how to trace]:system call:_expression' \ - '-o+[write the trace output to the file]:output file:_files' \ - '-O+[overhead for tracing system calls]:overhead microseconds' \ - '(:)-p+[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ - '-s+[specify the maximum string size to print (default 32)]:maximum string size' \ - '-S+[sort the output of the histogram (-c option) by the specified criterion]:sort by:(time calls name nothing)' \ - '-u+[run as specified user]:user:_users' \ - '*-E+[remove variable from the inherited list of environment or define a value]:variable:_printenv' \ - '(-):command name: _command_names -e' \ - '*::arguments:_normal' +return ret diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index 2a7128c23..e976b4705 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -1,4 +1,4 @@ -#compdef -P mpstat (|cifs)iostat isag sadf sar pidstat +#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. @@ -10,24 +10,8 @@ _mpstat() { '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ '-u[report CPU utilization]' \ '-V[print version number]' \ - '1:interval' \ - '2:count' -} - -_iostat() { - _arguments : \ - '-c[display CPU utilization report]' \ - '-d[display device utilization report]' \ - '-T[only display global statistics for group_name]' \ - '-g[display statistics for a group of devices]:group name' \ - '-h[human readable device utilization report]' \ - '-j[display persistent device name]' \ - '(-m)-k[display statistics in kB/s]' \ - '(-k)-m[display statistics in MB/s]' \ - '-N[display registered device mapper names]' \ - '::device:_files -W /dev -g "*(-%)"' \ - ': :_guard "[0-9]#" "interval"' \ - ':count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _cifsiostat() { @@ -37,8 +21,8 @@ _cifsiostat() { '(-k)-m[display statistics in MB/s]' \ '-t[print timestamp for each report]' \ '-V[print version number]' \ - '1:interval' \ - '2:count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _isag() { @@ -68,8 +52,8 @@ _sadf() { '(-t -T)-U[display in seconds since epoch (UTC)]' \ '-V[print version number]' \ '(-j -d -p)-x[output file in XML]' \ - '1:interval' \ - '2:count' \ + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' \ '3:data file:_files' && ret=0 else _arguments : '*::sar: _sar' && ret=0 @@ -107,8 +91,8 @@ _sar() { '-W[report swapping statistics]' \ '-w[report task creation and system switching activity]' \ '-y[report TTY device activity]' \ - '1:interval' \ - '2:count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _pidstat() { @@ -128,7 +112,8 @@ _pidstat() { '-V[print version number]' \ '-v[display values from kernel table]' \ '-w[report task switching activity]' \ - ':interval' ':count' + '1: : _guard "^-*" interval' \ + '2: : _guard "^-*" count' } _sysstat() { diff --git a/Completion/Linux/Command/_vserver b/Completion/Linux/Command/_vserver index 2401387e5..36a61c45a 100644 --- a/Completion/Linux/Command/_vserver +++ b/Completion/Linux/Command/_vserver @@ -95,7 +95,7 @@ _vserver_cache_cfgdir() { _vserver_cache_vsnames() { if [[ "$_cache_vserver_vsnames_initialized" != true ]]; then typeset -ga _cache_vserver_vsnames - _cache_vserver_vsnames=( $(ls -d $_cache_vserver_cfgdir/*/ | sed -e s,$_cache_vserver_cfgdir,, | tr -d '/') ) + _cache_vserver_vsnames=( $_cache_vserver_cfgdir/*(/:t) ) _cache_vserver_vsnames_initialized=true fi } |