diff options
Diffstat (limited to 'Completion')
329 files changed, 10969 insertions, 4492 deletions
diff --git a/Completion/BSD/Command/_bsd_pkg b/Completion/BSD/Command/_bsd_pkg index 25d4f346a..82cf6226c 100644 --- a/Completion/BSD/Command/_bsd_pkg +++ b/Completion/BSD/Command/_bsd_pkg @@ -78,12 +78,12 @@ _bsd_pkg() { ;; openbsd*) flags+=( - '-A[arch to assume for any package tests]:architecture:_obsd_architectures' + '-A+[arch to assume for any package tests]:architecture:_obsd_architectures' '-a[do not record packages as installed manually]' '-aa[force already installed packages to be tagged as installed automatically]' - '-B[specify destdir prefix]:destdir directory:_files -/' + '-B+[specify destdir prefix]:destdir directory:_files -/' '-c[while replacing packages, delete extra configuration file in the old package]' - '-D[specify failsafe to waive]:failsafe:(( + '*-D+[specify failsafe to waive]:failsafe:(( allversions\:"do not trim older p* variants of packages for updates" arch\:"architecture recorded in package may not match" checksum\:"verify checksums before deleting or tying old files" @@ -91,9 +91,7 @@ _bsd_pkg() { donttie\:"do not try to find new files in old packages by comparing the stored sha256" downgrade\:"do not filter out package versions older than what is currently installed" installed\:"in update mode, reinstall an existing package with the same update signature" - libdepends\:"library specifications may not be fulfilled" nonroot\:"install even if not running as root" - paranoid\:"do not run any @exec/@unexec" repair\:"attempt to repair installed packages with missing registration data" scripts\:"external scripts may fail" SIGNER\:"list of trusted signers, separated by commas" @@ -103,10 +101,10 @@ _bsd_pkg() { ))' '-I[force non-interactive mode]' '-i[force interactive mode]' - '-L[specify a localbase]:localbase:_files -/' - '-l[specify pkg_info output file to install]:pkg_info file:_files' + '-L+[specify a localbase]:localbase:_files -/' + '-l+[specify pkg_info output file to install]:pkg_info file:_files' '-m[always display progress meter]' - '-P[check distribution permissions]:permission type:(cdrom ftp)' + '-P+[check distribution permissions]:permission type:(ftp)' "-qq[don't check checksums]" '-r[replace existing packages]' "-s[don't install; just report disk size changes]" @@ -143,25 +141,28 @@ _bsd_pkg() { case "$OSTYPE" in netbsd*) flags+=( - '(:)-a[delete all installed packages]' + '(:)-A[remove automatically installed packages that are no longer required]' "-D[don't execute deinstallation scripts]" '-F[specify each package by an installed file]' '-f[force deinstallation]' - '-K[override PKG_DBDIR]:pkg_dbdir:_files -/' + '-ff[force deinstallation even if preserved]' + '-K+[override PKG_DBDIR]:pkg_dbdir:_files -/' + '-k[silently skip preserved packages]' + '-N[leave the files installed]' "-O[only delete the package's entries]" - '-P[specify destdir prefix]:destdir directory:_files -/' - '-p[specify prefix]:prefix directory:_files -/' + '-P+[specify destdir prefix]:destdir directory:_files -/' + '-p+[specify prefix]:prefix directory:_files -/' '-R[delete upward recursively]' '-r[delete recursively]' '-V[show version and exit]' - '(-a)*:package name:_bsd_pkg_pkgs_and_files' + '*:package name:_bsd_pkg_pkgs_and_files' ) ;; openbsd*) flags+=( '-a[delete unused dependencies]' - '-B[specify destdir prefix]:destdir directory:_files -/' - '-D[specify failsafe to waive]:failsafe:(( + '-B+[specify destdir prefix]:destdir directory:_files -/' + '*-D+[specify failsafe to waive]:failsafe:(( baddepend\:"force deletion of packages even if they reference nonexistent dependencies" checksum\:"verify checksums before deleting or tying old files" dependencies\:"delete the set of packages that depend upon the requested packages" @@ -189,11 +190,11 @@ _bsd_pkg() { '(:)-a[show all installed packages]' '-c[show comment fields]' '-d[show long descriptions]' - '-e[test if package is installed]:package name:_bsd_pkg_pkgs' + '-e+[test if package is installed]:package name:_bsd_pkg_pkgs' '-f[show packing list instructions]' '-I[show index lines]' '-L[show full pathnames of files]' - '-l[specify prefix string]:prefix string:' + '-l+[specify prefix string]:prefix string:' '-q[be quiet]' '-R[show list of installed requiring packages]' '-s[show total size occupied by each package]' @@ -209,13 +210,13 @@ _bsd_pkg() { '-D[show install-message files]' '-F[specify each package by an installed file]' '-i[show install scripts]' - '-K[override PKG_DBDIR]:pkg_dbdir:_files -/' + '-K+[override PKG_DBDIR]:pkg_dbdir:_files -/' '-k[show deinstall scripts]' '-m[show mtree files]' '-N[show which packages each package was built with]' '-n[show which packages each package needs]' '-p[show installation prefixes]' - '-Q[show the definition of the specified variable from the build information]:variable:' + '-Q+[show the definition of the specified variable from the build information]:variable:' '-r[show list of installed requiring packages recursively]' '-S[show total size occupied by each package and its dependents]' '-u[show information for all user-installed packages]' @@ -227,14 +228,19 @@ _bsd_pkg() { flags+=( '(:)-A[show all installed packages, including internal packages]' '-C[show certificate information]' + '*-D+[specify failsafe to waive]:failsafe:(( + SIGNER\:"list of trusted signers, separated by commas" + snap\:"force %c and %m to expand to snapshots" + unsigned\:"allow the installation of unsigned packages without warnings/errors" + ))' '-E[show the package that contains the specified file]:file:_files' # XXX only with -L '-K[prefix filenames with category keywords]' '-M[show the install-message file]' '-m[only show manual installations]' '-P[show the pkgpath]' - '-Q[show packages matching the specified query]:query:' - '-r[check the list of packages for a specified pkgspec]:pkgspec:' + '-Q+[show packages matching the specified query]:query:' + '-r+[check the list of packages for a specified pkgspec]:pkgspec:' '-S[show the update signature]' '-t[show packages not required by any other]' '-U[show the deinstall-message file]' diff --git a/Completion/BSD/Command/_freebsd-update b/Completion/BSD/Command/_freebsd-update index d42457272..7dd907298 100644 --- a/Completion/BSD/Command/_freebsd-update +++ b/Completion/BSD/Command/_freebsd-update @@ -5,9 +5,11 @@ flags=( '(cron)fetch[fetch a compressed snapshot or update existing one]' '(fetch)cron[sleep rand(3600) seconds, and then fetch updates]' '(install rollback)upgrade[fetch files necessary for upgrading to a new release]' + 'updatesready[check if there are fetched updates ready to install]' '(upgrade rollback)install[install the most recently fetched updates or upgrade]' '(upgrade install)rollback[uninstall the most recently installed updates]' 'IDS[compare the system against an index of "known good" files]' + 'showconfig[show configuration options after parsing conffile and command line options]' ) _arguments \ diff --git a/Completion/BSD/Command/_ipfw b/Completion/BSD/Command/_ipfw new file mode 100644 index 000000000..49d0ef1e8 --- /dev/null +++ b/Completion/BSD/Command/_ipfw @@ -0,0 +1,325 @@ +#compdef ipfw + +local word=$'/[^ \t\0]#[ \t\0]/' comma next pqs nat +local -a actions address pathname ropts ca +local -A opt_args nat_options + +_ipfw_tables() { + local -a expl match opts all + zparseopts -D -E -a opts M+: x+: X+: J+: V+: o+: 1 2 a=all + _description -x ipfw-tables expl 'table' + match=( ${${${(M)${(f)"$(_call_program ipfw-tables + ipfw table all info 2>/dev/null)"}:#-*}#*\(}%%\)*} ) + if (( $#all )); then + match+=( all ) + compadd -D match -a match + [[ $#PREFIX -eq 0 && $#match -eq 1 && $match[1] = all ]] && compstate[insert]='' + fi + compadd "$opts[@]" "$expl[@]" "$@" -a match +} + +_ipfw_rules() { + local -a rules + rules=( ${${(f)"$(_call_program ipfw-rules ipfw list)"}/ /:} ) + _describe -x -t ipfw-rules rule rules "$@" +} + +ropts=( # rule options + bridged + defer-{immediate-,}action diverted{,-loopback,-output} + dst-{ip{,6,v6},port} established ext6hdr + fib flow flow-id frag gid jail + icmptypes icmp6types in out + ipid iplen ipoptions ipprecedence ipsec iptos dscp ipttl ipversion + keep-state layer2 limit lookup + MAC mac-type proto record-state recv xmit via + set-limit setup sockarg + src-{ip,ip6,port} tagged + tcpack tcpdatalen tcpflags tcpmss tcpseq tcpwin tcpoptions + uid verrevpath versrcreach antispoof +) + +nat_options=( + nat64lsn "prefix4 prefix6 states_chunk host_del_age pg_del_age tcp_syn_age tcp_est_age tcp_close_age udp_age icmp_age log -log allow_private -allow_private" + nat64stl "prefix6 table4 table6 log -log allow_private -allow_private" + nat64clat "clat_prefix plat_prefix log -log allow_private -allow_private" + nptv6 "int_prefix ext_prefix ext_if prefixlen" +) + +ca=( compadd -S " " -r " $compstate[quote]\t\n\-" ) + +address=( + \( $'/not[ \t\0]/' ':operators:operator:$ca not' \| \) + \( $'/(any|me|me6)[ \t\0]/' ':addresses:address:$ca any me me6' + \| '/table??/' ':tables:table:compadd -S "" -s\( table' + $word ':tables:table:_ipfw_tables -s\) -S ""' + \| // -'comma=0' + \( + // -'(( ! comma ))' + \( $'/[^, \t\0]#/' $'%[, \t\0]%' ':hosts:ip or host:_hosts -S, -r "/: \t\n\-"' + \| $'/[^},/:]##//' '/[]/' ': _message -e numbers "mask length"' + \| $'/[^},/:]##:/' '/[]/' ': _message -e numbers "mask"' + \| $'/([0-9]##.)(#c3)[0-9]##/' '/[]/' ':symbols:symbol:compadd -S "" / : ,' + \| // '%[1-9]%' '/[]/' ': _message -e ip-addresses "IP address"' \) + \( /,/ -'comma=0' \| // -'comma=1' \) + $'/([ \t\0]|)/' + \) \# + // -'(( comma ))' + \) +) +address=( + \( $'/[({][ \t]\0/' -'next=1' ':symbols:symbol:$ca - {' + \( // -'(( next ))' $address + \( $'/or[ \t\0]/' -'next=1' ':symbols:symbol:$ca - or \}' \| // -'next=0' \) + \) \# + $'/[})][ \t\0]/' + \| $address \) + \( + \( $'/not[ \t\0]/' ':specifiers:specifier:$ca - not' \| \) + $word -$'[[ $match != to? && -z ${(M)ropts:#${match%?}} ]]' ':ports:port:_sequence _ports' + \| \) +) + +actions=( + $'/[^\0]##\0(-[a-zA-Z0-9]##[ \t]#)#/' # skip over options, completed by _arguments but can + \( # be quoted in one argument which that doesn't handle + $'/add[ \t\0]/' ':firewall-commands:firewall configuration:$ca add' + \( $'/<->[ \t\0]/' ': _guard "[0-9]#" "rule number (00000-65535)"' \| \) + \( $'/set[ \t\0]/' ':specifiers:specifier:$ca set' $word ':sets:set:$ca -o numeric {0..31}' \| \) + \( $'/prob[ \t\0]/' ':specifiers:specifier:$ca prob' $word ': _message -e probabilities "match probability (0.0-1.0)"' \| \) + \( # rule actions + $'/check-state[ \t\0]/' $word ': _message -e flow-names "flow name"' + \| + \( $'/(divert|tee)[ \t\0]/' $word ': _message -e ports port' + \| $'/(fwd|forward)[ \t\0]/' + \( $word ': _guard "[0-9]#" "ip address"' + \| '/[^\0]#,/' ':specials:special:compadd -qS, tablearg' + $word ':ports:port:_ports -qS " "' \) + \| $'/(nat*|nptv6)[ \t\0]/' + \( $word ': _guard "[0-9]#" "nat instance"' + \| $word ':specials:special:$ca global tablearg' \) + \| $'/pipe[ \t\0]/' $word ': _message -e pipes "dummynet pipe"' + \| $'/queue[ \t\0]/' $word ': _message -e queues "dummynet queue"' + \| $'/(skipto|call)[ \t\0]/' \( /t/+ $word ':specials:special:$ca tablearg' \| '/[]/' ':ipfw-rules:rule:_ipfw_rules -qS " "' \) + \| $'/unreach[ \t\0]/' $word ':codes:code:$ca net host protocol port needfrag srcfail net-unknown host-unknown isolated net-prohib host-prohib tosnet toshost filter-prohib host-precedence precedence-cutoff' + \| $'/unreach6[ \t\0]/' $word ':codes:code:$ca no-route admin-prohib address port' + \| $'/(netgraph|ngtee)[ \t\0]/' $word ': _message -e cookies cookie' + \| $'/setfib[ \t\0]/' \( $word ': _guard "[0-9]#" "routing table"' \| '/[]/' ':specials:special:$ca tablearg' \) + \| $'/setdscp[ \t\0]/' \( $word ':dscps:dscp:$ca cs{0..7} af{1,2,3,4}{1,2,3} ef be' \| '/[]/' ':specials:special:$ca tablearg' \) + \| $'/tcp-setmss[ \t\0]/' $word ': _message -e mss mss' + \| $word \) + \( $'/log[ \t\0]/' ':specifiers:specifier:$ca log' + \( $'/logamount[ \t\0]/' ':specifiers:specifier:$ca logamount' $word ': _message -e limits "maximum count"' \| \) + \| \) + \( $'/altq[ \t\0]/' ':specifiers:specifier:$ca altq' $word ': _message -e queues queue' \| \) + \( $'/(tag|untag)[ \t\0]/' ':specifiers:specifier:$ca tag untag' $word ': _message -e numbers "tag (1-65534)"' \| \) + # rule body + \( \( $'/not[ \t\0]/' ':operators:operator:$ca not' \| \) + $'/(ip(v|)(4|6|)|all|icmp|ip|tcp|udp|sctp)[ \t\0]/' ':protocols:protocol:$ca ip ip4 ipv4 ip6 ipv6 all icmp tcp udp sctp' + $'/from[ \t\0]/' ':specifiers:specifier:$ca from' + $address + $'/to[ \t\0]/' ':specifiers:specifier:$ca to' + $address + \| \) + # rule options + \( $'///[ \t\0]/' ':rule-options:rule option:((//\:comment))' // ': _message -e comments comment' + \| $'/(dst|src)-ip(|6|v6)[ \t\0]/' $word ': _message -e addresses address' + \| $'/(dst|src)-port[ \t\0]/' $word ':ports:port:_sequence _ports' + \| $'/ext6hdr[ \t\0]/' $word ':headers:extended header:_sequence compadd - frag hopopt route rthdr0 rthdr2 dstopt ah esp' + \| $'/fib[ \t\0]/' $word ': _message -e routing-tables "routing table"' + \| $'/flow[ \t\0]/' '/table??/' ':tables:table:compadd -S "" -s\( table' + $word ':tables:table:_ipfw_tables -s\) -S ""' + \| $'/flow-id[ \t\0]/' $word ': _message -e flow-labels "flow label"' + \| $'/frag[ \t\0]/' $word ':fragmentation options:fragmentation option:_sequence compadd - df mf rf offset' + \| $'/gid[ \t\0]/' $word ':groups:group:_groups' + \| $'/jail[ \t\0]/' $word ':jails:jail:_jails' + \| $'/ipoptions[ \t\0]/' $word ':ip-options:ip option:_sequence compadd - ssrr lsrr rr ts' + \| $'/iptos[ \t\0]/' $word ':tos-fields:tos field:_sequence compadd - lowdelay throughput reliability mincost congestion' + \| $'/(set-|)limit[ \t\0]/' $word ':parameters:parameter to limit:$ca {src,dsr}-{addr,port}' + $word ': _message -e numbers "connection limit"' + \| $'/lookup[ \t\0]/' $word ':fields:field:$ca {src,dst}-{ip,port} uid jail' + $word ': _message -e names name' + \| $'/(#i)mac[ \t\0]/' $word ': _message -e mac-addresses "destination mac"' + $word ': _message -e mac-addresses "source mac"' + \| $'/proto[ \t\0]/' $word ': _message -e protocols "IP protocol"' + \| $'/(recv|xmit|via)[ \t\0]/' + \( $word ':interfaces:interface:_net_interfaces -qS " "' + \| $word ':ipfw-tables:table:_ipfw_tables -qS " "' + \| $'/any[ \t\0]/' ':interfaces:interface:$ca any' \) + \| $'/tcpflags[ \t\0]/' $word ':tcp-flags:tcp flag:_sequence compadd - fin syn rst psh ack urg' + \| $'/tcpoptions[ \t\0]/' $word ':tcp-options:tcp option:_sequence compadd - mss window sack ts cc' + \| $'/uid[ \t\0]/' $word ':users:user:_users -qS " "' + \| $'/(icmp(|6)types|ipid|iplen|ipprecedence|dscp|ipttl|ipversion|keep-state|mac-type|tagged|tcp(ack|datalen|mss|pack|seq|win))[ \t\0]/' $word ': _message -e values value' + \| $word ':rule-options:rule option:$ca -a ropts' + \) \# + \| + '/[]/' ':actions:action:$ca allow check-state count deny divert forward nat nat64lsn nat64stl nat64clat nptv6 pipe queue reset reset6 skipto call return tee unreach unreach6 netgraph setfib ngtee setfib setdscp tcp-setmss reass abort abort6' + \) + \| $'/set[ \t\0]show[ \t\0]/' + \| $'/set[ \t\0]move[ \t\0]/' + \( // %r% $'/rule[ \t\0]/' ': $ca rule' \| \) + $word ':ipfw-rules: :_ipfw_rules -qS " "' + $'/to[ \t\0]/' ': $ca to' + $word ':ipfw-rules: :_ipfw_rules' + \| $'/set[ \t\0]swap[ \t\0]/' + $word ':ipfw-sets:set:$ca -o numeric {0..31}' + $word ':ipfw-sets:set:compadd -o numeric {0..31}' + \| $'/set[ \t\0]/' '%[ed]%' + \( + $'/(en|dis)able[ \t\0]/' ':set-commands:set command:$ca -F line enable disable' + $'/<->[ \t\0]/' ':ipfw-sets:set:$ca -o numeric {0..31}' + $'/<->[ \t\0]/' ':ipfw-sets:set:$ca -o numeric {0..31}' \# + \) \# + \| + \( $'/set[ \t\0]/' ':firewall-commands:firewall configuration:$ca set' + \( $'/<->[ \t\0]/' ':sets:set:$ca -o numeric {0..31}' + \| '/[]/' ':set-commands:set command:$ca move swap show enable disable' \) + \| \) + \( $'/(list|show|delete)[ \t\0]/' ':firewall-commands:firewall configuration:$ca list show delete zero resetlog' + \( $'/[0-9]##-/' $word ':ipfw-rules: :_ipfw_rules -qS " "' + \| $word ':ipfw-rules: :_ipfw_rules -qS "-"' \) \# + \| $'/(zero|resetlog)[ \t\0]/' $word ':ipfw-rules: :_ipfw_rules -qS " "' \# + \| $'/flush[ \t\0]/' ':firewall-commands:firewall configuration:(flush)' + \| $'/table[ \t\0]/' ':commands:command:$ca table' + \( # lookup tables + $'/all[ \t\0]/' $word ':commands:table command:compadd destroy list info detail flush' + \| + $word ':tables:table:_ipfw_tables -a -qS " "' + \( $'/create[ \t\0]/' + \( $'/type[ \t\0]/' $word ':types:type:(addr iface number flow)' + \| $'/valtype[ \t\0]([^ \t\0]#,|)/' $word ':value-types:value type:compadd -qS, skipto pipe fib nat dscp tag divert netgraph limit ipv4 ipv6' + \| $'/algo[ \t\0]/' $word ':algorithms:lookup algorithm:$ca addr\:radix addr\:hash iface\:array number\:array flow\:hash' + \| $'/limit[ \t\0]/' $word ': _message -e numbers "maximum number of items"' + \| $word ':options:option:$ca -F line type valtype algo limit locked missing or-flush' \) \# + \| $'/modify[ \t\0]/' + $'/limit[ \t\0]/' ':options:option:$ca limit' + $word ': _message -e numbers "maximum number of items"' + \| $'/swap[ \t\0]/' + $word ':tables:table:_ipfw_tables -a' + \| $'/(atomic[ \t\0]|)add[ \t\0]/' \( + $word ': _message -e table-keys "table key"' + $word ': _message -e values value' \) \# + \| $'/delete[ \t\0]/' $word ': _message -e table-keys "table key"' \# + \| $'/lookup[ \t\0]/' $word ': _message -e addresses address' + \| + '/[]/' ':commands:table command:compadd - destroy lock unlock list info detail flush' + \| + $word ':commands:table command:$ca -Q - create modify swap add atomic\ add delete lookup' + \) + \) + \| $'/(nat64(lsn|stl|clat)|nptv6)[ \t\0]/' -'nat=${match%?}' ':commands:command:$ca nat64lsn nat64stl nat64clat nptv6' + $word ': _message -e names name' + \( $'/(config|create)[ \t\0]/' + \( $'/[^\0]#prefix([46]|)[ \t\0]/' $word ': _message -e prefixes prefix' + \| $'/states_chunks[ \t\0]/' $word ': _message -e numbers number' + \| $'/[^\0]#_age[ \t\0]/' ': _message -e seconds "age (seconds)"' + \| $'/table[46][ \t\0]/' $word ':ipfw-tables:ipfw table:_ipfw_tables -qS " "' + \| $'/ext_if[ \t\0]/' $word ':interfaces:interface:_net_interfaces -qS " "' + \| $'/prefixlen[ \t\0]/' ': _message -e lengths length' + \| $word ':options:option:$ca -F line $=nat_options[$nat]' \) \# + \| $'/(list|show)[ \t\0]/' + \( // -'[[ $nat = *lsn]' $word ':states:state:(states)' + \| // -'[[ $nat != *lsn]' \) + \| $'/stats[ \t\0]/' $word ':commands:command:(reset)' + \| + $word ':commands:command:$ca create config list show destroy stats' + \) + \) + \| # in-kernel NAT + $'/nat[ \t\0]/' ':commands:command:$ca nat' + $word ': _message -e numbers "nat instance"' + \( $'/config[ \t\0]/' + \( $'/if[ \t\0]/' $word ':interfaces:interface:_net_interfaces -qS " "' + \| $'/ip[ \t\0]/' $word ': _message -e ip-addresses "ip address"' + \| $'/redirect_addr[ \t\0]/' + $word ': _message -e ip-addresses "IP address"' + $word ': _message -e ip-addresses "IP address"' + \| $'/redirect_port[ \t\0]/' $word ':protocols:protocol:$ca sctp tcp udp' + '/[^:]##:/' ': _message -e ip-addresses "IP address"' + $word ':ports:port:_ports' + $word ':ports:port:_sequence _ports' + \| $'/redirect_proto[ \t\0]/' $word ':protocols:protocol:$ca sctp tcp udp' + $word ': _message -e ip-addresses "IP address"' + $word ': _message -e ip-addresses "IP address"' + \| $word ':parameters:config parameter:$ca ip if log deny_in same_ports unreg_only unreg_cgn reset reverse proxy_only skip_global redirect_port redirect_addr redirect_proto' + \) \# + \| $'/show[ \t\0]/' $word ':actions:action:(config log)' + \| '/[]/' ':commands:command:$ca config show' \) + \| # dummynet configuration + $'/(pipe|queue|sched)[ \t\0]/' -'pqs=${match%?}' ':dummynet-commands:dummynet configuration:$ca pipe queue sched' + $word ': _message -e numbers number' + $word ':options:config:$ca config' + \( $'/bw[ \t\0]/' + \( $word ':bandwidths: :_numbers -M "m:{a-z}={A-Z}" bandwidth {K,M,G}{bit,Byte}/s' + \| $word ':devices:device:_net_interfaces -qS " "' \) + \| $'/delay[ \t\0]/' $word ': _message -e numbers "propagation delay (ms)"' + \| $'/burst[ \t\0]/' $word ': _message -e numbers "size (bytes)"' + \| $'/profile[ \t\0]/' $word ':files:file:_files -qS " "' + \| $'/pipe[ \t\0]/' $word ': _message -e pipes pipe' + \| $'/weight[ \t\0]/' $word ': _message -e weights "weight (1-100) [1]"' + \| $'/type[ \t\0]/-' + \( $'/fq_(pie|codel)[ \t\0]/' + \( $'/limit[ \t\0]/' $word ': _message -e numbers "limit (packets) [10240]"' + \| $'/flows[ \t\0]/' $word ': _message -e numbers "flow queues [1024]"' + \| $'/quantum[ \t\0]/' ':parameters:parameter:$ca -F line quantum limit flows' \) \# + '/[]/' + \| $word ':types:scheduling algorithm:$ca fifo wf2q+ rr qfq fq_codel fq_pie fq_codel' \) + \| $'/buckets[ \t\0]/' $word ': _message -e sizes "hash table size (16-65536)"' + \| $'/mask[ \t\0]/' $word ':mask-specifiers:mask specifier:$ca dst-ip dst-ip6 src-ip src-ip6 dst-port src-port flow-id proto all' + \| $'/plr[ \t\0]/' $word ': _message -e numbers "packet loss rate (0.0-1.0)"' + \| $'/queue[ \t\0]/' $word ': _message -e sizes "queue size"' + \| $'/(red|gred)[ \t\0]/' $word ': _message -e thresholds thresholds' + \| $'/codel[ \t\0]/' + \( $'/(target|interval)[ \t\0]/' $word ': _message -e times "time (ms)"' + \| $'/(ecn|noecn)[ \t\0]/' ':options:option:$ca -F line target interval ecn noecn' \) \# + '/[]/' + \| $'/pie[ \t\0]/' + \( $'/(target|tupdate|max_burst)[ \t\0]/' $word ': _message -e times "time"' + \| $'/(alpha|beta)[ \t\0]/' $word ': _message -e weights weight' + \| $'/max_ecnth[ \t\0]/' $word ': _message -e probabilities probability' + \| $word ':options:option:$ca -F line alpha beta max_burst max_ecnth {,no}{ecn,capdrop,drand} onoff dre ts' \) \# + '/[]/' + \| // '-[[ $pqs = pipe ]]' $'/noerror[ \t\0]/' ':options:option:$ca -F line bw delay burst profile buckets mask noerror plr queue red gred codel pie' + \| // '-[[ $pqs = queue ]]' $'/noerror[ \t\0]/' ':options:option:$ca -F line pipe weight buckets mask noerror plr queue red gred codel pie' + \| // '-[[ $pqs = sched ]]' $'/[]/' ':options:option:$ca -F line type bw delay burst profile' + \) \# + \| # sysctl shortcuts + $'/(en|dis)able[ \t\0]/' ':sysctl-shortcuts:sysctl shortcut:$ca enable disable' + $word ':values:value:(firewall altq one_pass debug verbose dyn_keepalive)' + \| + $'/internal[ \t\0]/' ':commands:command:$ca internal' + $word ':lists:list:(iflist talist vlist)' + \) +) + +if (( $words[(I)-p*] )); then + pathname=( ':path:_files -P / -W /' ) +fi + +_regex_arguments _ipfw_actions "$actions[@]" + +if [[ -prefix *[$' \t']* ]]; then + # This allows from things like ipfw "-n add..." + _ipfw_actions + return +fi + +_arguments -s $pathname \ + '(-p)-a[show counter values when listing rules (implied by show)]' \ + '(-p)-b[show only the action and the comment]' \ + '-c[show rules in compact form]' \ + '(-p)-d[show dynamic rules in addition to static ones]' \ + '(-p)-D[act on dynamic states only]' \ + '-f[run without confirmation]' \ + '(- *)-h[display syntax summary]' \ + '(-p)-i[format values as IP addresses in table listings]' \ + '-n[only check syntax, make no changes]' \ + '-N[resolve addresses and service names in output]' \ + '-q[quiet output]' \ + '-S[show the set each rule belongs to]' \ + '(-p)-s+[sort pipes by field]:field (negative reverses):((0\:unsorted 1\:packets 2\:bytes 3\:total\ packets 4\:total\ bytes))' \ + '(-p -T)-t[show timestamp of last match, ctime() format]' \ + '(-p -t)-T[show timestamp of last match as seconds since epoch]' \ + '(-a -b -d -D -i -s -t -T *)-p+[specify preprocessor]:preprocessor:_command_names -e' \ + '*:::actions:= _ipfw_actions' + diff --git a/Completion/BSD/Command/_kdump b/Completion/BSD/Command/_kdump new file mode 100644 index 000000000..e5c7c4cce --- /dev/null +++ b/Completion/BSD/Command/_kdump @@ -0,0 +1,84 @@ +#compdef kdump + +_kdump_pid() { + local -a args pids + local -A assoc_pids + + if (( $+opt_args[-f] )); then + args=(-f $opt_args[-f]) + fi + pids=(${${${(f)"$(_call_program kdump-pids kdump $args)"}:#($'\t'| )*}## #}) + [[ $OSTYPE == netbsd* ]] && pids=(${pids/ ##[0-9]##/}) + pids=(${(u)${pids/ /:}%% *}) + for 1 in $pids; do + local pid=${1%%:*} process=${1#*:} + if (( $+assoc_pids[$pid] )); then + assoc_pids[$pid]+=", $process" + else + assoc_pids[$pid]=$process + fi + done + pids=() + for pid procs in ${(kv)assoc_pids}; do + pids+=($pid:$procs) + done + _describe -t kdump-pids 'kdump pid' pids +} + +local args=( + '-d[display numbers in decimal]' + '-f+[use the specified file (- for stdin)]:dump file:_files' + '-l[loop reading the trace file]' + '-m+[maximum I/O bytes to display]:max data bytes:' + '-n[suppress ad hoc translations]' + '-p+[show output only for the specified pid]: :_kdump_pid' + '(-E -T)-R[display relative timestamps]' + '(-E -R )-T[display absolute timestamps]' + '-t[select which tracepoints to display]: :_ktrace_points' +) + +case $OSTYPE; in + freebsd*|netbsd*) + args+=( + '(-R -T)-E[display elapsed timestamps]' + ) + ;| + freebsd*|openbsd*) + args+=( + '-H[display thread identifiers]' + ) + ;| + dragonfly*) + args+=( + '(-c -R)-a[display full human readable output]' + '-c[display the CPU the thread is running on]' + '-j[use a fixed format output]' + ) + ;; + freebsd*) + args+=( + '-A[display description of the ABI of traced process]' + '-r[symbolically display structure members]' + '-S[display system call numbers]' + '-s[suppress display of I/O data]' + ) + ;; + netbsd*) + args+=( + '-e[interpret system call maps using the specified emulation]:emulation:' + '-N[suppress system call name translation]' + '-X[Display GIO data in hex and ascii in groups of specified size]:size:(1 2 4 8 16)' + '-x[Display GIO data in hex and ascii]' + '1:dump file:_files' + ) + ;; + openbsd*) + args+=( + # XXX handle -TR + '-X[display I/O data in hex and ASCII]' + '-x[display I/O data in hex]' + ) + ;; +esac + +_arguments -s -S -A '-*' : $args diff --git a/Completion/BSD/Command/_ktrace b/Completion/BSD/Command/_ktrace new file mode 100644 index 000000000..9613ba2bf --- /dev/null +++ b/Completion/BSD/Command/_ktrace @@ -0,0 +1,30 @@ +#compdef ktrace + +local args=( + '-a[append to the trace file]' + '(*)-C[disable tracing on all user owned processes or all processes if executed by root]' + '-c[clear the trace points]' + '-d[trace current descendants]' + '-f+[log trace to specified file]:trace file:_files' + '(-p *)-g+[enable/disable tracing on specified process group]:pgid:_pgids' + '-i[inherit trace flags on future children]' + '(-g *)-p+[enable/disable tracing on specified PID]: :_pids' + '-t+[select information to include in dump]:trace string:_ktrace_points' + '*:: : _normal -p ktrace' +) + +case $OSTYPE; in + openbsd*) + args+=( + '-B[process relocations immediately]' + ) + ;; + netbsd*) + args+=( + '-n[stop tracing if writes to the trace file would block]' + '-s[write to the trace file with synchronized I/O]' + ) + ;; +esac + +_arguments -s -S -A '-*' : $args diff --git a/Completion/BSD/Command/_pfctl b/Completion/BSD/Command/_pfctl index 23898882f..812e52bdb 100644 --- a/Completion/BSD/Command/_pfctl +++ b/Completion/BSD/Command/_pfctl @@ -66,7 +66,7 @@ case $OSTYPE in "-N[don't perform domain name resolution]" '-P[display ports using service names]' '-S+[store pf state table in the specified file]:file:_files' - '-V+[select routing domain to be used to kill states]:routing domain' + '-V+[select routing domain to be used to kill states]:routing domain:_routing_domains' ) ;; (free|net)bsd*) diff --git a/Completion/BSD/Command/_pkgin b/Completion/BSD/Command/_pkgin index 5cb12baea..662bed181 100644 --- a/Completion/BSD/Command/_pkgin +++ b/Completion/BSD/Command/_pkgin @@ -26,7 +26,7 @@ _arguments -s -S -C \ '*:: :->restargs' && ret=0 if [[ -n $state ]]; then - cmds=( ${${${(f)"$(_call_program commands $pkgin -h 2>&1)"}[3,-1]/ - (#b)(?)/:$match:l}%.} ) + cmds=( ${${${(f)"$(_call_program commands $pkgin -h 2>&1)"}[3,-1]/ - (#b)(?)/:$match:l}%.} ) short=( ${${cmds#*\(}/ #\)/} ) cmds=( ${cmds// #\(*\)/} ) if [[ $state = subcommands && ! -prefix - ]]; then diff --git a/Completion/BSD/Command/_portmaster b/Completion/BSD/Command/_portmaster index 48390c9ad..ee6fefc6e 100644 --- a/Completion/BSD/Command/_portmaster +++ b/Completion/BSD/Command/_portmaster @@ -8,11 +8,11 @@ _portmaster_ports() { local expl ret=1 _fbsd_ports _fbsd_cat _fbsd_cat=(${PORTSDIR:-/usr/ports}/[a-z]*(/:t)) if [[ $PREFIX != */* ]] ; then - _wanted cat_packages expl 'category/ports' compadd -S '/' $_fbsd_cat + _wanted cat_packages expl 'category/port' compadd -S '/' $_fbsd_cat else compset -P '*/' _fbsd_ports=(${PORTSDIR:-/usr/ports}/$IPREFIX/*(/:t)) - _wanted cat_packages expl 'category/ports' compadd $_fbsd_ports + _wanted cat_packages expl 'category/port' compadd $_fbsd_ports fi return ret } @@ -77,7 +77,7 @@ _portmaster() { _arguments -s \ $standalone_args \ $common_args \ - '*:packages and ports:_portmaster_pkgs_and_ports' + '*:package or port:_portmaster_pkgs_and_ports' else case "$words[2]" in --clean-distfiles|--clean-distfiles-all|--check-depends|--check-port-dbdir|--version|-help|-h) @@ -86,14 +86,14 @@ _portmaster() { *) if (( $words[(I)-(e|r)] ));then _arguments -s \ - '*:packages:_portmaster_pkgs' + '*:package:_portmaster_pkgs' elif (( kid=$words[(I)-o] ));then if (( CURRENT == $kid + 1 ));then _arguments -s \ - '*:ports replacing:_portmaster_ports' + '*:replacement port:_portmaster_ports' elif (( CURRENT == $kid + 2 )); then _arguments -s \ - '*:package to replace:_portmaster_pkgs' + '*:package to replace:_portmaster_pkgs' else return 0 fi @@ -102,7 +102,7 @@ _portmaster() { else _arguments -s \ $common_args \ - '*:packages and ports:_portmaster_pkgs_and_ports' + '*:package or port:_portmaster_pkgs_and_ports' fi ;; esac diff --git a/Completion/BSD/Command/_rcctl b/Completion/BSD/Command/_rcctl index 62cb8f634..6cfebf420 100644 --- a/Completion/BSD/Command/_rcctl +++ b/Completion/BSD/Command/_rcctl @@ -1,11 +1,20 @@ #compdef rcctl local context state line -local -a actions subcmds variables +local -a actions lsarg subcmds variables actions=(check reload restart start stop) subcmds=(disable enable get getdef ls order set) variables=(class flags status timeout user) +lsarg=( + 'all:all services and daemons' + 'failed:enabled but stopped daemons' + 'off:disabled services and daemons' + 'on:enabled services and daemons' + 'rogue:daemons which are disabled but currently running' + 'started:running daemons' + 'stopped:stopped daemons' +) if [[ $service == "rcctl" ]]; then _arguments -C \ @@ -23,11 +32,11 @@ case $service in ':variable:compadd -a variables' ;; ls) - _arguments ':display a list of services and daemons matching:(all failed off on started stopped)' + _arguments ':display a list of services and daemons matching:(($lsarg))' ;; order) _arguments \ - ':service to start first:_services' + ':service to start first:_services' \ '*:service to start next:_services' ;; set) diff --git a/Completion/BSD/Command/_signify b/Completion/BSD/Command/_signify index 6a786e2e1..91e97e811 100644 --- a/Completion/BSD/Command/_signify +++ b/Completion/BSD/Command/_signify @@ -5,6 +5,7 @@ _arguments -s -S -A "-*" : \ '-C[verify a signed checksum list and the checksum for each file]' \ '-p+[public key]:public key:_files' \ '-q[quiet mode]' \ + '-t+[specify key type]:key type' \ '-x+[specify signature file]:signature file:_files' \ '*:file:_files' \ - generate \ diff --git a/Completion/BSD/Command/_sysclean b/Completion/BSD/Command/_sysclean new file mode 100644 index 000000000..755861644 --- /dev/null +++ b/Completion/BSD/Command/_sysclean @@ -0,0 +1,6 @@ +#compdef sysclean + +_arguments -s : \ + '(-p)-a[include filenames used by installed packages]' \ + '-i[include ignored filenames]' \ + '(-a)-p[output package names that are using obsolete files]' diff --git a/Completion/BSD/Command/_sysmerge b/Completion/BSD/Command/_sysmerge new file mode 100644 index 000000000..00ee18299 --- /dev/null +++ b/Completion/BSD/Command/_sysmerge @@ -0,0 +1,6 @@ +#compdef sysmerge + +_arguments -s : \ + '-b[run non-interactively]' \ + '-d[do not take any automatic action]' \ + '-p[only compare configuration of packages]' diff --git a/Completion/BSD/Command/_syspatch b/Completion/BSD/Command/_syspatch new file mode 100644 index 000000000..850636d09 --- /dev/null +++ b/Completion/BSD/Command/_syspatch @@ -0,0 +1,7 @@ +#compdef syspatch + +_arguments \ + '( -l -R -r)-c[list available patches]' \ + '(-c -R -r)-l[list installed patches]' \ + '(-c -l -r)-R[revert all patches]' \ + '(-c -l -R )-r[revert the most recently installed patch]' diff --git a/Completion/BSD/Command/_sysrc b/Completion/BSD/Command/_sysrc index f0c12a2be..892dac407 100644 --- a/Completion/BSD/Command/_sysrc +++ b/Completion/BSD/Command/_sysrc @@ -29,7 +29,7 @@ _sysrc() { '(- *)-h[print short usage message]' \ '(- *)--help[print full usage message]' \ '-i[ignore unknown variables]' \ - '-j+[jail to operate within]:jails:_jails' \ + '-j+[jail to operate within]:jail:_jails' \ '-n[print only variable values]' \ '-N[print only variable names]' \ '-R+[specify an alternative root]:alternative root:_files -/' \ diff --git a/Completion/BSD/Command/_systat b/Completion/BSD/Command/_systat index 73533e864..03df07631 100644 --- a/Completion/BSD/Command/_systat +++ b/Completion/BSD/Command/_systat @@ -45,6 +45,7 @@ case $OSTYPE in '-B[raw, non-interactive mode (two screen updates)]' '-b[raw, non-interactive mode (one screen update)]' '-d[exit after `count'\'' updates]:count' + '-h[human readable output]' '-i[interactive mode]' '-N[resolve network addresses to names]' '-n[do not resolve network addresses to names]' @@ -74,15 +75,16 @@ case $OSTYPE in opts=( '-M[alternative source to extract values from]:core:_files' '-N[alternative source to extract the name list from]:system:_files' - '-n[do not resolve IP addresses]' - '-w[refresh interval]:refresh interval' - '-t[the amount of refreshes for each screen in '\''all'\'' display mode]:turns' + '(-t -w)-b[show the chosen display once and exit]' + "-n[don't resolve IP addresses]" + '(-b)-w[refresh interval]:refresh interval' + "(-b)-t[specify amount of refreshes for each screen in 'all' display mode]:turns" ) esac if (( $#screens )); then _arguments -M 'r:|.=* r:|=*' : $opts \ - '1:systat(1) displays:(( ${pre}$^screens ))' \ + '1:systat(1) display:(( ${pre}$^screens ))' \ '2:refresh interval' return fi diff --git a/Completion/BSD/Command/_sysupgrade b/Completion/BSD/Command/_sysupgrade new file mode 100644 index 000000000..b1144b0d5 --- /dev/null +++ b/Completion/BSD/Command/_sysupgrade @@ -0,0 +1,9 @@ +#compdef sysupgrade + +_arguments -s -S -A '-*' : \ + '-f[force an already applied upgrade]' \ + '-k[keep the downloaded files]' \ + '-n[do not reboot]' \ + '(-s)-r[upgrade to the next release]' \ + '(-r)-s[upgrade to a snapshot]' \ + ':installurl:' diff --git a/Completion/BSD/Command/_usbconfig b/Completion/BSD/Command/_usbconfig new file mode 100644 index 000000000..e7da8132c --- /dev/null +++ b/Completion/BSD/Command/_usbconfig @@ -0,0 +1,63 @@ +#compdef usbconfig + +local curcontext="$curcontext" i ret=1 +local -a state line expl devices ids partial args + +_arguments -C \ + '(-d)-u[limit device range to given USBUS unit]:bus:->buses' \ + '(-d)-a[limit device range to given USB device index]:address:->addresses' \ + '(-a -u)-d[limit device range to given unit and address]:device:->devices' \ + '-i[specify interface index]:interface index' \ + '(- 1)-h[display usage information]' \ + '(-)1:command:compadd -M "r:|_=* r:|=*" + set_config set_alt set_template get_template add_dev_quirk_vplh + remove_dev_quirk_vplh add_quirk remove_quirk detach_kernel_driver + dump_quirk_names dump_device_quirks dump_all_desc dump_device_desc + dump_curr_config_desc dump_all_config_desc dump_string dump_info show_ifdrv + suspend resume power_off power_save power_on reset list do_request' \ + '*::: := ->args' && ret=0 + +case $state in + buses) partial=( ${(kv)=opt_args[(i)-a]:--a 1} ) i=1 ;| + addresses) partial=( ${(kv)opt_args[(i)-u]} ) i=2 ;& + buses) + devices=( ${${(f)"$(_call_program usb-devices usbconfig $partial list)"}:#No device*} ) + ids=( ${${(MSI.i.)devices##[^0-9]<->}#?} ) + _wanted usb-$state expl ${state%es} compadd -ld devices -o numeric -a ids && ret=0 + ;; + devices) + devices=( ${${${(f)"$(_call_program usb-devices usbconfig list)"}/: /:}:#No device*} ) + if (( $#devices )); then + _describe -t usb-devices device devices -M 'B:=ugen' && ret=0 + else + _message -e usb-devices device + fi + ;; + args) + curcontext="${curcontext%:*}-$line[1]:" + case $line[1] in + set_config) args=( '1:cfg index' ) ;; + set_alt) args=( '1:alt index' ) ;; + set_template) args=( '1:template (see usb_template(4))' ) ;; + (add|remove)_dev_quirk_vplh) args=( -C + ':vendor id' ':product id' ':low revision' + ':high revision' ':quirk:->quirks' + ) ;; + (add|remove)_quirk) args=( -C '1:quirk:->quirks' ) ;; + dump_string) args=( '1:index' ) ;; + do_request) args=( :bmReqTyp :bReq :wVal :wIdx :wLen '*:data' ) ;; + esac + if (( $#args )); then + _arguments $args && ret=0 + else + _message 'no more arguments' + fi + if [[ $state = quirks ]]; then + _wanted quirks expl quirk compadd \ + -M 'm:{:lower:}={:upper:} r:|_=* r:|=* b:=UQ_' \ + ${${(f)"$(_call_program quirks usbconfig dump_quirk_names)"}:#*list of*} && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/BSD/Type/_ktrace_points b/Completion/BSD/Type/_ktrace_points new file mode 100644 index 000000000..3068951fd --- /dev/null +++ b/Completion/BSD/Type/_ktrace_points @@ -0,0 +1,50 @@ +#autoload + +local points=( + 'c[trace system calls]' + 'i[trace I/O]' + 'n[trace namei translations]' + 's[trace signal processing]' + 'u[trace user data]' + '+[trace the default points]' +) + +case $OSTYPE in + dragonfly*|freebsd*|netbsd*) + points+=( + 'w[context switches]' + ) + ;| + freebsd*|openbsd*) + points+=( + 't[trace various structures]' + ) + ;| + freebsd*) + points+=( + 'f[trace page faults]' + 'p[trace capability check failures]' + 'y[trace sysctl(3) requests]' + ) + ;; + netbsd*) + points+=( + 'A[trace all tracepoints]' + 'a[trace exec arguments]' + 'e[trace emulation changes]' + 'f[trace open file descriptors after exec]' + 'S[trace MIB access (sysctl)]' + 'v[trace exec environment]' + '-[do not trace following trace points]' + ) + ;; + openbsd*) + points+=( + 'p[trace violation of pledge(2) restrictions]' + 'x[trace argument vector in execve(2)]' + 'X[trace environment in execve(2)]' + ) + ;; +esac + +_values -s '' 'ktrace point' $points diff --git a/Completion/BSD/Type/_login_classes b/Completion/BSD/Type/_login_classes new file mode 100644 index 000000000..a2e6983a9 --- /dev/null +++ b/Completion/BSD/Type/_login_classes @@ -0,0 +1,11 @@ +#autoload + +local expl login_classes + +login_classes=(${${(M)${(f)"$(</etc/login.conf)"}:#[^#[:blank:]]*}%%[:|]*}) +if [[ $OSTYPE = openbsd* ]]; then + login_classes+=(/etc/login.conf.d/*(N:t)) +fi + +_description login-classes expl 'login class' +compadd "$@" "$expl[@]" - $login_classes diff --git a/Completion/BSD/Type/_obsd_architectures b/Completion/BSD/Type/_obsd_architectures index ca3e0e12f..cec000a08 100644 --- a/Completion/BSD/Type/_obsd_architectures +++ b/Completion/BSD/Type/_obsd_architectures @@ -3,4 +3,4 @@ local expl _description architectures expl 'architecture' -compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk longson luna88k macppc octeon sgi sparc64 +compadd "$@" "$expl[@]" alpha amd64 arm64 armv7 hppa i386 landisk loongson luna88k macppc octeon sparc64 diff --git a/Completion/BSD/Type/_routing_domains b/Completion/BSD/Type/_routing_domains new file mode 100644 index 000000000..4bb9f78b0 --- /dev/null +++ b/Completion/BSD/Type/_routing_domains @@ -0,0 +1,6 @@ +#autoload + +local expl + +_description routing-domains expl 'routing domain' +compadd "$@" "$expl[@]" - ${${(M)${(f)"$(_call_program routing-domains netstat -R)"}:#Rdomain *}#Rdomain } diff --git a/Completion/BSD/Type/_routing_tables b/Completion/BSD/Type/_routing_tables new file mode 100644 index 000000000..3ba1931fe --- /dev/null +++ b/Completion/BSD/Type/_routing_tables @@ -0,0 +1,6 @@ +#autoload + +local expl + +_description routing-tables expl 'routing table' +compadd "$@" "$expl[@]" - ${(s: :)${${(M)${(f)"$(_call_program routing-tables netstat -R)"}:# Routing tables#: *}#*: }} diff --git a/Completion/Base/Completer/_expand b/Completion/Base/Completer/_expand index def522a76..e5e4f9b39 100644 --- a/Completion/Base/Completer/_expand +++ b/Completion/Base/Completer/_expand @@ -11,7 +11,7 @@ setopt localoptions nonomatch [[ _matcher_num -gt 1 ]] && return 1 -local exp word sort expr expl subd suf=" " force opt asp tmp opre pre epre +local exp word sort expr expl subd pref suf=" " force opt asp tmp opre pre epre local continue=0 (( $# )) && @@ -105,7 +105,7 @@ subd=("$exp[@]") # We need to come out of this with consistent quoting, by hook or by crook. integer done_quote -local orig_exp=$exp +local -a orig_exp=( $exp ) if [[ "$force" = *g* ]] || zstyle -T ":completion:${curcontext}:" glob; then eval 'exp=( ${~exp//(#b)\\([ \"'"\'"' ])/$match[1]} ); exp=( ${(q)exp} )' 2>/dev/null && (( $#exp )) && done_quote=1 @@ -214,9 +214,10 @@ else normal=( "$normal[@]" "$i" ) fi done - (( $#dir )) && compadd "$expl[@]" -UQ -qS/ -a dir - (( $#space )) && compadd "$expl[@]" -UQ -qS " " -a space - (( $#normal )) && compadd "$expl[@]" -UQ -qS "" -a normal + pref="${${word:#[~/]*}:+$PWD}/" + (( $#dir )) && compadd "$expl[@]" -fW "$pref" -UQ -qS/ -a dir + (( $#space )) && compadd "$expl[@]" -fW "$pref" -UQ -qS " " -a space + (( $#normal )) && compadd "$expl[@]" -fW "$pref" -UQ -qS "" -a normal fi if _requested all-expansions; then local disp dstr diff --git a/Completion/Base/Core/_description b/Completion/Base/Core/_description index bdb4007a6..368b41ee2 100644 --- a/Completion/Base/Core/_description +++ b/Completion/Base/Core/_description @@ -2,6 +2,7 @@ local name nopt xopt format gname hidden hide match opts tag local -a ign gropt sort +local -a match mbegin mend opts=() @@ -78,7 +79,14 @@ shift 2 if [[ -z "$1" && $# -eq 1 ]]; then format= elif [[ -n "$format" ]]; then - zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}" + if [[ -z $2 ]]; then + argv+=( h:${1%%( ##\((#b)([^\)]#[^0-9-][^\)]#)(#B)\)|)( ##\((#b)([0-9-]##)(#B)\)|)( ##\[(#b)([^\]]##)(#B)\]|)} ) + [[ -n $match[1] ]] && argv+=( m:$match[1] ) + [[ -n $match[2] ]] && argv+=( r:$match[2] ) + [[ -n $match[3] ]] && argv+=( o:$match[3] ) + fi + + zformat -F format "$format" "d:$1" "${(@)argv[2,-1]}" fi if [[ -n "$gname" ]]; then diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index 6b2cf2bcf..169ca1f40 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -94,8 +94,18 @@ if [[ -z "$compstate[quote]" ]]; then if [[ -o equals ]] && compset -P 1 '='; then compstate[context]=equal elif [[ "$PREFIX" != */* && "$PREFIX[1]" = '~' ]]; then - compset -p 1 - compstate[context]=tilde + if [[ "$PREFIX" = '~['[^\]]# ]]; then + # Inside ~[...] should be treated as a subscript. + compset -p 2 + # To be consistent, we ignore all but the contents of the square + # brackets. + compset -S '\]*' + compstate[context]=subscript + [[ -n $_comps[-subscript-] ]] && $_comps[-subscript-] && return + else + compset -p 1 + compstate[context]=tilde + fi fi fi @@ -234,7 +244,7 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then _menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" ) - if [[ "$compstate[list]" = *list && tmp -gt LINES && + if [[ "$compstate[list]" = *list(| *) && tmp -gt LINES && ( -n "$_menu_style[(r)select=long-list]" || -n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]; then compstate[insert]=menu diff --git a/Completion/Base/Core/_message b/Completion/Base/Core/_message index 4d5645eaf..dbeed4a88 100644 --- a/Completion/Base/Core/_message +++ b/Completion/Base/Core/_message @@ -39,7 +39,7 @@ else fi if [[ -n "$format$raw" ]]; then - [[ -z "$raw" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}" + [[ -z "$raw" ]] && zformat -F format "$format" "d:$1" "${(@)argv[2,-1]}" builtin compadd "$gopt[@]" -x "$format" _comp_mesg=yes fi diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 136dd5826..5ff34ff47 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -7,11 +7,13 @@ local long cmd="$words[1]" descr odescr mesg subopts opt opt2 usecc autod local oldcontext="$curcontext" hasopts rawret optarg singopt alwopt local setnormarg start rest local -a match mbegin mend +integer opt_args_use_NUL_separators=0 subopts=() singopt=() -while [[ "$1" = -([AMO]*|[CRSWnsw]) ]]; do +while [[ "$1" = -([AMO]*|[0CRSWnsw]) ]]; do case "$1" in + -0) opt_args_use_NUL_separators=1; shift ;; -C) usecc=yes; shift ;; -O) subopts=( "${(@P)2}" ); shift 2 ;; -O*) subopts=( "${(@P)${1[3,-1]}}" ); shift ;; @@ -130,8 +132,8 @@ if (( long )); then # variant syntax seen in fetchmail: # --[fetch]all means --fetchall or --all. # maybe needs to be more general - if [[ $start = (#b)(*)\[(*)\](*) ]]; then - tmp+=("${match[1]}${match[2]}${match[3]}" "${match[1]}${match[3]}") + if [[ $start = (#b)--\[(*)\](*) ]]; then + tmp+=("--${match[1]}${match[2]}" "--${match[2]}") else tmp+=($start) fi @@ -388,7 +390,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then if [[ "$action" = -\>* ]]; then action="${${action[3,-1]##[ ]#}%%[ ]#}" if (( ! $state[(I)$action] )); then - comparguments -W line opt_args + comparguments -W line opt_args $opt_args_use_NUL_separators state+=( "$action" ) state_descr+=( "$descr" ) if [[ -n "$usecc" ]]; then @@ -406,7 +408,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then local=yes fi - comparguments -W line opt_args + comparguments -W line opt_args $opt_args_use_NUL_separators if [[ "$action" = \ # ]]; then @@ -511,8 +513,8 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" ) _describe -O option \ - tmp1 tmp2 -Q -S '' -- \ - tmp3 -Q + tmp1 tmp2 -S '' -- \ + tmp3 [[ -n "$optarg" && "$single" = next && nm -eq $compstate[nmatches] ]] && _all_labels options expl option \ @@ -523,9 +525,9 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then else next+=( "$odirect[@]" ) _describe -O option \ - next -Q -M "$matcher" -- \ - direct -QS '' -M "$matcher" -- \ - equal -QqS= -M "$matcher" + next -M "$matcher" -- \ + direct -S '' -M "$matcher" -- \ + equal -qS= -M "$matcher" fi PREFIX="$prevpre" IPREFIX="$previpre" diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program index 73f3ef6d2..55712b04b 100644 --- a/Completion/Base/Utility/_call_program +++ b/Completion/Base/Utility/_call_program @@ -1,5 +1,6 @@ #autoload +X +local -xi COLUMNS=999 local curcontext="${curcontext}" tmp err_fd=-1 clocale='_comp_locale;' local -a prefix diff --git a/Completion/Base/Utility/_numbers b/Completion/Base/Utility/_numbers new file mode 100644 index 000000000..97bb8b4c8 --- /dev/null +++ b/Completion/Base/Utility/_numbers @@ -0,0 +1,87 @@ +#autoload + +# Usage: _numbers [compadd options] [-t tag] [-f|-N] [-u units] [-l min] [-m max] \ +# [-d default] ["description"] [unit-suffix...] + +# -t : specify a tag (defaults to 'numbers') +# -u : indicate the units, e.g. seconds +# -l : lowest possible value +# -m : maximum possible value +# -d : default value +# -N : allow negative numbers (implied by range including a negative) +# -f : allow decimals (float) + +# For a unit-suffix, an initial colon indicates a unit that asserts the default +# otherwise, colons allow for descriptions, e.g: + +# :s:seconds m:minutes h:hours + +# unit-suffixes are not sorted by the completion system when listed +# Specify them in order of magnitude, this tends to be ascending unless +# the default is of a higher magnitude, in which case, descending. +# So for, example +# bytes kB MB GB +# s ms us ns +# Where the compadd options include matching control or suffixes, these +# are applied to the units + +# For each unit-suffix, the format style is looked up with the +# unit-suffixes tag and the results concatenated. Specs used are: +# x : the suffix +# X : suffix description +# d : indicate suffix is for the default unit +# i : list index +# r : reverse list index +# The latter three of these are useful with ternary expressions. + +# _description is called with the x token set to make the completed +# list of suffixes available to the normal format style + +local desc tag range suffixes suffix suffixfmt pat='<->' partial='' +local -a expl formats +local -a default max min keep tags units +local -i i +local -A opts + +zparseopts -K -D -A opts M+:=keep q:=keep s+:=keep S+:=keep J+: V+: 1 2 o+: n F: x+: X+: \ + t:=tags u:=units l:=min m:=max d:=default f=type e=type N=type + +desc="${1:-number}" tag="${tags[2]:-numbers}" +(( $# )) && shift + +[[ -n ${(M)type:#-f} ]] && pat='(<->.[0-9]#|[0-9]#.<->|<->)' partial='(|.)' +[[ -n ${(M)type:#-N} || $min[2] = -* || $max[2] = -* ]] && \ + pat="(|-)$pat" partial="(|-)$partial" + +if (( $#argv )) && compset -P "$pat"; then + zstyle -s ":completion:${curcontext}:units" list-separator sep || sep=-- + _description -V units expl unit + disp=( ${${argv#:}/:/ $sep } ) + compadd -M 'r:|/=* r:|=*' -d disp "$keep[@]" "$expl[@]" - ${${argv#:}%%:*} + return +elif [[ -prefix $~pat || $PREFIX = $~partial ]]; then + formats=( "h:$desc" ) + (( $#units )) && formats+=( m:${units[2]} ) desc+=" ($units[2])" + (( $#min )) && range="$min[2]-" + (( $#max )) && range="${range:--}$max[2]" + [[ -n $range ]] && formats+=( r:$range ) desc+=" ($range)" + (( $#default )) && formats+=( o:${default[2]} ) desc+=" [$default[2]]" + + zstyle -s ":completion:${curcontext}:unit-suffixes" format suffixfmt || \ + suffixfmt='%(d.%U.)%x%(d.%u.)%(r..|)' + for ((i=0;i<$#;i++)); do + zformat -f suffix "$suffixfmt" "x:${${argv[i+1]#:}%%:*}" \ + "X:${${argv[i+1]#:}#*:}" "d:${#${argv[i+1]}[1]#:}" \ + i:i r:$(( $# - i - 1)) + suffixes+="$suffix" + done + [[ -n $suffixes ]] && formats+=( x:$suffixes ) + + _comp_mesg=yes + _description -x $tag expl "$desc" $formats + [[ $compstate[insert] = *unambiguous* ]] && compstate[insert]= + compadd "$expl[@]" + return 0 +fi + +return 1 diff --git a/Completion/Base/Utility/_sequence b/Completion/Base/Utility/_sequence index c1ff32184..1a87c1753 100644 --- a/Completion/Base/Utility/_sequence +++ b/Completion/Base/Utility/_sequence @@ -8,10 +8,10 @@ # -d : duplicate values allowed local curcontext="$curcontext" nm="$compstate[nmatches]" pre qsep nosep minus -local -a opts sep num pref suf cont end uniq dedup +local -a opts sep num pref suf cont end uniq dedup garbage zparseopts -D -a opts s:=sep n:=num p:=pref i:=pref P:=pref I:=suf S:=suf \ - q=suf r:=suf R:=suf C:=cont d=uniq M+: J+: V+: 1 2 o+: X+: x+: + q=suf r:=suf R:=suf C:=cont F:=garbage d=uniq M+: J+: V+: 1 2 o+: X+: x+: (( $#cont )) && curcontext="${curcontext%:*}:$cont[2]" (( $#sep )) || sep[2]=, diff --git a/Completion/Base/Utility/_store_cache b/Completion/Base/Utility/_store_cache index fb2ab328a..b08ff1142 100644 --- a/Completion/Base/Utility/_store_cache +++ b/Completion/Base/Utility/_store_cache @@ -2,7 +2,7 @@ # # Storage component of completions caching layer -local _cache_ident _cache_ident_dir +local _cache_ident _cache_ident_dir _cache_dir _cache_ident="$1" if zstyle -t ":completion:${curcontext}:" use-cache; then diff --git a/Completion/Base/Utility/_values b/Completion/Base/Utility/_values index 6e38e00f4..688ada848 100644 --- a/Completion/Base/Utility/_values +++ b/Completion/Base/Utility/_values @@ -4,7 +4,7 @@ local subopts opt usecc garbage keep subopts=() zparseopts -D -a garbage s+:=keep S+:=keep w+=keep C=usecc O:=subopts \ - M: J: V: 1 2 n F: X: + M: J: V: 1 2 o+: n F: X: (( $#subopts )) && subopts=( "${(@P)subopts[2]}" ) diff --git a/Completion/Base/Widget/_bash_completions b/Completion/Base/Widget/_bash_completions index 7abb654d4..feb721451 100644 --- a/Completion/Base/Widget/_bash_completions +++ b/Completion/Base/Widget/_bash_completions @@ -32,7 +32,7 @@ local key=$KEYS[-1] expl case $key in '!') _main_complete _command_names ;; - '$') _main_complete - parameters _wanted parameters expl 'exported parameters' \ + '$') _main_complete - parameters _wanted parameters expl 'exported parameter' \ _parameters -g '*export*' ;; '@') _main_complete _hosts diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug index 85a0f372a..94fd4accd 100644 --- a/Completion/Base/Widget/_complete_debug +++ b/Completion/Base/Widget/_complete_debug @@ -14,7 +14,11 @@ integer debug_fd=-1 exec {debug_fd}>&2 2>| $tmp fi - local -a debug_indent; debug_indent=( '%'{3..20}'(e. .)' ) + local -a debug_indent + () { + setopt localoptions no_ignorebraces + debug_indent=( '%'{3..20}'(e. .)' ) + } local PROMPT4 PS4="${(j::)debug_indent}+%N:%i> " setopt xtrace : $ZSH_NAME $ZSH_VERSION diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help index 252b0e281..69855de9d 100644 --- a/Completion/Base/Widget/_complete_help +++ b/Completion/Base/Widget/_complete_help @@ -84,7 +84,7 @@ _help_sort_tags() { [[ "$help_funcs[$curcontext]" != *${f}* ]] && help_funcs[$curcontext]+=$'\0'"${f}" help_tags[${curcontext}${f}]+=",${argv}:${f}" - comptry "$@" + comptry "$@" 2>/dev/null fi } diff --git a/Completion/Base/Widget/_complete_tag b/Completion/Base/Widget/_complete_tag index 5b50f1d85..397b8d901 100644 --- a/Completion/Base/Widget/_complete_tag +++ b/Completion/Base/Widget/_complete_tag @@ -50,13 +50,13 @@ if [[ -f $c_path$c_Tagsfile ]]; then -e '/^[a-zA-Z_].*/p' $c_path$c_Tagsfile)) # c_tags_array=($(perl -ne '/([a-zA-Z_0-9]+)[ \t:;,\(]*\x7f/ && # print "$1\n"' $c_path$c_Tagsfile)) - _main_complete - '' _wanted etags expl 'emacs tags' \ + _main_complete - '' _wanted etags expl 'emacs tag' \ compadd -a c_tags_array elif [[ -f $c_path$c_tagsfile ]]; then # tags doesn't have as much in, but the tag is easy to find. # we can use awk here. c_tags_array=($(awk '{ print $1 }' $c_path$c_tagsfile)) - _main_complete - '' _wanted vtags expl 'vi tags' compadd -a c_tags_array + _main_complete - '' _wanted vtags expl 'vi tag' compadd -a c_tags_array else return 1 fi diff --git a/Completion/Cygwin/Command/_cygserver b/Completion/Cygwin/Command/_cygserver index 1c2744c8f..392bf5cbd 100644 --- a/Completion/Cygwin/Command/_cygserver +++ b/Completion/Cygwin/Command/_cygserver @@ -3,14 +3,14 @@ # cygwin 1.5.25 _arguments -s -S \ - '(--config-file -f)'{-f,--config-file}'[use specified file as config file (default /etc/cygserver.conf)]:config file:_files -g "*.conf(-.)"' \ - '(--cleanup-threads -c)'{-c,--cleanup-threads}'[number of cleanup threads to use (default 2)]:number of threads:' \ + '(--config-file -f)'{-f,--config-file}'[use specified config file]:config file [/etc/cygserver.conf]:_files -g "*.conf(-.)"' \ + '(--cleanup-threads -c)'{-c,--cleanup-threads}'[number of cleanup threads to use]:number of threads [2]' \ '(--process-cache -p)'{-p,--process-cache}'[size of process cache]:cache size:' \ - '(--request-threads -r)'{-r,--request-threads}'[number of request threads to use (default 10)]:number of threads:' \ + '(--request-threads -r)'{-r,--request-threads}'[number of request threads to use]:number of threads [10]' \ '(--debug -d)'{-d,--debug}'[log debug messages to stderr]' \ '(--stderr -e --no-stderr -E)'{-e,--stderr}'[log to stderr (default if stderr is a tty)]' \ '(--stderr -e --no-stderr -E)'{-E,--no-stderr}"[don't log to stderr (see -y, -Y options)]" \ - '(--log-level -l)'{-l,--log-level}'[verbosity of logging (1..7) (default 6)]:verbosity level:({1..7})' \ + '(--log-level -l)'{-l,--log-level}'[specify log verbosity]:verbosity level [6]:({1..7})' \ '(--syslog -y --no-syslog -Y)'{-y,--syslog}'[log to syslog (default if stderr is no tty)]' \ '(--syslog -y --no-syslog -Y)'{-Y,--no-syslog}"[don't log to syslog (see -e, -E options)]" \ '(--no-sharedmem -m)'{-m,--no-sharedmem}"[don't start XSI Shared Memory support]" \ diff --git a/Completion/Darwin/Command/_defaults b/Completion/Darwin/Command/_defaults index ca5d87e65..b05222af6 100644 --- a/Completion/Darwin/Command/_defaults +++ b/Completion/Darwin/Command/_defaults @@ -42,7 +42,7 @@ _defaults(){ _arguments \ "(1)-app:application:_mac_applications" \ "(-app)1:domain:_defaults_domains" \ - "2:keys:_defaults_keys" + "2:key:_defaults_keys" ;; write) _arguments \ diff --git a/Completion/Darwin/Command/_hdiutil b/Completion/Darwin/Command/_hdiutil index c31808716..20e69cbc5 100644 --- a/Completion/Darwin/Command/_hdiutil +++ b/Completion/Darwin/Command/_hdiutil @@ -10,7 +10,7 @@ _hdiutil_disk() { disk_desc+=( "$disk_name:${${(M)REPLY% *}#?}" ) fi done - _describe -t devices disks disk_desc + _describe -t devices disk disk_desc } _hdiutil_device() { @@ -46,28 +46,40 @@ _hdiutil_imagesize(){ } _hdiutil_imageformat(){ - local -a fmts + local -a fmts ofmts fmts=( "UDRW:UDIF read/write image" "UDRO:UDIF read-only image" - "UDZO:UDIF zlib-compressed image" "UDCO:UDIF ADC-compressed image" - "UFBI:UDIF entire image with MD5 checksum" + "UDZO:UDIF zlib-compressed image" + "ULFO:UDIF lzfse-compressed image" + "ULMO:UDIF lzma-compressed image" + "UDBZ:UDIF bzip2-compressed image" "UDTO:DVD/CD-R master for export" - "UDxx:UDIF stub image" - "UDSP:SPARSE (growable with content)" - "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)" - "DC42:Disk Copy 4.2 image" + "UDSP:SPARSE (grows with content)" + "UDSB:SPARSEBUNDLE (grows with content; bundle-backed)" + "UFBI:UDIF entire image with MD5 checksum" ) ofmts=( "UDRo:UDIF read-only" "UDCo:UDIF compressed" "RdWr:NDIF read/write image" + "Rdxx:NDIF read-only image (Disk Copy 6.3.3 format)" "ROCo:NDIF compressed image" "Rken:NDIF compressed" + "DC42:Disk Copy 4.2 image" + "IPOD:iPod image" # Mentioned in help, not manual + "UDxx:UDIF stub image" # Mentioned in help, not manual + "UNIV:hybrid image (HFS+/ISO/UDF)" # Mentioned in help, not manual ) _describe -t types "image format" fmts -V1 || - _describe -t types "obsolete/deprecated image format" ofmts -V1 + _describe -t types "obsolete/deprecated image format" ofmts -V1 +} + +_hdiutil_images() { + local -a expl + _description files expl 'disk image' + _files "$@" "${(@)expl}" -g '*.(bin|cdr|dmg|img|iso|sparse(bundle|image))(-.)' } _hdiutil(){ @@ -131,7 +143,7 @@ _hdiutil(){ _arguments -C '*:: :->subcmds' if (( CURRENT == 1 )); then - _describe -t commands "hdiutil subcommands" _1st_arguments + _describe -t commands "hdiutil subcommand" _1st_arguments return fi @@ -178,7 +190,7 @@ _hdiutil(){ "(-autoopenro)-noautoopenro" \ "(-noautoopenrw)-autoopenrw[auto-open read/write volumes]" \ "(-autoopenrw)-noautoopenrw" \ - "1:disk image to attach:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:disk image to attach:_hdiutil_images" \ && return 0 ;; detach|eject) @@ -195,7 +207,7 @@ _hdiutil(){ "$_common_usage_options[-imagekey]" \ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ - "1:disk image to verify:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:disk image to verify:_hdiutil_images" \ && return 0 ;; create) @@ -214,8 +226,26 @@ _hdiutil(){ "($size_spec)-srcfolder[specify directory]: :_directories" \ "($size_spec)-srcdir[specify directory]: :_directories" \ "-align[size to which partition is aligned]:size" \ - "-type[image type]:image type:(UDIF SPARSE)" \ - "-fs[filesystem to make]:filesystem:(HFS+ HFS+J HFSX HFS MS-DOS UFS)" \ + "-type[image type]:image type:(( + SPARSEBUNDLE\:'sparse bundle disk image' + SPARSE\:'sparse disk image' + UDIF\:'read/write disk image' + UDTO\:'DVD/CD master' + ))" \ + "-fs[filesystem to make]:filesystem:(( + UDF\:'Universal Disk Format' + MS-DOS\ FAT12\:'MS-DOS (FAT12)' + MS-DOS\:'MS-DOS (FAT)' + MS-DOS\ FAT16\:'MS-DOS (FAT16)' + {FAT32,MS-DOS\ FAT32}\:'MS-DOS (FAT32)' + ExFAT\:'ExFAT' + HFS+\:'Mac OS Extended' + {HFS+J,JHFS+,HFSJ,Journaled\ HFS+}\:'Mac OS Extended (journaled)' + {HFS+X,HFSX,Case-sensitive\ HFS+}\:'Mac OS Extended (case-sensitive)' + {JHFS+X,JHFSX,HFS+X+J,HFS+XJ,HFSXJ,Case-sensitive\ Journaled\ HFS+}\:'Mac OS Extended (case-sensitive, journaled)' + APFS\:'APFS' + Case-sensitive\ APFS\:'APFS (case-sensitive)' + ))" \ "-volname[volume name]:name" \ "-uid[uid of root directory]:uid in number" \ "-gid[gid of root directory]:gid in number" \ @@ -225,7 +255,16 @@ _hdiutil(){ "(-autostretch)-noautostretch" \ "-stretch[max_stretch]: :_hdiutil_imagesize" \ "-fsargs[additional arguments to pass to newfs]:arguments" \ - "-layout[partition layout]:partition layout:(NONE SPUD UNIVERSAL\ CD UNIVERSAL\ HD)" \ + "-layout[partition layout]:partition layout:(( + MBRSPUD\:'single partition, MBR' + SPUD\:'single partition, APM' + UNIVERSAL\ CD\:'CD/DVD' + NONE\:'no partition map' + GPTSPUD\:'single partition, GPT' + SPCD\:'single partition, CD/DVD' + UNIVERSAL\ HD\:'hard disk' + ISOCD\:'single partition, CD/DVD with ISO data' + ))" \ "-partitionType[partition type]:partition type:(Apple_HFS Apple_UFS)" \ "-ov[overwrite an existing file]" \ "-attach[attach the image after creating it]" \ @@ -265,7 +304,7 @@ _hdiutil(){ "-ov[overwrite an existing file]" \ "-format:format:_hdiutil_imageformat" \ "-o:target disk image:_files" \ - "1:source disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:source disk image:_hdiutil_images" \ && return 0 if [[ $state = keyvalue ]]; then @@ -302,7 +341,7 @@ _hdiutil(){ "-erase[erase the media]" \ "-fullerase[erase all sectors of the disc]" \ "-list[list all burning devices with paths suitable for -device]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; makehybrid) @@ -343,7 +382,7 @@ _hdiutil(){ "(-nokernel)-nokernel[attach with a helper process]" \ "(-kernel)-kernel[attach without a helper process]" \ "-o:target disk image:_files" \ - "1:source disk image or directory:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:source disk image or directory:_hdiutil_images" \ && return 0 ;; compact) @@ -376,7 +415,7 @@ _hdiutil(){ "$_common_usage_options[-cacert]" \ "$_common_usage_options[-plist]" \ "-type:image type:(UDIF-CRC32 UDIF-MD5 DC42 CRC28 CRC32 MD5)" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; chpass) @@ -386,7 +425,7 @@ _hdiutil(){ "$_common_usage_options[-srcimagekey]" \ "-oldstdinpass[specify old password from standard input]" \ "-newstdinpass[specify new password from standard input]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; unflatten) @@ -395,7 +434,7 @@ _hdiutil(){ "$_common_usage_options[-encryption]" \ "$_common_usage_options[-stdinpass]" \ "$_common_usage_options[-srcimagekey]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; flatten) @@ -408,7 +447,7 @@ _hdiutil(){ "(-noxml)-xml" \ "(-rsrcfork)-norsrcfork[don\'t embed resource fork data]" \ "(-norsrcfork)-rsrcfork" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; hfsanalyze) @@ -420,7 +459,7 @@ _hdiutil(){ "$_common_usage_options[-shadow]" \ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ - "1:disk image or device:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1:disk image or device:_hdiutil_images" \ && return 0 ;; mountvol) @@ -447,7 +486,7 @@ _hdiutil(){ "$_common_usage_options[-plist]" \ "-format[just print out the image format]" \ "-checksum[just print out the image checksum]" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; plugins) @@ -462,7 +501,7 @@ _hdiutil(){ "$_common_usage_options[-srcimagekey]" \ "$_common_usage_options[-plist]" \ "(-yes -no -query)"{-yes,-no,-query} \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 ;; @@ -514,7 +553,7 @@ _hdiutil(){ "$_common_usage_options[-insecurehttp]" \ "$_common_usage_options[-cacert]" \ "-options[just print out the image checksum]: :->option" \ - "1:disk image:_files -g \*.\(dmg\|sparseimage\)\(\|.bin\)\(-.\)" \ + "1: :_hdiutil_images" \ && return 0 case "$state" in diff --git a/Completion/Darwin/Command/_qtplay b/Completion/Darwin/Command/_qtplay index 39a7c6de2..839efee83 100644 --- a/Completion/Darwin/Command/_qtplay +++ b/Completion/Darwin/Command/_qtplay @@ -15,6 +15,6 @@ _arguments -S \ '-t[specify update time]:update time (seconds)' \ '-T[kill time]:ticks' \ '-V[volume]:percentage of normal volume' \ - '(-)'{-?,--help,-h}'[display help information]' \ + '(-)'{-\?,--help,-h}'[display help information]' \ '(-)*:quicktime file:_files' diff --git a/Completion/Darwin/Command/_softwareupdate b/Completion/Darwin/Command/_softwareupdate index 6db577b06..6054fd768 100644 --- a/Completion/Darwin/Command/_softwareupdate +++ b/Completion/Darwin/Command/_softwareupdate @@ -55,7 +55,7 @@ _softwareupdate() { ignored_subcmd=(add remove) if (( CURRENT == 1 )); then - _describe -t commands "subcommands" ignored_subcmd && return 0 + _describe -t commands "subcommand" ignored_subcmd && return 0 fi case $words[1] in add) diff --git a/Completion/Darwin/Type/_retrieve_mac_apps b/Completion/Darwin/Type/_retrieve_mac_apps index f24d36c3c..655170d3a 100644 --- a/Completion/Darwin/Type/_retrieve_mac_apps +++ b/Completion/Darwin/Type/_retrieve_mac_apps @@ -73,7 +73,7 @@ _retrieve_mac_apps() { typeset retrieve if ! zstyle -s ":completion:*:*:${service}:commands" search-method retrieve then - if [[ -d /.Spotlight-V100 ]]; then + if [[ "$( command mdutil -s / 2>&1 )" == *enabled* ]]; then # / is indexed to use Spotlight retrieve=_mac_apps_spotlight_retrieve else @@ -88,7 +88,10 @@ _retrieve_mac_apps() { if ! zstyle -a ":completion:${curcontext}:" application-path app_dir_root then if [[ $retrieve = _mac_apps_old_retrieve ]]; then - app_dir_root=( {,/Developer,/Network,"$HOME"}/{Applications*(N),Desktop} ) + app_dir_root=( + {,/Developer,/Network,/System,$HOME}/{Applications*(N),Desktop} + ) + app_dir_root=( $^app_dir_root(N) ) else app_dir_root=( / ) fi diff --git a/Completion/Debian/Command/_apt b/Completion/Debian/Command/_apt index 4d60cd249..494d3bf82 100644 --- a/Completion/Debian/Command/_apt +++ b/Completion/Debian/Command/_apt @@ -531,7 +531,7 @@ _apt-cache () { --installed:bool \ -- \ /$'help\0'/ \| \ - /$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files' \# \| \ + /$'add\0'/ /$'[^\0]#\0'/ ':files:index file:_files' \# \| \ /$'gencaches\0'/ \| \ /$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ /$'showsrc\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \ diff --git a/Completion/Debian/Command/_aptitude b/Completion/Debian/Command/_aptitude index bbaa8ebbd..5b10adb80 100644 --- a/Completion/Debian/Command/_aptitude +++ b/Completion/Debian/Command/_aptitude @@ -1,60 +1,32 @@ #compdef aptitude -local curcontext="$curcontext" state line cmds ret=1 - -function _aptitude_release() { - #{{{ - local expl releases - releases=( -${${(M)${(f)"$(</etc/apt/sources.list)"}\ -:#[ $'\t']#deb(|-src)*}/(#b)[ $'\t']#[^ $'\t']##[ $'\t']##[^ $'\t']##[ $'\t']##([^ $'\t']##)*/$match[1]} - ) - _wanted list expl release compadd ${expl} - ${(u)releases} - #}}} -} - -# Helper function for -F / --display-format -function _aptitude_format_strings() { - _values -s , 'format string' \ - '%%[Literal %]' \ - '%#number[Parameter replacement]' \ - '%a[Action flag]' \ - '%A[Action]' \ - '%B[Broken count]' \ - '%c[Current state flag]' \ - '%C[Current state]' \ - '%d[Description]' \ - '%H[Hostname]' \ - '%i[Pin priority]' \ - '%I[Installed size]' \ - '%m[Maintainer]' \ - '%M[Automatic flag]' \ - '%n[Program version]' \ - '%N[Program name]' \ - '%o[Download size]' \ - '%p[Package name]' \ - '%P[Priority]' \ - '%r[Reverse depends count]' \ - '%R[Abbreviated priority]' \ - '%s[Section]' \ - '%S[Trust status]' \ - '%t[Archive]' \ - '%T[Tagged]' \ - '%u[Disk usage change]' \ - '%v[Current version]' \ - '%V[Candidate version]' \ - '%Z[Size change]' -} +local curcontext="$curcontext" sep ret=1 +local state line expl specs disp cmds suf _arguments -C \ '(- 1 *)'{-h,--help}'[display help information]' \ '(- 1 *)--version[display version information]' \ + '--add-user-tag=[add user tag to affected packages]:tag' \ + '--add-user-tag-to=[add user tag to matching packages]:tag,pattern' \ + '--allow-new-upgrades[install upgrades for packages regardless]' \ + '(--no-new-installs)--allow-new-installs[allow the safe-upgrade command to install new packages]' \ + '--allow-untrusted[install packages from untrusted sources without prompting]' \ + '--disable-columns[output results without any special formatting]' \ + '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format:->format-strings' \ + '--group-by=[control how the versions command groups its output]:grouping:(archive auto none package source-package source-version)' \ + '--log-file=[specify output log file]:file:_files' \ + '*--log-level=[specify minimum message level to log]:level:compadd -o nosort off fatal error warn info debug trace' \ + '--log-resolver[set some standard log levels related to the resolver]' \ + '(--allow-new-installs)--no-new-installs[prevent safe-upgrade from installing any new packages]' \ + '(--allow-new-upgrades)--no-new-upgrades[prevent safe-upgrade from upgrading packages regardless]' \ + "--no-show-resolver-actions[don't display the actions performed by the “safe” resolver]" \ + '(-O --sort)'{-O,--sort}'[specify sort order]:sort order:->orderings' \ + '-o[set a configuration file option]:key=value' \ '(-s --simulate)'{-s,--simulate}'[print actions without performing them]' \ '(-d --download-only)'{-d,--download-only}"[just download packages - don\'t install]" \ '(-P --prompt)'{-P,--prompt}'[always display a prompt]' \ + '--purge-unused[purge in addition to removing each package that is no longer required]' \ '(-y --assume-yes)'{-y,--assume-yes}'[assume yes answer to questions]' \ - '(-F --display-format)'{-F,--display-format}'[specify output format for search command]:format:_aptitude_format_strings' \ - '(-O --sort)'{-O,--sort}'[specify sort order]:sort order:()' \ '(-w --width)'{-w,--width}'[specify output width]:width' \ '-f[aggressively try to fix dependencies of broken packages]' \ '(-V --show-versions)'{-V,--show-versions}'[show which versions of packages will be installed]' \ @@ -65,25 +37,72 @@ _arguments -C \ '(--without-suggests)--with-suggests[install suggested packages when installing new packages]' \ '(-r --with-recommends)'{-r,--without-recommends}'[ignore recommended packages when installing new packages]' \ '(--with-suggests)--without-suggests[ignore suggested packages when installing new packages]' \ - '(-t --target-release)'{-t,--target-release}'[set the release from which packages should be installed]:release:_aptitude_release' \ + '--remove-user-tag=[remove user tag from affected packages]:tag' \ + '--remove-user-tag-from=[remove user tag from matching packages]:tag,pattern' \ + '(-t --target-release)'{-t,--target-release}'[set the release from which packages should be installed]:release:->aptitude-releases' \ '(-q --quiet)'{-q=,--quiet=}'[less Output]:level' \ '--schedule-only[schedule operations to be performed in the future]' \ '--purge-unused[purge unused packages instead of removing]' \ '--visual-preview[start up the visual interface and display its preview screen]' \ '--full-resolver[attempts to resolve conflicts with a higher risk of breakage]' \ '--safe-resolver[attempts to resolve conflicts with a lower risk of breakage]' \ + '--show-package-names[control when the versions command shows package names]:when:(always auto never)' \ + '--show-summary=[summarize each dependency chain that the why command outputs]::mode:(no-summary first-package first-package-and-type all-packages all-packages-with-dep-versions)' \ + '(-W --show-why)'{-W,--show-why}'[show which manually installed package requires each automatically installed package]' \ '-S[load the extended state information from non-standard state file]:state file:_files' \ '-u[begin updating the package lists as soon as the program starts]' \ '-i[displays a download preview when the program starts]' \ + '-Z[show how much disk space will be used or freed by the individual packages]' \ '1: :->cmds' \ '*: :->args' && ret=0 case $state in + aptitude-releases) + releases=( + ${${(M)${(f)"$(</etc/apt/sources.list)"}\ +:#[ $'\t']#deb(|-src)*}/(#b)[ $'\t']#[^ $'\t']##[ $'\t']##[^ $'\t']##[ $'\t']##([^ $'\t']##)*/$match[1]} + ) + _description releases expl release + compadd "$expl[@]" -a releases && ret=0 + ;; cmds) cmds=( ${${(M)${(f)"$(_call_program commands aptitude -h 2>/dev/null)"}:# [^- ][^ ]## *}/(#b) ([^ ]##) ##(- )#([^- ]*)/$match[1]:$match[3]:l}) _describe -t commands 'aptitude command' cmds && ret=0 ;; + format-strings) + compset -P '(%\#[0-9]|%[A-Za-z%]|[^%])#' + compset -S '*' + zstyle -s ":completion:${curcontext}:format-specifiers" list-separator sep || sep=-- + specs=( + '%%:literal %' '%#:parameter replacement' '%a:action flag' + '%A:action' '%B:broken count' '%c:current state flag' + '%C:current state' '%d:description' '%D:package size' + '%E:architecture' '%H:hostname' '%i:pin priority' + '%I:installed size' '%m:maintainer' '%M:automatic flag' + '%n:program version' '%N:program name' '%o:download size' + '%O:origin' '%p:package name' '%P:priority' + '%r:reverse depends count' '%R:abbreviated priority' '%s:section' + '%S:trust status' '%t:archive' '%T:tagged' + '%u:disk usage change' '%v:current version' '%V:candidate version' + '%Z:size change' + ) + zformat -a disp " $sep " $specs + _description format-specifiers expl 'format specifier' + compadd "$expl[@]" -S '' -d disp - ${specs%:*} + ;; + orderings) + line=( "${(@)${(@)${(@s.,.)PREFIX}#(\\|)\~}[1,-2]}" ) + compset -P '*,' + compset -S ',*' || suf=( -qS , ) + if ! compset -P '(\\|)~'; then + _description prefixes expl 'reverse order' + compadd "$expl[@]" -S '' \~ && ret=0 + fi + _description sort-key expl 'order [name,version]' + compadd -F line "$expl[@]" $suf - installsize installsizechange debsize \ + name priority version && ret=0 + ;; args) case $line[1] in search) diff --git a/Completion/Debian/Command/_axi-cache b/Completion/Debian/Command/_axi-cache index bdefdd979..5fd4c38f8 100644 --- a/Completion/Debian/Command/_axi-cache +++ b/Completion/Debian/Command/_axi-cache @@ -10,7 +10,7 @@ _arguments \ '*:args:->args' && return 0 if (( CURRENT == 2 )); then - _wanted tag expl 'axi-cache commands' \ + _wanted tag expl 'axi-cache command' \ compadd help search more last show again info \ rdetails depends madison policy showpkg showsrc else diff --git a/Completion/Debian/Command/_dak b/Completion/Debian/Command/_dak index 086196c4a..9976c7371 100644 --- a/Completion/Debian/Command/_dak +++ b/Completion/Debian/Command/_dak @@ -27,7 +27,7 @@ case $cmd in '(-G --greaterthan)'{-G,--greaterthan} '(-r --regex)'{-r,--regex} '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental' - '(-S, --source-and-binary)'{-S,--source-and-binary} + '(-S --source-and-binary)'{-S,--source-and-binary} '*:package:_deb_packages avail' ) ;; @@ -75,7 +75,7 @@ case $cmd in '(-p --partial)'{-p,--partial}'[do not affect override files]' '(-R --rdep-check)'{-R,--rdep-check}'[check reverse dependencies]' '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable experimental' - '(-S, --source-only)'{-S,--source-only}'[remove source only]' + '(-S --source-only)'{-S,--source-only}'[remove source only]' '*:package:_deb_packages avail' ) ;; @@ -155,10 +155,10 @@ case $cmd in '(-c --component)'{-c,--component=}':component:(main contrib non-free)' '(-s --suite)'{-s,--suite=}':suite:(oldstable stable testing unstable experimental)' '(-t --type)'{-t,--type=}':type:(deb dsc udeb)' - '(-a, --add)'{-a,--add}'[add overrides]' - '(-S, --set)'{-S,--set}'[set overrides]' - '(-l, --list)'{-l,--list}'[list overrides]' - '(-q, --quiet)'{-q,--quiet}'[be less verbose]' + '(-a --add)'{-a,--add}'[add overrides]' + '(-S --set)'{-S,--set}'[set overrides]' + '(-l --list)'{-l,--list}'[list overrides]' + '(-q --quiet)'{-q,--quiet}'[be less verbose]' ) ;; @@ -207,7 +207,7 @@ case $cmd in (poolize) args+=( - '(-l --limit)'{-l,--limit=}'[only migrate amount of packages]:amount in kb:' + '(-l --limit)'{-l,--limit=}'[only migrate amount of packages]:amount (kb)' '(-n --no-action)'{-n,--no-action}'[do not do anything]' '(-v --verbose)'{-v,--verbose}'[explain what is being done]' ) diff --git a/Completion/Debian/Command/_debsnap b/Completion/Debian/Command/_debsnap new file mode 100644 index 000000000..b9393cac4 --- /dev/null +++ b/Completion/Debian/Command/_debsnap @@ -0,0 +1,77 @@ +#compdef debsnap + +# Based on debsnap from devscripts-2.20.3 + +local context state state_descr line ret=1 +local -a expl +typeset -A opt_args + +_arguments \ + '(-d --destdir)'{-d+,--destdir=}'[set download directory]:download directory:_files -/' \ + '(-f --force)'{-f,--force}'[allow non-empty destination directory]' \ + '(-v --verbose)'{-v,--verbose}'[print configuration and report progress]' \ + --list"[list versions; don't download]" \ + --binary'[operate on binary packages (default: source packages)]' \ + '*'{-a+,--architecture=}'[specify architectures to download]:architecture to download:_deb_architectures' \ + --first='[download all versions newer than this]:version number (lower bound):->versions' \ + --last='[download all versions older than this]:version number (upper bound):->versions' \ + '(-)'{-h,--help}'[show usage information]' \ + '(-)'--version'[show version number and license]' \ + '1: :->package' \ + '2:version number to download:->versions' \ + && ret=0 + +# -a implies --binary +if (( ${+opt_args[-a]} || ${+opt_args[--architecture]} )); then + opt_args[--binary]='' +fi + +case $state in + (package) + if (( ${+opt_args[--binary]} )); then + _description binary-packages expl 'binary package to download' + _deb_packages "${expl[@]}" avail && ret=0 + else + _description source-packages expl 'source package to download' + _deb_packages "${expl[@]}" source && ret=0 + fi + ;; + (versions) + local package=${(Q)line[1]} + if [[ -n $package ]]; then + # Compute the arguments to --list + local -a args + () { + local i j + + # repeatable flags with arguments, where the values can't contain colons + for i in ${(k)opt_args[(I)(-a|--architecture)]}; do + for j in ${(@s.:.)opt_args[$i]}; do + [[ -n $j ]] || continue + args+=( $i $j ) + done + done + + # non-repeatable flags with arguments, where the values may contain colons + for i in ${(k)opt_args[(I)(--first|--last)]}; do + # Avoid spurious "No matches" results in 'debsnap --first 42.1 --last 42.<TAB>'. + [[ $context != option${i}-* ]] || continue + + # Un-escape colons (epoch separators in the version number) + args+=( $i ${(Q)opt_args[$i]} ) + done + + # flags without arguments + args+=( ${(k)opt_args[(I)(--binary)]} ) + } + + local -a versions=( ${(Oaf)"$(_call_program versions debsnap --list ${args} -- ${line[1]})"} ) + _description -V versions expl ${state_descr} + compadd "$@" "${expl[@]}" -a versions && ret=0 + else + _message -- $state_descr && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Debian/Command/_dpkg b/Completion/Debian/Command/_dpkg index 3477e6116..48ea2db97 100644 --- a/Completion/Debian/Command/_dpkg +++ b/Completion/Debian/Command/_dpkg @@ -86,7 +86,7 @@ _dpkg_deb_and_query_only_options=( _dpkg_query_actions=( '(--status -s)'{--status,-s}'[display package status]:*:packages:->status' '(--print-avail -p)'{--print-avail,-p}'[display available details]:packages:_deb_packages avail' - '(--listfiles, -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles' + '(--listfiles -L)'{--listfiles,-L}'[list owned files]:*:packages:->listfiles' '(--list -l)'{--list,-l}'[list packages]:*:packages:->list' '(--search -S)'{--search,-S}'[search for file owner]:*:pattern:->search' '--admindir=[data directory]:directory:_files -/' diff --git a/Completion/Debian/Command/_dscverify b/Completion/Debian/Command/_dscverify new file mode 100644 index 000000000..84b00e4e7 --- /dev/null +++ b/Completion/Debian/Command/_dscverify @@ -0,0 +1,26 @@ +#compdef dscverify + +# $ dscverify --version +# This is dscverify, from the Debian devscripts package, version 2.20.2 +# ... + +local all_opts=( + '--help[show the help message and exit]' + '--version[show the version + copyright and exit]' + '--no-default-keyrings[do not check against the default keyrings]' + '*--keyring[add keyring to the list of keyrings used]:keyring:_files -g "*.(kbx|gpg)(-.)"' + '(--nosigcheck --no-sig-check -u)'{--nosigcheck,--no-sig-check,-u}"[don't verify the GPG signature]" + "--verbose[don't suppress GPG output]" + '*:dsc file:_files -g "*.(changes|dsc|buildinfo)(-.)"' +) + +local first_only=( + '(--no-conf --noconf)'{--no-conf,--noconf}"[don't read the devscripts config file]" +) + +if (( CURRENT == 2 )); then + all_opts+=( $first_only ) +fi + +_arguments \ + "$all_opts[@]" diff --git a/Completion/Debian/Command/_git-buildpackage b/Completion/Debian/Command/_git-buildpackage index c38edc1cc..81bf7dac9 100644 --- a/Completion/Debian/Command/_git-buildpackage +++ b/Completion/Debian/Command/_git-buildpackage @@ -13,14 +13,14 @@ _arguments \ '--git-sign-tags[sign tags]' \ '--git-no-sign-tags[negates --git-sign-tags]' \ '--git-keyid=-[GPG keyid to sign tags with]:GPG key:' \ - '--git-debian-tag=-[format string for debian tags]:default is debian/%(version)s:' \ - '--git-upstream-tag=-[format string for upstream tags]:default is upstream/%(version)s:' \ + '--git-debian-tag=-[format string for debian tags]:format string [debian/%%(version)s]' \ + '--git-upstream-tag=-[format string for upstream tags]:format string [upstream/%%(version)s]' \ '--git-pristine-tar[use pristine-tar to create .orig.tar.gz]' \ '--git-no-pristine-tar[negates --git-pristine-tar]' \ '--git-force-create[force creation of orig.tar.gz]' \ '--git-no-create-orig[do not create orig.tar.gz]' \ '--git-tarball-dir=-[location to look for external tarballs]:tarball directory:_files -/' \ - '--git-compression=-[compression type]:compression:(auto gzip bzip2 lzma xz)' \ + '--git-compression=-[compression type]:compression type [auto]:(auto gzip bzip2 lzma xz)' \ '--git-compression-level=-[set compression level]:level:(1 2 3 4 5 6 7 8 9)' \ '--git-upstream-branch=-[upstream branch]::' \ '--git-debian-branch=-[branch the Debian package is being developed on]::' \ diff --git a/Completion/Debian/Command/_lintian b/Completion/Debian/Command/_lintian index 71e71ee3d..03491624f 100644 --- a/Completion/Debian/Command/_lintian +++ b/Completion/Debian/Command/_lintian @@ -8,8 +8,8 @@ case "$service" in '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-S,--setup-lab}'[setup or update the laboratory]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-R,--remove-lab}'[remove the laboratory directory]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-c,--check}'[run all checks over the specified packages]' \ - '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \ - '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]:checks:_values -s , "lintian checks" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \ + '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-C,--check-part}'[run only the specified checks]: :_values -s , "lintian check" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \ + '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-X,--dont-check-part}'[run only the specified checks]: :_values -s , "lintian check" binaries bin changelog-file chg conffiles cnf control-file dctrl control-files ctl copyright-file cpy cruft deb deb-format dfmt debconf dc debdiff dif debian-readme drm debhelper dh description des etcfiles etc fields fld files fil huge-usr-share hus infofiles info init.d ini manpages man md5sums md5 menus men menu-format mnf perl prl po-debconf pd scripts scr shared-libs shl spelling splr standards-version std' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-u,--unpack}'[unpack up to unpack level]' \ '(-c -r -u -C -R -S -X --check --check-part --dont-check-part --remove --remove-lab --setup-lab --unpack)'{-r,--remove}'[clean packages up to current unpack level]' \ '(-h --help)'{-h,--help}'[help]' \ @@ -23,7 +23,7 @@ case "$service" in '(-o --no-override)'{-o,--no-override}'[do not use the overrides file]' \ '--show-overrides[output tags that have been overridden]' \ '--color:when:(never always auto)' \ - '(-U --unpack-info)'{-U,--unpack-info}'[collect information]:info:_values -s , "collectibles" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \ + '(-U --unpack-info)'{-U,--unpack-info}'[collect information]:info:_values -s , "collectible" changelog-file copyright-file debfiles debian-readme diffstat doc-base-files file-info init.d md5sums menu-files objdump-info override-file scripts source-control-file' \ '(-m --md5sums)'{-m,--md5sums}'[check md5sums when processing a .changes file]' \ '--allow-root[override warning when run with superuser privileges]' \ '--cfg:config file:_files' \ diff --git a/Completion/Debian/Command/_madison b/Completion/Debian/Command/_madison index 445b79a45..dfdf1b438 100644 --- a/Completion/Debian/Command/_madison +++ b/Completion/Debian/Command/_madison @@ -9,6 +9,6 @@ _arguments \ '(-h --help)'{-h,--help} \ '(-r --regex)'{-r,--regex} \ '(-s --suite)'{-s,--suite=}':suite:_values -s , "suite list" oldstable stable testing unstable' \ - '(-S, --source-and-binary)'{-S,--source-and-binary} \ + '(-S --source-and-binary)'{-S,--source-and-binary} \ '*:package:_deb_packages avail' diff --git a/Completion/Debian/Command/_module-assistant b/Completion/Debian/Command/_module-assistant index d75284954..b2c1e56ee 100644 --- a/Completion/Debian/Command/_module-assistant +++ b/Completion/Debian/Command/_module-assistant @@ -33,5 +33,5 @@ _arguments -A \ '(-k --kernel-dir)'{-k,--kernel-dir}'[list of kernel headers/source directories, comma separated]:list of dirs:_files -/' \ '(-t --text-mode)'{-t,--text-mode}'[no progress bars]' \ '1:list of commands:_values -s , subcommands "${_module_assistant_commands[@]}"' \ - '*:packages: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)' + '*:package: compadd /usr/src/modass/var_cache_modass/*.avail_version(N:t:r) /var/cache/modass/*.avail_version(N:t:r)' diff --git a/Completion/Linux/Command/_alsa-utils b/Completion/Linux/Command/_alsa-utils index 91bb0b86c..dd5c26866 100644 --- a/Completion/Linux/Command/_alsa-utils +++ b/Completion/Linux/Command/_alsa-utils @@ -38,7 +38,7 @@ opts=( --disable-format'[disable automatic format conversions]' --disable-softvol'[disable software volume control (softvol)]' --test-position'[test ring buffer position]' - --test-coef='[test coefficient for ring buffer position (default 8)]' + --test-coef='[test coefficient for ring buffer position]:coefficient [8]' --test-nowait'[do not wait for ring buffer - eats whole CPU]' --max-file-time='[start another output file when the old file has recorded]' --process-id-file='[write the process ID here]' diff --git a/Completion/Linux/Command/_basenc b/Completion/Linux/Command/_basenc new file mode 100644 index 000000000..515621aaa --- /dev/null +++ b/Completion/Linux/Command/_basenc @@ -0,0 +1,30 @@ +#compdef basenc +# based on GNU coreutils 8.32 + +local specs=( + + '(type)' + "(info)--base64[same as 'base64' program (RFC4648 section 4)]" + "(info)--base64url[file- and url-safe base64 (RFC4648 section 5)]" + "(info)--base32[same as 'base32' program (RFC4648 section 6)]" + "(info)--base32hex[extended hex alphabet base32 (RFC4648 section 7)]" + "(info)--base16[hex encoding (RFC4648 section 8)]" + "(info)--base2msbf[bit string with most significant bit (msb) first]" + "(info)--base2lsbf[bit string with least significant bit (lsb) first]" + "(info)--z85[ascii85-like encoding (ZeroMQ spec-32/Z85)]" + + + enc + '(info dec -w --wrap)'{-w+,--wrap=}"[wrap encoded lines at specified column]:number of characters (0=disable wrapping) [76]: " + + + dec + '(info enc -d --decode)'{-d,--decode}"[decode data]" + '(info enc -i --ignore-garbage)'{-i,--ignore-garbage}"[when decoding, ignore non-alphabet characters]" + + + info + "(: -)--help[display help information and exit]" + "(: -)--version[output version information and exit]" + + + input + '(info)1:input file:_files' +) + +_arguments -s -S : $specs diff --git a/Completion/Linux/Command/_btrfs b/Completion/Linux/Command/_btrfs index eb31580ad..65cf067aa 100644 --- a/Completion/Linux/Command/_btrfs +++ b/Completion/Linux/Command/_btrfs @@ -17,11 +17,14 @@ cmds_7=( get set list ) cmds_8=( enable disable rescan help ) cmds_9=( assign remove create destroy show limit help ) cmds_10=( start status cancel help ) -cmds_11=( chunk-recover fix-device-size super-recover zero-log ) +cmds_11=( chunk-recover fix-device-size super-recover zero-log create-control-device ) _arguments -C -A "-*" "$args[@]" \ '(- *)--help[print help information]' \ '(- *)--version[print version information]' \ + '(-v --verbose -q --quiet --help --version)'{-v,--verbose}'[verbose output of operation]' \ + '(-v --verbose -q --quiet --help --version)'{-q,--quiet}'[suppress all messages except errors]' \ + '(--help --version)--format=[specify output format]:format:(text json)' \ '(--version)1: :->groups' \ '2: :->cmds' \ '*:: :->args' && ret=0 @@ -60,6 +63,11 @@ while (( $#state )); do fi args=( '(-)--help[print help information]' ) case ${cont} in + (balance|replace):start|device:(add|delete|remove)|filesystem:resize) + args+=( + "--enqueue[wait if there's another exclusive operation running, otherwise continue]" + ) + ;| subvolume:create) args+=( '*-i[add the newly created subvolume to a qgroup]:qgroup' @@ -67,10 +75,10 @@ while (( $#state )); do ) ;; subvolume:delete) - args+=( + args+=( '!-v' '!--verbose' '(-c --commit-after -C --commit-each)'{-c,--commit-after}'[wait for transaction commit at the end of the operation]' '(-c --commit-after -C --commit-each)'{-C,--commit-each}'[wait for transaction commit after deleting each subvolume]' - '(-v --verbose)'{-v,--verbose}'[verbose output of operations]' + '(-i --subvolid)'{-i+,--subvolid=}'[specify id of subvolume to be removed]:subvolume id' '1:subvolume:_files -/' ) ;; @@ -112,7 +120,7 @@ while (( $#state )); do ;| subvolume:sync) args+=( '-s[sleep between checks]:delay (seconds) [1]' );; subvolume:find-new) args+=( '1:subvol:_files -/' '2:lastgen: _message "last gen"' );; - (device|filesystem|qgroup|subvolume):(df|du|show|usage)) + (device|filesystem|qgroup|subvolume):(df|du|show|usage)|scrub:status) args+=( '--iec[use 1024 as a base]' '--si[use 1000 as a base]' @@ -129,7 +137,7 @@ while (( $#state )); do '(-t --tbytes)'{-t,--tbytes}'[show sizes in TiB, or TB with --si]' ) ;| - (filesystem|qgroup):(du|show)) + (filesystem|qgroup|scrub):(du|show|status)) args+=( '--raw[output raw numbers in bytes]' '--human-readable[output human friendly numbers, base 1024]' @@ -139,17 +147,16 @@ while (( $#state )); do '--tbytes[show sizes in TiB, or TB with --si]' ) ;| - filesystem:resize) args+=( '1:size:_guard "(|+|-)[0-9]#[GKM]"' '2:path:->mounts' );; + filesystem:resize) args+=( '1: :_numbers -u bytes -N size K M G T P E' '2:path:->mounts' );; filesystem:defragment) - args+=( - '-v[verbose]' + args+=( '!-v' '-r[defragment files recursively]' '-c+[compress files while defragmenting]::compression algorithm:(zlib lzo zstd)' '-r[defragment files recursively]' '-f[flush after defragmenting]' - '-s[start position]:byte position' - '-l[defragment limited number of bytes]:length (bytes)' - '-t[defragment only files over a certain size]:minimum size (bytes) [32M]' + '-s[start position]: :_numbers -u bytes -d "beginning of file" offset K M G T P E' + '-l[defragment limited number of bytes]: :_numbers -u bytes length K M G T P E' + '-t[defragment only extents up to a certain size]: :_numbers -u bytes -d 32M "maximum extent size" K M G T P E' '*:file:_files' ) ;; @@ -192,10 +199,9 @@ while (( $#state )); do ;; device:ready) args+=( '1:device: _files -g "*(-%)"' );; scrub:(start|resume)) - args+=( + args+=( '!-q' "-B[don't background and print statistics at end]" '-d[print separate statistics for each device]' - '-q[omit error message and statistics]' '-r[read only mode]' '-R[raw print mode]' '-c[set ioprio class]:class:(( 0\:none 1\:realtime 2\:best-effort 3\:idle))' @@ -215,18 +221,17 @@ while (( $#state )); do ) ;; balance:start) - args+=( + args+=( '!-v' '!--verbose' '(-m -s)-d+[act on data chunks]:filter:->filters' '(-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 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 -/' ) ;; - balance:status) args+=( '-v[verbose mode]' '1:path:_files -/' );; + balance:status) args+=( '!-v' '!--verbose' '1:path:_files -/' );; balance:(pause|cancel|resume)) args+=( '1:path:_files -/' );; property:set) args+=( '3:value' );& property:get) args+=( '2:property:(ro label compression)' );& @@ -244,10 +249,14 @@ while (( $#state )); do '1:path:_files -/' ) ;; - qgroup:(assign|remove)) args+=( '1:source path:_files -/' - '2:destination path:_files -/' '3:path:_files -/' );| - qgroup:assign) args+=( \!--rescan - "--no-rescan[don't do a rescan, even if the assignment will make the quotas inconsistent]" ) + qgroup:(assign|remove)) + args+=( + \!--rescan + "--no-rescan[don't do a rescan, even if the quotas may become inconsistent]" + '1:source path:_files -/' + '2:destination path:_files -/' + '3:path:_files -/' + ) ;; qgroup:(create|destroy)) args+=( '1:qgroupid:' '2:path:_files -/' );; qgroup:show) @@ -296,6 +305,11 @@ while (( $#state )); do '(-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]' "--noscan[don't scan devices from the filesystem, use only the listed ones]" + '!(--dfs)--bfs' + '--dfs[depth-first traversal of the trees]' + '--hide-names[hide filenames/subvolume/xattrs and other name references]' + '--csum-headers[print node checksums stored in headers (metadata)]' + '--csum-items[print checksums stored in checksum items (data)]' ) ;; inspect*:dump-super) @@ -307,12 +321,12 @@ while (( $#state )); do '--bytenr[specify alternate superblock offset]:offset' ) ;; - inspect*:inode*) args+=( '-v[verbose mode]' '1:inode:_files' '2:path:_files -/' );; - inspect*:subvol*) args+=( '-v[verbose mode]' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );; + inspect*:inode*) args+=( '!-v' '1:inode:_files' '2:path:_files -/' );; + inspect*:subvol*) args+=( '!-v' '1:subvolid:_guard "[0-9]#" subvolume id' '2:path:_files -/' );; inspect*:logical*) - args+=( - '-v[verbose mode]' + args+=( '!-v' '-P[skip the path resolving and print the inodes instead]' + '-o[ignore offsets when matching references]' '-s[specify buffer size]:buffer size [4096]' '1:logical address:_files' '2:filesystem path:_files -/' @@ -322,9 +336,8 @@ while (( $#state )); do inspect*:rootid) args+=( '1:path:_files -/' );; inspect*:tree*) args+=( '-b[print raw numbers in bytes]' );; rescue:(chunk|super)-recover) - args+=( + args+=( '!-v' '-y[assume yes to every question]' - '-v[verbose mode]' '1:device:_files' ) [[ ${${(P)group}[cmd]} == chunk-recover ]] && args+=('(-)-h[display help]') @@ -352,12 +365,11 @@ while (( $#state )); do ) ;; restore) - args+=( + args+=( '!-v' '!--verbose' '(-s --snapshots)'{-s,--snapshots}'[get snapshots]' '(-x --xattr)'{-x,--xattr}'[restore extended attributes]' '(-m --metadata)'{-m,--metadata}'[restore owner, mode and times]' '(-S --symlink)'{-S,--symlink}'[restore symbolic links]' - '(-v --verbose)'{-v,--verbose}'[be verbose and output what is restored]' '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors]' '(-o --overwrite)'{-o,--overwrite}'[overwrite directories and files]' '-t[specify tree location]:tree root' @@ -374,23 +386,20 @@ while (( $#state )); do ) ;; send|receive) - args+=( '(-q --quiet)'{-q,--quiet}'[suppress all messages except errors]' ) + args+=( '!-q' '!--quiet' ) ;| send) - args+=( - '*-v[verbose mode]' + args+=( '!-v' '-e[if sending multiple subvolumes at once, use the new format]' '-p[send incremental stream]:parent:_files -/' '*-c[use snapshot as clone source]:clone:_files -/' '-f[specify output file]:file:_files' '--no-data[send in NO_FILE_DATA mode]' - '(-v --verbose)'{-v,--verbose}'[enable verbose output]' '1:subvolume:_files -/' ) ;; receive) - args+=( - '*-v[verbose mode]' + args+=( '!-v' '-f[input file]:file: _files' '-e[terminate after <end cmd>]' '(-C --chroot)'{-C,--chroot}'[confine the process to destination path using chroot(1)]' diff --git a/Completion/Linux/Command/_choom b/Completion/Linux/Command/_choom new file mode 100644 index 000000000..2a6dd03c7 --- /dev/null +++ b/Completion/Linux/Command/_choom @@ -0,0 +1,10 @@ +#compdef choom + +_arguments -S \ + '(H -n --adjust)'{-n,--adjust}'+[specify the adjust score value (-1000...1000)]:score (-1000...1000)' \ + '(H -p --pid)'{-p,--pid}'[interpret args as process ID]:process ID:_pids' \ + '(H -p --pid):command:_command_names' \ + '*::arguments:_normal' \ + + 'H' \ + '(- *)'{-V,--version}'[display version information]' \ + '(- *)'{-h,--help}'[display help information]' diff --git a/Completion/Linux/Command/_cpupower b/Completion/Linux/Command/_cpupower index ae1f1d3d1..6763bdd12 100644 --- a/Completion/Linux/Command/_cpupower +++ b/Completion/Linux/Command/_cpupower @@ -20,11 +20,12 @@ cmds=( 'info:show global power parameters' 'set:set global power parameters' 'monitor:report frequency and idle statistics' + 'powercap-info:show powercapping related kernel and hardware configurations' 'help:print usage information' ) case $state in cmds) - _describe command cmds && ret=0 + _describe command cmds -M 'r:|-=* r:|=*' && ret=0 ;; args) curcontext="${curcontext%:*}-$words[1]" diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index 45159d0be..f7149a76f 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -21,6 +21,7 @@ _arguments -s \ '--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' \ + '--device-size=[use only specified device size (ignore rest of device)]:size (bytes)' \ '(-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]' \ @@ -44,10 +45,12 @@ _arguments -s \ '--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)' \ + '(-M --type)'{-M+,--type=}'[specify type of device metadata]:type:(luks luks1 luks2 plain loopaes tcrypt bitlk)' \ '--force-password[disable password quality check (if enabled)]' \ '--perf-same_cpu_crypt[use dm-crypt same_cpu_crypt performance compatibility option]' \ '--perf-submit_from_crypt_cpus[use dm-crypt submit_from_crypt_cpus performance compatibility option]' \ + '--perf-no_read_workqueue[bypass dm-crypt workqueue and process read requests synchronously]' \ + '--perf-no_write_workqueue[bypass dm-crypt workqueue and process write requests synchronously]' \ '--deferred[device removal is deferred until the last user closes it]' \ '--serialize-memory-hard-pbkdf[use global lock to serialize memory]' \ '--pbkdf=[specify PBKDF algorithm for LUKS2]:algorithm:(argon2i argon2id pbkdf2)' \ @@ -60,14 +63,16 @@ _arguments -s \ '(-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]" \ + '--integrity-legacy-padding[use inefficient legacy padding (old kernels)]' \ "--token-only[don't ask for passphrase if activation by token fails]" \ '--token-id=[specify token number]:number [any]' \ '--key-description=[specify key description]:description' \ '--sector-size=[specify encryption sector size]:size [512 bytes]' \ + '--iv-large-sectors[use IV counted in sector size (not in 512 bytes)]' \ '--persistent[set activation flags persistent for device]' \ '--label=[set label for the LUKS2 device]:label' \ '--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \ - '--unbound[create unbound (no assigned data segment) LUKS2 keyslot]' \ + '--unbound[create or dump unbound (no assigned data segment) LUKS2 keyslot]' \ '--json-file=[read or write token to json file]:json file:_files -g "*.json(-.)"' \ '--luks2-metadata-size=[specify LUKS2 header metadata area size]:size (bytes)' \ '--luks2-keyslots-size=[specify LUKS2 header keyslots area size]:size (bytes)' \ @@ -77,12 +82,13 @@ _arguments -s \ '--encrypt[Encrypt LUKS2 device (in-place encryption)]' \ '--decrypt[decrypt LUKS2 device (remove encryption)]' \ '--init-only[initialize LUKS2 reencryption in metadata only]' \ + '--resume-only[resume initialized LUKS2 reencryption only]' \ '--reduce-device-size=[reduce data device size (move data offset)]:size (bytes)' \ '--hotzone-size=[specify maximal reencryption hotzone size]:size (bytes)' \ '--resilience=[specify reencryption hotzone resilience type]:resilience type:(checksum journal none)' \ '--resilience-hash=[specify reencryption hotzone checksums hash]:string' \ '--active-name=[override device autodetection of dm device to be reencrypted]:string' \ - "${ign}(- : *)--version[show version information]" \ + "${ign}(- : *)"{-V,--version}'[show version information]' \ "${ign}(- : *)"{-\?,--help}'[display help information]' \ "${ign}(- : *)--usage[display brief usage]" \ ':action:->actions' \ @@ -111,6 +117,7 @@ case $state in 'isLuks:check if device is a LUKS partition' 'luksDump:dump header information' 'tcryptDump:dump TCRYPT device information' + 'bitlkDump:dump BITLK device information' 'luksSuspend:suspend LUKS device and wipe key' 'luksResume:resume suspended LUKS device' 'luksHeaderBackup:store binary backup of headers' diff --git a/Completion/Linux/Command/_dkms b/Completion/Linux/Command/_dkms index a0a666e33..2a3c016c5 100644 --- a/Completion/Linux/Command/_dkms +++ b/Completion/Linux/Command/_dkms @@ -8,6 +8,7 @@ subcmds=( 'add:add a module/version combination to the tree for builds and installs' 'remove:remove a module from the tree' 'build:compile a module for a kernel' + 'unbuild:undoes the build of a module' "install:install a build module for it's corresponding kernel" 'uninstall:uninstall a module for a kernel' 'match:install every module that is installed for a template kernel for another kernel' @@ -17,6 +18,7 @@ subcmds=( 'mkrpm:create an RPM package for a module' 'mkdeb:create a debian binary package for a module' 'mkdsc:create a debian source package for a module' + 'mkbmdeb:create a debian package containing just binary modules' 'mkkmp:create a Kernel Module Package source RPM for a module' 'status:display the current status of modules, versions and kernels within the tree' 'autoinstall:try to install the latest revision of all modules that have been installed for other kernel revisions' @@ -32,6 +34,7 @@ args=( '--installtree=:path:_directories' '--sourcetree=:path:_directories' '--dkmsframework=:path:_directories' + '--force-version-override' '1: : _describe -t commands command subcmds' ) @@ -44,7 +47,7 @@ else '(remove|build|install|uninstall|match|status|mk(^kmp))' 'k' \ '(add|remove)' '-rpm_safe_upgrade' \ 'mk(driverdisk|kmp)' '-spec' \ - 'mk(deb|dsc|rpm)' '-legacy-postinst' \ + 'mk(deb|dsc|bmdeb|rpm)' '-legacy-postinst' \ 'mk(tarball|rpm|deb|dsc)' '-(source|binary)-only' \ '(match|build|mkkmp)' '(k|-no-(prepare|clean)-kernel|-kernelsourcedir)' \ '(|un)install' '-no-(depmod|initrd)' \ @@ -67,7 +70,7 @@ case $cmd in remove|build|install|uninstall|mk*|status) args+=( ': :->modules' ) ;| - |remove|build|install|uninstall|match|status|mk(^kmp)) + |remove|(un|)build|install|uninstall|match|status|mk(^kmp)) args+=( '(--all)*-k[specify kernel version]:kernel:->kernels' ) ;| |add|remove) args+=( "${ign}--rpm_safe_upgrade" ) ;| @@ -77,7 +80,7 @@ case $cmd in |(mk|ld)tarball) args+=( "${ign}--archive=:tarball:_files -g '*.tar(-.)'" ) ;| - |mk(deb|dsc|rpm)) + |mk(deb|dsc|bmdeb|rpm)) args+=( "${ign}--legacy-postinst=:value [1]:(0 1)" ) ;| |mk(tarball|rpm|deb|dsc)) args+=( "${ign}(--source-only --binaries-only)--"{source,binaries}-only ) ;| @@ -100,7 +103,7 @@ case $cmd in '-c[specify location of dkms.conf file]:location:_files' ) ;| - |remove|build|install|status|mk(^kmp)) + |remove|(un|)build|install|status|mk(^kmp)) args+=( '(-a --arch -k)--all[specify all relevant kernels/arches]' ) ;| |build) diff --git a/Completion/Linux/Command/_ethtool b/Completion/Linux/Command/_ethtool index dccda4684..95a8bbfb6 100644 --- a/Completion/Linux/Command/_ethtool +++ b/Completion/Linux/Command/_ethtool @@ -5,16 +5,21 @@ local -a state line expl cmds local -A opt_args _arguments -C \ + '--debug[turn on debugging messages]:mask:((1\:parser\ information))' \ + '--json[output results in JSON]' \ + '(-I --include-statistics)'{-I,--include-statistics}'[include command-related statistics in the output]' \ + '(cmds)'{-Q,--per-queue}'[apply per-queue command]: :(queue_mask):queue mask' \ "1:interface:_net_interfaces" \ - '*: :->args' \ + '*:: :->args' \ + + '(cmdc)' \ + '(cmds)'{-c,--show-coalesce}'[query the specified ethernet device for coalescing information]' \ + '(cmds)'{-C,--coalesce}'[change the coalescing settings of the specified ethernet device]' \ + '(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]' \ @@ -46,10 +51,21 @@ _arguments -C \ '--set-eee[set EEE settings]' \ '--set-phy-tunable[set PHY tunable]' \ '--get-phy-tunable[get PHY tunable]' \ + '--get-tunable[get tunable parameters]' \ + "--set-tunable[set driver's tunable parameters]" \ '--reset[reset hardware components]' \ '--show-fec[query device for forward error correction support]' \ '--set-fec[configure forward error correction for device]' \ - {-Q,--per-queue}'[apply per-queue command]' && return + '--cable-test[perform cable test and report the results]' \ + '--cable-test-tdr[perform cable test and report Time Domain Reflectometer data]' \ + '--show-tunnels[show tunnel-related device capabilities and state]' \ + '--monitor[listen to netlink notifications and displays them]::command:( + --all -s --change -k --show-features --show-offload -K + --features --offload --show-priv-flags --set-priv-flags -g --show-ring + -G --set-ring -l --show-channels -L --set-channels -c --show-coalesce + -C --coalesce -a --show-pause -A --pause --show-eee --set-eee + --cable-test --cable-test-tdr + )' && return if [[ -n $state ]]; then case $words[CURRENT-1] in @@ -62,7 +78,8 @@ if [[ -n $state ]]; then _wanted onoff expl 'enabled' compadd off on fi ;; - autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift|fast-link-down) + autoneg|adaptive-[rt]x|raw|hex|sg|tso|ufo|gso|lro|eee|tx-lpi|downshift) ;& + fast-link-down|energy-detect-power-down|mode) _wanted onoff expl 'enabled' compadd off on ;; rx-usecs|rx-frames|rx-usecs-irq|rx-frames-irq|tx-usecs|tx-frames) ;& @@ -71,6 +88,8 @@ if [[ -n $state ]]; then 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) ;& + page|bank|i2c|first|last|step|pair|lanes) ;& + rx-copybreak|tx-copybreak|pfc-prevention-tout) ;& other|combined|tx-timer|count|msecs) _message -e numbers 'number' ;; @@ -81,7 +100,10 @@ if [[ -n $state ]]; then _wanted duplex expl 'duplex mode' compadd half full ;; port) - _wanted port expl 'device port' compadd tp aui bnc mii fibre + _wanted port expl 'device port' compadd tp aui bnc mii fibre da + ;; + master-slave) + _wanted roles expl role compadd {preferred,forced}-{master,slave} ;; advertise) _values 'hexadecimal value (or a combination of the following)' \ @@ -93,7 +115,8 @@ if [[ -n $state ]]; then '0x020[1000 full]' \ '0x8000[2500 full(not supported by IEEE standards)]' \ '0x800[10000 full]' \ - '0x03F[auto]' + '0x03F[auto]' \ + 'mode[set mode]' ;; xcvr) _wanted xcvr expl 'transceiver type' compadd internal external @@ -144,7 +167,7 @@ if [[ -n $state ]]; then _message -e contexts 'RSS context' ;; *) - case $words[2] in + case ${${(Mk)opt_args:#cmd?*}[1]#cmd?-} in -A|--pause) _values -S ' ' -w 'pause parameter' \ 'autoneg[specify if pause autonegotiation is enabled]' \ @@ -192,6 +215,9 @@ if [[ -n $state ]]; then -p|--identify) (( CURRENT = 4 )) && _message -e length 'duration (seconds)' ;; + -S|--statistics) + _arguments '(-)--all-groups' '(-)--groups:eth-phy: :eth-mac: :eth-ctrl: :rmon' + ;; -t|--test) _values -S ' ' -w 'test mode' \ '(online)offline:perform full set of tests possibly causing normal operation interruption (default)]' \ @@ -202,8 +228,10 @@ if [[ -n $state ]]; then if (( ! $words[(I)msglvl] )); then _values -S ' ' -w 'generic option' \ 'speed[set speed in Mb/s]' \ + 'lanes[set number of lanes]' \ 'duplex[set full or half duplex mode]' \ 'port[select device port]' \ + 'master-slave[configure interface role]' \ 'autoneg[specify if autonegotiation is enabled]' \ 'advertise[set the speed and duplex advertised by autonegotiation]' \ 'phyad[PHY address]' \ @@ -274,16 +302,23 @@ if [[ -n $state ]]; then fi ;; -m|--dump-module-eeprom|--module-info) - _wanted options expl option compadd -F line - raw hex offset length + _wanted options expl option compadd -F line - raw hex offset \ + length page bank i2c ;; --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 fast-link-down msecs + _wanted options expl tunable compadd -F line - downshift count \ + fast-link-down msecs energy-detect-power-down ;; --get-phy-tunable) - _wanted options expl tunable compadd downshift fast-link-down + _wanted options expl tunable compadd downshift fast-link-down \ + energy-detect-power-down + ;; + --[gs]et-tunable) + _wanted options expl tunable compadd rx-copybreak tx-copybreak \ + pfc-prevention-tout ;; --reset) _wanted components expl component compadd flags dedicated all \ @@ -303,6 +338,9 @@ if [[ -n $state ]]; then _wanted options expl option compadd -c --show-coalescing -C --coalesce fi ;; + --cable-test-tdr) + _wanted options expl 'distance options' compadd first last step pair + ;; esac ;; esac diff --git a/Completion/Linux/Command/_findmnt b/Completion/Linux/Command/_findmnt index 9f13e695f..0c832364d 100644 --- a/Completion/Linux/Command/_findmnt +++ b/Completion/Linux/Command/_findmnt @@ -22,9 +22,12 @@ _arguments -s -C \ '(H -M --mountpoint :)'{-M+,--mountpoint=}'[specify the mountpoint]: :->targets' \ '(H -n --noheadings)'{-n,--noheadings}'[do not print a header line]' \ '(H -O --options)'{-O+,--options=}'[only print the filesystems with the specified options]:list of options: ' \ - '(H -o --output)'{-o+,--output=}'[specify output columns]: :->columns' \ + '(H -o --output --output-all)'{-o+,--output=}'[specify output columns]: :->columns' \ + '(H -o --output)--output-all[output all available columns]' \ '(H -p --poll)'{-p+,--poll=}'[monitor changes in /proc/self/mountinfo]::action:(mount umount remount move)' \ + '(H --real)--pseudo[print only pseudo-filesystems]' \ '(H -R --submounts)'{-R,--submounts}'[print recursively all submounts]' \ + '(H --pseudo)--real[print only real filesystems]' \ '(H -S --source :)'{-S+,--source=}'[specify the mount source]: :->sources' \ '(H -T --target :)'{-T+,--target=}'[specify the mount target]:target:_files' \ '(H -t --types)'{-t+,--types=}'[specify the type of filesystems]:filesystem types:_sequence -s , _file_systems' \ @@ -39,7 +42,7 @@ _arguments -s -C \ '(H)2:: :->targets' \ + '(format)' \ '(H)'{-D,--df}'[imitate the output of df command]' \ - '(H)'{-J,--json}'[use JASON output format]' \ + '(H)'{-J,--json}'[use JSON output format]' \ '(H)'{-l,--list}'[use list output format]' \ '(H)'{-P,--pairs}'[use key="value" output format]' \ '(H)'{-r,--raw}'[use raw output format]' \ @@ -101,7 +104,7 @@ case $state in 'prefixes:prefix:compadd -S "" LABEL= UUID= PARTLABEL= PARTUUID=' ) [[ $state = sources_targets ]] && - alts+=( 'mount-points:moutpoint:__findmnt_mountpoints' ) + alts+=( 'mount-points:mountpoint:__findmnt_mountpoints' ) _alternative $alts && ret=0 fi ;; diff --git a/Completion/Linux/Command/_free b/Completion/Linux/Command/_free index cc5bcf3bd..6d74e4a0d 100644 --- a/Completion/Linux/Command/_free +++ b/Completion/Linux/Command/_free @@ -1,5 +1,4 @@ #compdef free -# based on procps-ng-3.3.15 _arguments -s \ '(-l --lohi)'{-l,--lohi}'[show detailed low and high memory statistics]' \ @@ -7,6 +6,7 @@ _arguments -s \ '(-w --wide)'{-w,--wide}'[wide mode]' \ '(-s --seconds)'{-s,--seconds}'[specify the delay between display]:seconds: ' \ '(-c --count)'{-c+,--count=}'[specify the display count]:count: ' \ + '(-C --full-cache)'{-C,--full-cache}'[add further cache lines to main cache]' \ '--si[use power of 1000 instead of power of 1024]' \ '(-)--help[print help and exit]' \ '(-)'{-V,--version}'[print version information and exit]' \ diff --git a/Completion/Linux/Command/_fusermount b/Completion/Linux/Command/_fusermount index 02cb57237..41d3dec72 100644 --- a/Completion/Linux/Command/_fusermount +++ b/Completion/Linux/Command/_fusermount @@ -6,7 +6,7 @@ typeset -A opt_args _arguments \ '-h[display help information]' \ '-V[display version information]' \ - '-o[specify mount options]:mount options:_fuse_values "mount options"' \ + '-o[specify mount options]:mount option:_fuse_values "mount option"' \ '-u[unmount a fuse mount]' \ '-z[unmount lazily (work even when if the resource is still busy)]' \ '-q[suppress nonessential output]' \ diff --git a/Completion/Linux/Command/_ionice b/Completion/Linux/Command/_ionice index d64f1c496..ba403ca56 100644 --- a/Completion/Linux/Command/_ionice +++ b/Completion/Linux/Command/_ionice @@ -17,14 +17,14 @@ _arguments -C -s -S \ '(- *)'{-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)'{-P-,--pgid=-}'[specify process group IDs]::process group:_pgids' \ '(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' + _pgids && ret=0 elif (( $+opt_args[args--u] || $+opt_args[args---uid] )); then _message -e uids 'user id' else diff --git a/Completion/Linux/Command/_ipset b/Completion/Linux/Command/_ipset index d05f13caf..a40480904 100644 --- a/Completion/Linux/Command/_ipset +++ b/Completion/Linux/Command/_ipset @@ -4,7 +4,7 @@ local offset=0 local -a args from_to hash cmds listopts addopts _set_types () { - _values -S \ "Set type" \ + _values -S \ "set type" \ 'bitmap\:ip[uses a memory range to store IPv4 host (default) or IPv4 subnet addresses up to 65536 elements]'\ 'bitmap\:ip,mac[uses a memory range to store an IPv4 host/subnet and mac address pair up to 65536 elements]'\ 'bitmap\:port[uses a memory range to store port numbers independent of L4 protocol at up to 65536 elements]'\ @@ -25,7 +25,7 @@ _set_types () { _ipsets () { local -a vals vals=( ${${(M)${(f)"$(_call_program ipsets ipset -L)"}%Name: *}#Name: } ) - _describe -t ipsets "IP sets" vals + _describe -t ipsets "IP set" vals } _sets () { _ipsets @@ -37,18 +37,11 @@ from_to=('(--network)--from[from IP or network (with --netmask)]:IP' '(--from --to)--network[network]:IP/mask' ) -_addressfamily () { - vals=( inet - inet6 - ) - _describe -t addressfamily "Address Family" vals -} - -hash=( '--hashsize[the initial hash size aligned to a power of 2(default 1024)]:hashsize' - '--maxelem[the maximum number of elements in the set (default 65536)]:maxelements' - '--family[the protocol family of addresses to be stored in the set (default inet)]:addressfamily:_addressfamily' +hash=( '--hashsize[the initial hash size aligned to a power of 2]:hashsize [1024]' + '--maxelem[the maximum number of elements in the set]:max elements [65536]' + '--family[the protocol family of addresses to be stored in the set]:address family [inet]:(inet inet6)' '--timeout[adds timeout support to the set with your specified value as default, (0 = forever)]:entrytimeout' - '--probes[max number of tries to resolve clashing, altering this is discouraged (default 8)]:probes' + '--probes[max number of tries to resolve clashing, altering this is discouraged]:tries [8]' '--resize[ratio of increasing hash size after unsuccessful <probes> of double-hashing, altering discouraged]:percent' ) @@ -100,7 +93,7 @@ case $words[offset+2]; in args=( $hash ) ;; list\:set) - args=( '--size[size of the new setlist (default 8)]:size' ) + args=( '--size[size of the new setlist]:size [8]' ) ;; esac ;; @@ -118,7 +111,7 @@ _ips () { if (( $ips )); then vals1+=$i; else bindings+=${i/ ->/:}; fi done _describe -t ips "IPs from $words[offset+3] set" vals1 - _describe -t special_values "special values" vals2 + _describe -t special_values "special value" vals2 fi } diff --git a/Completion/Linux/Command/_losetup b/Completion/Linux/Command/_losetup index 54debe19e..f5a7ec1b1 100644 --- a/Completion/Linux/Command/_losetup +++ b/Completion/Linux/Command/_losetup @@ -33,14 +33,15 @@ _arguments -s -S \ {-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]' \ + '(-f --find 1)'{-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]' \ '--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]' \ - '1:file:_files' \ + "(-f)$device" \ + '2: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/_lsns b/Completion/Linux/Command/_lsns new file mode 100644 index 000000000..994101d97 --- /dev/null +++ b/Completion/Linux/Command/_lsns @@ -0,0 +1,18 @@ +#compdef lsns + +local ign + +(( $#words > 2 )) && ign='!' +_arguments -s -S \ + '(-J --json)'{-J,--json}'[use JSON output format]' \ + '(-l --list)'{-l,--list}'[use list format output]' \ + '(-n --noheadings)'{-n,--noheadings}"[don't print headings]" \ + '(-o --output)'{-o,--output}'[define which output columns to use]:column:_sequence compadd -M "m\:{a-z}={A-Z}" - NS TYPE PATH NPROCS PID PPID COMMAND UID USER NETNSID NSFS' \ + '(-p --task)'{-p+,--task=}'[print process namespaces]:process id:_pids' \ + '(-r --raw)'{-r,--raw}'[use the raw output format]' \ + '(-u --notruncate)'{-u,--notruncate}"[don't truncate text in columns]" \ + '(-W --nowrap)'{-W,--nowrap}"[don't use multi-line representation]" \ + '(-t --type)'{-t+,--type=}'[filter by namespace type]:namespace type:(mnt net ipc user pid uts cgroup)' \ + "$ign(- *)"{-h,--help}'[display usage information]' \ + "$ign(- *)"{-V,--version}'[display version information]' \ + '*: :_guard "^-*" namespace' diff --git a/Completion/Linux/Command/_mat b/Completion/Linux/Command/_mat new file mode 100644 index 000000000..ff65167ff --- /dev/null +++ b/Completion/Linux/Command/_mat @@ -0,0 +1,19 @@ +#compdef mat + +# Completion for mat 0.6.1 (https://tails.boum.org/blueprint/doc/mat) + +local curcontext="$curcontext" state line +typeset -A opt_args +_arguments \ + '(- *)'{-h,--help}'[show help message and exit]' \ + '(-a --add2archive)'{-a,--add2archive}'[add to output archive non-supported filetypes]' \ + '(-b --backup)'{-b,--backup}'[keep a backup copy]' \ + '(-L --low-pdf-quality)'{-L,--low-pdf-quality}'[produces a lighter, but lower quality PDF]' \ + '(-c --check -b --backup)'{-c,--check}'[check if a file is free of harmful metadatas]' \ + '(-d --display -b --backup)'{-d,--display}'[list all the harmful metadata of a file without removing them]' \ + '(- *)'{-l,--list}'[list all supported fileformats]' \ + '(- *)'{-v,--version}"[show program's version number and exit]" \ + '*:file:_files -g "*.(tif|tiff|png|jpeg|jpg|jpe|odt|fodt|odx|odp|fodp|ods|fods|odg|fodg|docx|docm|pptx|pptm|xlsx|xlsm|pdf|tar|tar.bz2|tar.gz|zip|mp3|mp2|mp1|mpa|ogg|oga|flac|torrent)"' + # they are all that are in --list + # might not be all the supported files + diff --git a/Completion/Linux/Command/_mat2 b/Completion/Linux/Command/_mat2 new file mode 100644 index 000000000..98dd1d05b --- /dev/null +++ b/Completion/Linux/Command/_mat2 @@ -0,0 +1,19 @@ +#compdef mat2 + +# Completion for mat2 0.11.0 (https://0xacab.org/jvoisin/mat2). + +local curcontext="$curcontext" state line +typeset -A opt_args +_arguments \ + '(- *)'{-h,--help}'[show help message and exit]' \ + '(-V --verbose)'{-V,--verbose}'[show more verbose status information]' \ + --unknown-members'[policy how to handle unknown members of archive-style files]:policy:(abort omit keep)' \ + --inplace'[clean in place, without backup]' \ + --no-sandbox"[disable bubblewrap's sandboxing]" \ + '(- *)'{-v,--version}"[show program's version number and exit]" \ + '(- *)'{-l,--list}'[list all supported fileformats]' \ + '(- *)'--check-dependencies'[check if mat2 has all the dependencies it needs]' \ + '(-L --lightweight -s --show)'{-L,--lightweight}'[remove SOME metadata]' \ + '(-s --show -L --lightweight)'{-s,--show}'[list harmful metadata detectable by mat2 without removing them]' \ + '*:file:_files -g "*.(epub|pdf|odc|odf|odg|odi|odp|ods|odt|pptx|xlsx|docx|torrent|ncx|tar|xhtml|xhtm|xht|zip|mp3|mpga|mp1|mp2|oga|opus|ogg|spx|flac|wav|gif|jpg|jpe|jfif|jpeg|png|svgz|svg|tiff|tif|bmp|ppm|css|htm|html|cxx|text|log|txt|hh|hxx|el|conf|cc|pm|f90|mpg4|m4v|mp4|wmv|avi)"' + diff --git a/Completion/Linux/Command/_mdadm b/Completion/Linux/Command/_mdadm index b6dce7ccb..5b73ef4be 100644 --- a/Completion/Linux/Command/_mdadm +++ b/Completion/Linux/Command/_mdadm @@ -156,7 +156,7 @@ _mds () { return 1 fi vals=( ${${${(M)${(f)"$(< $mdadm_conf)"}##ARRAY *}//ARRAY /}%%[[:blank:]]*} ) - _describe -t mds "RAID devices" vals + _describe -t mds "RAID device" vals _arguments \ "(-h --help)"{-h,--help}'[display a mode specific help message]' } diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils index ff6844f41..3e46130a2 100644 --- a/Completion/Linux/Command/_modutils +++ b/Completion/Linux/Command/_modutils @@ -12,7 +12,19 @@ _modules_caching_policy() _modutils() { local curcontext="$curcontext" expl state line modules modaliases ign args ret=1 local -A opt_args - local -r modules_dir=/lib/modules + local -a possible_modules_dirs=( + # Mostly every other distro + /lib/modules + # NixOS & possibly Guix + /run/booted-system/kernel-modules/lib/modules + ) + local modules_dir tested_modules_dir + for tested_modules_dir in "${possible_modules_dirs[@]}"; do + if [[ -d "$tested_modules_dir" ]]; then + modules_dir="$tested_modules_dir" + break + fi + done local update_policy zstyle -s ":completion:*:*:$service:*" cache-policy update_policy @@ -93,8 +105,10 @@ _modutils() { loaded-modules|loadable-modules) if [[ -r /proc/modules ]]; then loaded_modules=(${${(f)"$(</proc/modules)"}%% *}) + # For compatibility with old systems. Kernels nowadays provide + # `/proc/modules` which is more reliable and faster for us. elif [[ -x /sbin/lsmod ]]; then - loaded_modules=(${${(f)"$(/sbin/lsmod)"}[2,-1]%% *}) + loaded_modules=(${${(f)"$(_call_program loaded-modules /sbin/lsmod)"}[2,-1]%% *}) else return 1 fi @@ -106,8 +120,11 @@ _modutils() { ;& all-modules) - local kver=${opt_args[(i)(-S|-k|--set-version)]:-$(uname -r)} + local kver=${(v)opt_args[(i)(-S|-k|--set-version)]:-$(uname -r)} + if [[ -z "$modules_dir" ]]; then + return + fi if _cache_invalid modules-$kver || ! _retrieve_cache modules-$kver; then modules=( $modules_dir/$kver/(*~(source|build))/**/*.(o|ko|ko.gz|ko.xz)(.:t:r:r) ) @@ -115,7 +132,7 @@ _modutils() { _store_cache modules-$kver modules modaliases fi - if (( ${+opt_args[(k)(-R|--resolve-alias)]} )); then + if [[ -v opt_args[(i)(-R|--resolve-alias)] ]]; then _tags module-aliases else _tags files modules module-aliases @@ -137,7 +154,7 @@ _modutils() { _message -e value 'parameter value' else local params - params=( ${${(M)${(f)"$(_call_program module-parameters /sbin/modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) + params=( ${${(M)${(f)"$(_call_program module-parameters modinfo "$words[2]" 2>/dev/null)"}:#parm:*}##parm:[[:space:]]##} ) compset -S '=*' if (( $#params )); then _values -S = -w 'module parameter' \ diff --git a/Completion/Linux/Command/_networkmanager b/Completion/Linux/Command/_networkmanager index c9b09d145..1e05252b2 100644 --- a/Completion/Linux/Command/_networkmanager +++ b/Completion/Linux/Command/_networkmanager @@ -244,7 +244,7 @@ _nm_device_wifi() { local curcontext="$curcontext" state line _arguments -C \ - "1:command:(list connect hotspot rescan)" \ + "1:command:(list connect hotspot rescan show-password)" \ "*::arg:->args" case $line[1] in @@ -252,6 +252,7 @@ _nm_device_wifi() { c*) _nm_device_wifi_connect ;; ho*) _nm_device_wifi_hotspot ;; r*) _nm_device_wifi_rescan ;; + s*) _nm_device_wifi_show-password ;; esac } @@ -362,6 +363,12 @@ _nm_device_wifi_rescan() { "4:ssid:_nm_device_wifi_ssids" } +_nm_device_wifi_show-password() { + _arguments \ + "1: :(ifname)" \ + "2:interface:_nm_device_ifnames" +} + _nm_device_wifi_bssids() { local -a bssids bssids=(${(f)"$(_call_program nmcli nmcli -t -f bssid device wifi list)"}) diff --git a/Completion/Linux/Command/_nsenter b/Completion/Linux/Command/_nsenter new file mode 100644 index 000000000..8e7c6bc42 --- /dev/null +++ b/Completion/Linux/Command/_nsenter @@ -0,0 +1,28 @@ +#compdef nsenter + +local ign +(( $#words > 2 )) && ign='!' + +_arguments -S -s \ + '(-a --all)'{-a,--all}'[enter all namespaces]' \ + '(-t --target)'{-t+,--target=}'[specify target process to get namespaces from]:pid:_pids' \ + '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \ + '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \ + '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \ + '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \ + '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \ + '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \ + '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \ + '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \ + '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \ + '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \ + "--preserve-credentials[don't touch uids or gids]" \ + '(-r --root)'{-r+,--root=}'[set the root directory]:directory:_directories' \ + '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \ + '(-F --no-fork)'{-F,--no-fork}"[don't fork]" \ + '(-Z --follow-context)'{-Z,--follow-context}'[set SELinux context according to --target PID]' \ + "${ign}(- 1 *)"{-h,--help}'[display usage information]' \ + "${ign}(- 1 *)"{-V,--version}'[display version information]' \ + '1: : _command_names -e' \ + '*::args :_normal' + diff --git a/Completion/Linux/Command/_perf b/Completion/Linux/Command/_perf new file mode 100644 index 000000000..dd9621606 --- /dev/null +++ b/Completion/Linux/Command/_perf @@ -0,0 +1,809 @@ +#compdef perf + +local curcontext="$curcontext" curstate state line expl nm="$compstate[nmatches]" +local -a args opts cmd fields sortkeys +local -A exclude full short +local -i i skip + +exclude=( + --add \* --cgroup \* --definition \* --del \* + --detailed \* --dlarg \* --dsos \* --event \* --events \* + --fields \* --funcs \* --node-info \* --symbols \* --vars \* + --gtk '(--stdio --stdio2 --tui)' + --tui '(--gtk --stdio --stdio2)' + --stdio '(--gtk --tui --stdio2)' + --stdio2 '(--gtk --tui --stdio)' + --log-fd '(--output)' + --output '(--log-fd)' + --tracer '(-G --graph-funcs -g --nograph-funcs -F --funcs)' + --graph-funcs '(-g --nograph-funcs -N --notrace-funcs -T --trace-funcs -t --tracer)*' + --nograph-funcs '(-G --graph-funcs -N --notrace-funcs -T --trace-funcs -t --tracer)*' + --trace-funcs '(-N --notrace-funcs -G --graph-funcs -g --nograph-funcs -t --tracer)*' + --notrace-funcs '(-T --trace-funcs -G --graph-funcs -g --nograph-funcs -t --tracer)*' + --source '!(--no-source)' +) + +full=( + --addr-range '=[list traced records within address range]:range' + --affinity '=[set affinity mask of trace reading thread]:affinity:(node cpu)' + --aio '=[specify number of control blocks in asynchronous trace writing mode]:control blocks (1-4) [1]' + --all-cgroups '[record cgroup events]' + --all-cpus '[system-wide collection from all CPUs]' + --asm-raw '[show raw instruction encoding of assembly instructions]' + --aux-sample '=[sample AUX area]::options' + --baseline-only '[show only items with match in baseline]' + --branch-any '[sample any taken branches]' + --branch-filter '=[enable taken branch stack sampling]:mask' + --branch-stack '[use branch records for per branch histogram filling]' + --buffer-size '=[size of per-cpu buffer]: :_numbers size B K M G' + --build-ids '[inject build-ids into the output stream]' + --buildid-all '[handle build-id of all DSOs]' + --call-graph '=[enable call-graph (stacktrace) recording]:(fp dwarf)' + --cgroup '=[monitor event in named cgroup only]:cgroup' + --children '[accumulate callchains of children and show total overhead]' + --clang-opt '=:clang option' + --clang-path '=:clang binary:_command_names -e' + --clockid '=[specify clockid to use for events]:clock id' + --coalesce '=:coalesce field:_sequence compadd - pid tid iaddr dso' + --color-cpus '=[highlight given CPUs in map]:cpus' + --color-pids '=[highlight given pids in map]: :_sequence _pids' + --column-widths '=[use fixed column widths]:widths (comma-separated)' + --comms '=[restrict to specified comms]:comms' + --compression-level '=[produce compressed trace using specified level]:level (1-22) [1]' + --compute '=[set comparison method]:comparison method [delta-abs]:(delta delta-abs ratio wdiff)' + --control '=[listen on ctl-fd descriptor for command to control measurement]:descriptor' + --count '=[specify event period]:period' + --count-filter '=[only display functions with more than given number of events]:minimum number of events' + --cpu '=[restrict to specified CPUs]:cpus' + --cpus '=[restrict to specified CPUs]:cpus' + --cycles-hist '[show cycles histogram and standard deviation]' + --data '[record the sample addresses]' + --data-page-size '[record the sampled data address data page size]' + --definition '=[show trace-event definition converted from given probe-event]:event' + --delay '=[specify delay before starting measurement after program start]:delay (ms)' + --demangle '[demangle symbols]' + --demangle-kernel '[demangle kernel symbols]' + --detailed '[detailed run - start a lot of events]' + --disassembler-style '=[specify disassembler style]:style' + --dlarg '=:dlfilter argument' + --dlfilter '=[filter sample events using the given shared object]:file:_files -g "*.so(-.)"' + --dry-run '[parse options then exit]' + --dsos '=[only consider symbols in these dsos]:dso' + --dump-raw-trace '[dump raw trace in ASCII]' + --dump-symtab '[dump the symbol table used for profiling]' + --duration '=[show only events with duration over threshold]:minimum duration (ms)' + --entries '=[specify how many functions to display]:number of functions' + --event '=[select the PMU event]:event:->events' + --exclude-other '[only display entries with parent-match]' + --exclude-perf "[don't record events from perf itself]" + --exec '=[specify path to executable or shared library]:file:_files' + --expr '=[specify syscalls/events to trace]:syscall or event' + --field-separator '=[specify field separator]:separator' + --fields '=[specify output field]:field:->fields' + --filter '=[event filter]:filter' + --filter-pids '=[specify pids to filter]: :_sequence _pids' + --for-each-cgroup '=[expand events for each cgroup]:cgroup' + --force "[don't complain, do it]" + --format '=[specify output formatting style]:style:(default simple)' + --formula '[show formula]' + --freq '=[specify profile frequency]:frequency (Hz)' + --func-opts '=[specify function tracer options]:option:_sequence compadd - call-graph irq-info' + --funcs '=[show available functions]::filter' + --graph-funcs '=[select function_graph tracer and trace given functions]:function' + --graph-function '=[only print symbols and callees with --call-trace/--call-ret-trace]:symbol list' + --graph-opts '=[specify graph tracer options]: : _values -s , option nosleep-time noirqs verbose thresh\:duration depth\:depth' + --group '=[show event group information together]' + --group-sort-idx '=[sort output by specified event in group]:event index' + --gtk '[use the graphical interface]' + --guestkallsyms '=[provide copy of guest os /proc/kallsyms]:file:_files' + --guestmodules '=[provide copy of guest os /proc/modules]:file:_files' + --guestmount '=[specify guest os root file system mount directory]:path:_directories' + --guestvmlinux '=[provide guest os kernel]:kernel file:_files' + --hide_kernel_symbols '[hide kernel symbols]' + --hide_user_symbols '[hide user symbols]' + --hide-unresolved '[only display entries resolved to a symbol]' + --hierarchy '[show entries in a hierarchy]' + --ignore-callees '=[ignore callees of specified functions in call graphs]:functions (regex)' + --ignore-vmlinux '[ignore vmlinux files]' + --inherit '[trace child processes]' + --input '=[specify input file]:file:_files' + --interval-count '=[print counts for fixed number of times]:times' + --interval-print '=[print counts at regular interval]:interval (ms)' + --intr-regs '=[sample selected machine registers on interrupt]:register' + --inverted '[alias for inverted call graph]' + --iostat '=::default' + --itrace '=[specify instruction tracing options]:option:->itrace-opts' + --jit '[merge jitdump files into perf.data file]' + --kallsyms '=[specify kallsyms pathname]:path:_files' + --kcore '=[add specified kcore file to the cache]:file:_files' + --kernel '[show running kernel build id]' + --Latency '[show latency attributes (irqs/preemption disabled, etc)]' + --list '[list all cached files]' + --list-opts '[list available options]' + --log-fd '=[log output to file descriptor instead of stderr]:file descriptor:_file_descriptors' + --map-dump '=[specify BPF map to periodically dump]:BPF map' + --max-blocks '=[set maximum number of code blocks to dump with brstackinsn]:blocks' + --max-events '=[set maximum number of events to print]:events' + --max-size '=[limit the maximum size of the output file]: :_numbers size B K M G' + --max-stack '=[set maximum stack depth when parsing the callchain]:depth [kernel.perf_event_max_stack or 127]' + --metrics '=[monitor specified metrics or metric groups]:metric' + --min-stack '=[set minimum stack depth when parsing the callchain]:depth' + --mmap-flush '=[specify minimum size that is extracted from mmap data pages]: :_numbers -d 1 -u bytes size B K M G' + --mmap-pages '=[specify number of mmap data pages]:number of pages' + --modules '[load module symbols]' + --namespaces '[record namespaces events]' + --no-bpf-event "[don't record bpf events]" + --no-buildid "[don't collect buildids in perf.data]" + --no-buildid-cache "[don't update the buildid cache]" + --no-inherit "[child tasks don't inherit counters]" + --no-samples "[don't sample]" + --node-info '[show extra node info in report]' + --nograph-funcs "=[select function_graph tracer and don't trace given functions]:function" + --notrace-funcs "=[select function tracer and don't trace given functions]:function filter" + --null "[null run - don't start any counters]" + --num-thread-synthesize '=[specify number of threads to run for event synthesis]:threads' + --objdump '=[specify objdump binary to use for disassembly and annotations]:path:_command_names -e' + --order '=[specify compute sorting]:ordering [1]:(( + 0\:baseline\ overhead + 1\:computed\ value\ of\ column\ 1))' + --output '=[specify output file]:file:_files' + --parent '=[filter by parent caller]:parent (regex)' + --percent-limit "=[don't show entries under specified percentage]:percent" + --percent-type '=[set annotation percent type]:compadd {local,global}{period,hits}' + --percentage '=[set display of filtered entries percentages]:display:(relative absolute)' + --phys-data '[record/report sample physical addresses]' + --pid '=[restrict to specified process id]:process: _sequence _pids' + --post '=[specify command to run after to the measured command]: :_cmdstring' + --pre '=[specify command to run prior to the measured command]: :_cmdstring' + --prefix '=[add prefix to source file path names]:prefix:_directories' + --prefix-strip '=[strip elements from source file path names]:elements' + --pretty '=[specify pretty printing style]:key:(normal raw)' + --proc-map-timeout '=[specify per-thread proc mmap processing timeout]:timeout (ms)' + --quiet "[don't print any messages]" + --raw-samples '[collect raw sample records from all opened counters]' + --raw-trace '[show raw trace event output]' + --realtime '=[profile --addevents with specified priority]:RT SCHED_FIFO priority' + --repeat '=[specify amount of times to repeat the run]:repetitions' + --samples '=[specify number of samples to save per histogram entry for individual browsing]:samples' + --sched-stat '[get details of how long tasks slept]' + --show-cpu-utilization '[show sample percentage for different cpu modes]' + --show-info '[display extended perf.data information]' + --show-nr-samples '[show a column with the number of samples]' + --show-on-off-events '[show the --switch-on/off events too]' + --show-round-events '[display finished round events]' + --show-switch-events '[display context switch events]' + --show-total-period '[show a column with the sum of periods]' + --skip-missing '--skip-missing[skip symbols that cannot be annotated]' + --snapshot '=[select AUX area tracing snapshot mode]::snapshot capturing parameter' + --socket-filter '=[only show processor socket that match specified filter]:filter' + --sort '=[sort by specified keys]:key:->sort-keys' + --stat '[per-thread counts]' + --stdio '[use the stdio interface]' + --stdio-color '=[specify when to use colors in output]:mode [always]:(always never auto)' + --stdio2 '[use the stdio2 interface, non-interactive, TUI formatting]' + --stitch-lbr '[enable LBR callgraph stitching approach]' + --stop-bt '=[stop display of callgraph at these symbols]:symbol list' + --stream '[enable hot streams comparison]' + --strip '[strip non-synthesized events]' + --summary '[show only syscall summary with statistics]' + --switch-max-files '=[limit number of generated files to keep]:limit' + --switch-off '=[stop considering events after occurrence of specified event]:event' + --switch-on '=[consider events after occurrence of specified event]:event' + --switch-output '=[specify when to rotate output file]::signal or size [USR2]:_signals' + --switch-output-event '=[switch output event selector]:event:->events' + --sym-annotate '=[specify symbol to annotate]:symbol' + --symbol '=[specify symbol]:symbol' + --symbol-filter '=[only show symbols that match filter]:filter' + --symbols '=[only consider specified symbols]:symbol' + --symfs '=[look symbol files relative to specified directory]:directory:_directories' + --sync '[call sync() before starting a run]' + --system '[read and write system config file]' + --target-ns '=[obtain mount namespace information form the target pid]:pid:_processes' + --td-level '=[set the metrics level for the top-down statistics]:level' + --tid '=[restrict to specified threads]:tids' + --time '=[specify time span of interest]:time span (start,stop)' + --time-quantum '=[set time quantum for time sort key]: :_numbers -d 100ms "time quantum" ms us ns s' + --timeout '=[stop workload and print counts after a timeout period]:timeout (ms)' + --timestamp-filename '[append timestamp to output file name]' + --trace-fields '[show tracepoint fields]' + --trace-funcs '=[select function tracer and set function filter]:function filter' + --tracer '=[specify tracer to use]:tracer:(function_graph function)' + --tui '[use the curses interface]' + --uid '=[profile events in threads owned by uid]:uid:_users' + --user '[read and write user config file]' + --user-regs '=[sample selected machine registers on interrupt]:registers' + --vars '=[show available local variables at given probe point]:probe' + --vcpu '=[specify vcpu id to report]:vcpu' + --verbose '[be more verbose]' + --vm-time-correlation '=[correlate time between VM guests and the host]::options' + --vmlinux '=[specify vmlinux path]:vmlinux pathname:_files' + --weight '[sample by weight (on special events only)]' + --with-hits '[show only DSOs with hits]' + --with-summary '[show all syscalls and summary with statistics]' + --zero '[zero history across updates]' +) +short=( + --add -a + --all-cpus -a + --baseline-only -b + --branch-any -b + --build-ids -b + --cpu -C + --coalesce -c + --compute -c + --count -c + --delay -D + --dump-raw-trace -D + --data -d + --dsos -d + --event -e + --fields -F + --formula -F + --freq -F + --funcs -F + --force -f + --cgroup -G + --graph-funcs -G + --with-hits -H + --intr-regs -I + --show-info -I + --input -i + --no-inherit -i + --branch-filter -j + --jit -j + --clockid -k + --key -k + --vmlinux -k + --list -l + --disassembler-style -M + --buffer-size -m + --mmap-pages -m + --modules -m + --node-info -N + --no-buildid-cache -N + --no-samples -n + --show-nr-samples -n + --order -o + --output -o + --pid -p + --quiet -q + --raw-samples -R + --realtime -r + --repeat -r + --snapshot -S + --symbols -S + --with-summary -S + --sched-stat -s + --script -s + --sort -s + --summary -s + --timestamp -T + --tid -t + --tracer -t + --uid -u + --verbose -v + --weight -W + --column-widths -w + --field-separator -x + --compression-level -z + --zero -z +) + +cmd=( $words[1] ) +(( $#words > 2 )) && ign='!' + +_arguments -C -A "-*" \ + "${ign}(- *)"{-v,--version}'[display version information]' \ + "${ign}(- *)"{-h,--help}'[display usage information]' \ + "${ign}(- *)-vv[print the compiled-in status of libraries]" \ + '(- *)--exec-path[display or set exec path]' \ + '(- *)--html-path[display html documentation path]' \ + "${ign}(- *)--list-opts[list available options]" \ + "${ign}(- *)--list-cmds[list available subcommands]" \ + '!(-p --paginate --no-pager)'{-p,--paginate} \ + --no-pager \ + '--buildid-dir=[setup buildid cache directory]: :_directories' \ + '--debugfs-dir=[set debugfs directory]: :_directories' \ + '--debug=[setup debug variable]: : _values -s, "debug option" + verbose\:level ordered-events data-convert stderr perf-event-open' \ + '1: :->subcmds' \ + '*:: :->args' + +while (( $#state )); do + curstate=$state + shift state + case $curstate in + subcmds) + subcmds=( + ${${${(f)"$(_call_program subcmds $cmd)"}[3,-2]## ##}/ ##(#m)?/:$MATCH[-1]:l} + 'help:display help information about perf' + ) + _describe 'subcommand' subcmds + ;; + subsubcmds) + _description commands expl command + compadd "$expl[@]" -a subcmds + ;; + args) + (( $#words < 3 )) && ign='' + cmd+=( $words[1] ) + curcontext="${curcontext%:*:*}:${(j.-.)cmd}:" + args=() + skip=0 + case ${(j.-.)cmd[2,-1]} in + kvm-*|top|stat) + full[--group]='[put the counters into a counter group]' + ;| + bench-[^-]##(|-all)) skip=1 opts=() subcmds=() ;| + + annotate) + full+=( + --full-paths "[don't shorten the displayed pathnames]" + --print-line "[print matching source lines (may be slow)]" + ) + short+=( + --print-line -l + --full-paths -P + --symbol -s + ) + args+=( + "--no-source[don't interleave source code with assembly code]" + '1:: :_guard "^-*" "symbol name"' + ) + ;; + + archive) + _arguments --help '1:file:_files' + break + ;; + + bench) + short+=( + --edge -E + --format -f + --nfds -f + --group -g + --iterations -i + --loop -l + --nr_loops -l + --nr-mmaps -m + --multiq -m + --nested -N + --noaffinity -n + --nonblocking -B + --nr-samples -n + --pipe -p + --randomize -R + -fruntime -r + --size -s + --thread -t + --threaded -T + ) + args=( + '1:subsystem:(sched syscall mem numa futex epoll internals all)' + '*:: :->args' + ) + full+=( + --group '=[specify number of groups]:groups' + --nr_loops '=[specify number of loops to run]:loops [100]' + --pipe '[use pipe() instead of socketpair()]' + --runtime '=[specify runtime]:runtime (seconds)' + --thread '[be multi thread instead of multi process]' + --threads '=[specify number of threads]:threads' + --loop '=[specify number of loops]:loops' + --iterations '=[number of iterations used to compute average]:iterarions' + --threaded '[specify threads/process based task setup]' + --size '=[specify size of memory buffers]: :_numbers -d 1MB size B KB MB GB TB' + ) + ;; + bench-sched) args=( '1:suite:(all messaging pipe)' '*:: :->args' ) ;; + bench-numa) args=( '1:suite:(all mem)' '*:: :->args' ) ;; + bench-mem) args=( '1:suite:(all memcpy memset find_bit)' '*:: :->args' ) ;; + bench-futex) + args=( '1:suite:(all hash wake wake-parallel requeue lock-pi)' '*:: :->args' ) + ;; + bench-epoll) args=( '1:suite:(all wait ctl)' '*:: :->args' ) ;; + bench-internals) args=( '1:suite:(all synthesize kallsyms-parse inject-build-id)' '*:: :->args' ) ;; + bench-syscall) args=( '1:suite:(all basic)' '*:: :->args' ) ;; + + buildid-cache) + full+=( + --add '=[add specified file to the cache]:file:_files' + --debuginfod '=[specify debuginfod URL to be used when retrieving perf.data binaries]:url:_urls' + --missing '=[list missing build ids in the cache for the specified]:file:_files' + --purge '=[purge all cached binaries including older caches which have specified path from the cache]:path:_files' + --purge-all '[purge all cached binaries - flush out entire cache]' + --remove '=[remove a cached binary which has same build-id of specified file from the cache]:file:_files' + --update '=[update specified file of the cache]:file:_files' + ) + short+=( + --kcore -k + --missing -M + --purge -p + --purge-all -P + --remove -r + --update -u + ) + ;; + c2c) + args+=( '1:commands:(record report)' '*:: :->args' ) + ;; + daemon) + full+=( + --base '=[specify base directory]:base directory:_directories' + --config '=[specify config file path]:config file:_files' + --foreground "[don't put process in background]" + --session '=[apply to specific session]:session' + ) + short[--foreground]=-f + args=( '1:action:(start stop signal ping)' '*:: :->args' ) + ;; + (kvm-|)buildid-list) + short[--kernel]=-k + ;; + config) + full[--list]='[show current config variables]' + ;; + data) + full+=( + --all '[convert all events]' + --to-json '=[convert to JSON format]:output file:_files' + --to-ctf '=[convert to CTF format]:output file:_files' + --tod '[convert time to wall clock time]' + ) + exclude+=( + --to-ctf '(--to-json)' + --to-json '(--to-ctf)' + ) + ;; + (kvm-|)diff) + short+=( + --baseline-only -b + --compute -c + --comms -C + --field-separator -t + --formula -F + --order -o + --period -p + ) + full+=( + --period '[show period values]' + ) + unset 'short[--pid]' + unset 'short[--tid]' + sortkeys=( pid comm dso symbol cpu parent srcline ) + ;; + evlist) + short+=( --group -g ) + ;; + ftrace) + short+=( + --nograph-funcs -g + --graph-funcs -G + --buffer-size -m + --notrace-funcs -N + --trace-funcs -T + --tracer -t + ) + unset 'short[--tid]' + ;; + help*) + short+=( -a --all -i --info -m --man -w --web ) + ;; + inject) + short+=( --jit -j --build-ids -b --sched-stat -s ) + ;; + kmem) + full+=( + --alloc '[show per-allocation statistics]' + --caller '[show per-callsite statistics]' + --raw-ip '[show raw ip instead of symbol]' + --line '=[show specified number of lines]:lines' + --live '[show live page stat]' + --slab '[analyze SLAB allocator events]' + --page '[analyze page allocator events]' + ) + short[--line]=-l + sortkeys=( + ptr callsite bytes hit pingpong frag + page order migtype gfp + ) + ;; + list) + short+=( --desc -d --long-desc -v ) + full+=( + --desc '[print extra event descriptions]' + --details '[print information on the perf event names and expressions used internally by events]' + --long-desc '[print longer event descriptions]' + ) + args=( '*::events:->event-types' ) + ;; + lock-info) + short[--map]=-m + short[--threads]=-t + full+=( + --map '[dump map of lock instances (address:name table)]' + --threads '[dump thread list in perf.data]' + ) + ;; + lock-report) + full[--key]='=[specify sort key]:key [acquired]:(acquired contended avg_wait wait_total wait_max wait_min)' + ;; + mem) + short[--phys-data]=-p + short[--type]=-t + short[--dump-raw-samples]=-D + full[--type]='=[select the memory operation type]:type:(load store)' + full[--dump-raw-samples]='[dump raw samples in ASCII]' + ;; + probe) + full+=( + --add '=[probe point definition]:probe' + --del '=[delete a probe event]:probe event' + --filter '=[set a filter]:filter' + --line '[show source code lines which can be probed]' + --max-probes '=[set how many probe points can be found for a probe]:probes' + --module '=[specify target module name or path]:module name or path:_directories' + --range '[show variables location range in scope]' + --source '=[specify path to kernel source]:path:_directories' + ) + short+=( + --definition -D + --del -d + --exec -x + --line -L + --module -m + --dry-run -n + --source -s + --vars -V + ) + unset 'exclude[--source]' + unset 'short[--list]' + ;; + timechart-record) + short+=( --io-only -I --callchain -g ) + full+=( + --callchain '[record callchain]' + --io-only '[record only IO data]' + ) + ;; + *record) + short+=( + --data -d + --clockid -k + --no-samples -n + --no-buildid -B + --no-buildid-cache -N + --period -P + --stat -s + ) + full+=( + --overwrite '[use overwrite mode]' + --period '[record the sample period]' + --timestamp '[record the sample timestamps]' + --transaction '[sample transaction flags (special events only)]' + ) + ;; + (c2c-|kvm-|)report) + short+=( + --branch-stack -b + --comms -c + --inverted -G + --call-graph -g + --parent -p + --threads -T + --field-separator -t + --exclude-other -x + ) + full+=( + --threads '[show per-thread event counters]' + ) + unset 'short[--pid]' + unset 'short[--tid]' + sortkeys=( + pid comm dso symbol parent cpu socket srcline weight local_weight cgroup_id + ) + fields=( + overhead period sample overhead overhead_sys overhead_us + overhead_guest_sys overhead_guest_us overhead_children + sample period pid comm dso symbol parent cpu socket + srcline srcfile local_weight weight transaction trace + symbol_size dso_size cgroup cgroup_id ipc_null time + code_page_size local_ins_lat ins_lat p_stage_cyc dso_from + dso_to symbol_from symbol_to mispredict abort in_tx + cycles srcline_from srcline_to ipc_lbr symbol_daddr + dso_daddr locked tlb mem snoop dcacheline symbol_iaddr + phys_daddr data_page_size blocked + ) + ;; + sched-latency) + short+=( + --CPU -C + --pids -p + ) + full+=( + --pids '[latency stats per pid instead of per comm]' + --CPU '=[specify CPU to profile on]:cpu' + ) + ;; + sched-timehist) + short+=( + --idle-hist -I + --migrations -M + --next -n + --cpu-visual -V + --wakeups -w + ) + full+=( + --cpu-visual '[add CPU visual]' + --idle-hist '[show idle events only]' + --migrations '[show migration events]' + --next '[show next task]' + --state '[show task state when sched-out]' + --wakeups '[show wakeup events]' + ) + ;; + (*-|)script) + short+=( --comms -c --gen-script -g --Latency -L --debug-mode -d ) + full+=( + --debug-mode '[do various checks like samples ordering and lost events]' + --gen-script '=[generate perf-script.xx script in specified language]:language' + --script '=[specify script file name]:script file name:_files' + ) + unset 'short[--pid]' + unset 'short[--dsos]' + unset 'short[--tid]' + fields=( + comm tid pid time cpu event trace ip sym dso addr symoff + srcline period iregs uregs brstack brstacksym flags + bpf-output brstackinsn brstackoff callindent insn insnlen + synth phys_addr metric misc ipc tod data_page_size + code_page_size + ) + ;; + *stat*) + full+=( + --big-num "[print large numbers with thousands' separators]" + --delay '=[wait after starting program]:delay (msecs)' + --key '=[specify key for sorting]:key:(sample time)' + --no-aggr '[disable CPU count aggregation]' + --transaction '[hardware transaction statistics]' + ) + short+=( + --no-aggr -A + --big-num -B + --detailed -d + --group -g + --interval-print -I + --metrics -M + --null -n + --sync -S + --transaction -T + ) + exclude+=( + --log-fd '(-o --output)' + --output '(--log-fd)' + ) + unset 'short[--quiet]' + ;; + test*) + short+=( --dont-fork -F --skip -s ) + full+=( + --dont-fork "[don't fork for testcase]" + --skip '=[specify tests to skip]:test' + ) + ;; + timechart) + short+=( --width -w --topology -t --proc-num -n --process -p ) + full+=( + --highlight '=[highlight tasks that outlast duration or with given name]:duration or name' + --io-skip-eagain "[don't draw EAGAIN IO events]" + --io-min-time '=[all IO faster than minimum time will visually appear longer]: :_numbers -u ns -d 1ms time ms us' + --io-merge-dist '=[merge events that are within specified time]: :_numbers -u ns -d 1us time ms us' + --process '=[select process]:process:_pids' + --proc-num '=[specify minimum number of tasks to print]:tasks' + --topology '[sort CPUs according to topology]' + --width '=[specify page width]:page width' + ) + ;; + (kvm-|)top) + full+=( + --delay '=[specify delay between refreshes]:delay (seconds)' + --comms '=[only consider symbols in specified comms]:comm' + --dsos '=[only consider symbols in these dsos]:dso' + --overwrite '[use a backward ring buffer]' + ) + short+=( + --count-filter -f + --delay -d + --dump-symtab -D + --entries -E + ) + unset 'short[--dsos]' + unset 'short[--fields]' + unset 'short[--force]' + unset 'short[--symbols]' + sortkeys=( + pid comm dso symbol parent srcline weight local_weight + abort in_tx transaction overhead sample period + ) + fields=( overhead period sample $sortkeys ) + ;; + trace) + short+=( + --pf -F + --summary -s + --time -T + ) + full+=( + --pf '=[trace pagefaults]::type [maj]:(all min maj)' + --time '[show full timestamp, not relative]' + ) + unset 'short[--no-inherit]' + ;; + esac + if (( !skip )); then + subcmds=( $(_call_program commands "$cmd --list-cmds|grep -v -e '^#' -e Unknown") ) + opts=( $(_call_program options "$cmd --list-opts|grep -v -e '^#' -e Unknown") ) + fi + + for (( i = $#opts; i; i-- )); do + opts[i]=( + ${exclude[$opts[i]]}${opts[i]}${full[$opts[i]]} + ${short[$opts[i]]:+${exclude[$opts[i]]}${short[$opts[i]]}${full[$opts[i]]/(#s)=/+}} + ) + done + (( $#subcmds)) && opts+=( + "${ign}(- *)--list-cmds[list available subcommands]" \ + '1: :->subsubcmds' + '*:: :->args' + ) + (( $#opts )) && opts+=( + "${ign}(- *)--help[display help information]" + "${ign}(- *)--list-opts[list available options]" + ) + _arguments -C $opts $args \ + "${ign}(- *)-h[display brief usage summary]" + ;; + event-types) + _wanted event-types expl 'event type' compadd - hw sw cache pmu tracepoint event_glob + ;& + events) + _wanted events expl event compadd - \ + ${${=${${(f)"$(_call_program events perf list hw sw cache pmu tracepoint event_glob)"}[2,-5]# }%% [ \[]*}:#OR} + ;; + itrace-opts) + _values -s '' "itrace option [ibxwpe]" \ + 'i[synthesize instructions events]' \ + 'b[synthesize branches events (branch misses for Arm SPE)]' \ + 'c[synthesize branches events (calls only)]' \ + 'r[synthesize branches events (returns only)]' \ + 'x[synthesize transactions events]' \ + 'w[synthesize ptwrite events]' \ + 'p[synthesize power events (incl. PSB events for Intel PT)]' \ + 'o[synthesize other events recorded due to the use of aux-output]' \ + 'e[synthesize error events]' \ + 'd[create a debug log]' \ + 'f[synthesize first level cache events]' \ + 'm[synthesize last level cache events]' \ + 'M[synthesize memory events]' \ + 't[synthesize TLB events]' \ + 'a[synthesize remote access events]' \ + 'g[synthesize a call chain (use with i or x)]' \ + 'G[synthesize a call chain on existing event records]' \ + 'l[synthesize last branch entries (use with i or x)]' \ + 'L[synthesize last branch entries on existing event records]' \ + 's[skip initial number of events]' \ + 'q[quicker (less detailed) decoding]' \ + 'Z[prefer to ignore timestamps (so-called "timeless" decoding)]' + ;; + fields) + _sequence _wanted fields expl 'field' compadd - -a fields + ;; + sort-keys) + _sequence _wanted sort-keys expl 'sort key' compadd - -a sortkeys + ;; + esac +done + +[[ nm -ne compstate[nmatches] ]] diff --git a/Completion/Linux/Command/_pidof b/Completion/Linux/Command/_pidof index 05fb23d45..dd0649ce9 100644 --- a/Completion/Linux/Command/_pidof +++ b/Completion/Linux/Command/_pidof @@ -9,6 +9,8 @@ _arguments -C -s -w \ '(- *)'{-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]' \ + '-q[quiet mode, only set the exit code]' \ + '(-w --with-workers)'{-w,--with-workers}'[show kernel workers too]' \ "(-x $exargs)"-x'[include shells running named scripts]' \ "($exargs)"\*{-o+,--omit-pid=}'[omit processes with PIDs]:pids:_sequence -s , _pids' \ '(-S --separator)'{-S+,--separator=}'[specify separator put between PIDs]:separator' \ diff --git a/Completion/Linux/Command/_setpriv b/Completion/Linux/Command/_setpriv new file mode 100644 index 000000000..196f2f627 --- /dev/null +++ b/Completion/Linux/Command/_setpriv @@ -0,0 +1,107 @@ +#compdef setpriv + +__setpriv_prctl_securebits_set_elements() { + local -a expl + local -a bits + + bits=( + noroot noroot_locked + no_setuid_fixup no_setuid_fixup_locked + keep_caps_locked + ) + + if ! compset -P '[+-]'; then + _description minus-or-plus expl "-/+" + compadd "${(@)expl}" -qS '' {+,-} + return + fi + + _description minus-plus-securebits expl "prctl securebit" + compadd "${(@)expl}" "$@" -a - bits +} + +__setpriv_numbered_caps() { + # The cap_ prefix. + # We override the suffix from _sequence with -S '' to stay adjacent + # to the following number. + if ! compset -P cap_; then + compadd -S '' "$@" -n - cap_ + return + fi + # A capability number; i.e. a non-negative integer. + # We can't complete integers, so no matches. + if ! compset -P '[0-9]##'; then + local -a expl + _description -x numbers expl "capability number" + compadd -S '' "${(@)expl}" -n - + return + fi + # The numbered cap expression is complete. + compadd "$@" -n - '' +} + +__setpriv_cap_set_elements() { + # '-' or '+', followed by one of the following: + # - a capability name + # - the word 'all' + # - 'cap_[0-9]+' (to specify unknown capabilities). + if ! compset -P '[+-]'; then + local -a expl + _description minus-or-plus expl "-/+" + compadd "${(@)expl}" -qS '' + - + return + fi + + # We pass through compadd options generated by _sequence. + local -a sequence_argv=( "$@" ) + + _alternative -O sequence_argv \ + 'special-words:drop/obtain all caps:(all)' \ + 'capabilities: :_capabilities' \ + 'numbered-capabilities:cap_N:__setpriv_numbered_caps' \ + # +} + +__setpriv_death_signals() { + _alternative \ + 'special-words:keep or clear:(keep clear)' \ + 'signals:UNIX signal:_signals' \ + # +} + +local curcontext="$curcontext" state state_descr line +typeset -A opt_args + +_arguments -C -S -s \ + '(- : *)'{-h,--help}'[print help and exit]' \ + '(- : *)'{-V,--version}'[print version information and exit]' \ + '(- : *)'{-d,--dump}'[display the current privilege state]:*: :->option-dump' \ + '(--groups --init-groups --keep-groups)--clear-groups[clear supplementary groups]' \ + '(--clear-groups --init-groups --keep-groups)--groups[set supplementary groups]: : _sequence _groups' \ + '(--clear-groups --groups --init-groups)--keep-groups[preserve supplementary groups]' \ + '(--clear-groups --groups --keep-groups)--init-groups[initialize supplementary groups]' \ + '--inh-caps[set inheritable caps]: : _sequence __setpriv_cap_set_elements' \ + '--ambient-caps[set ambient caps]: : _sequence __setpriv_cap_set_elements' \ + '--bounding-set[set the cap bounding set]: : _sequence __setpriv_cap_set_elements' \ + '(- : *)--list-caps[list all known capabilities]' \ + '--no-new-privs[set NO_NEW_PRIVS]' \ + '--rgid[set real UNIX group id]:UNIX group:_groups' \ + '--egid[set effective UNIX group id]:UNIX group:_groups' \ + '--regid[set real and effective UNIX group id]:UNIX group:_groups' \ + '--ruid[set real UNIX user id]:UNIX user:_users' \ + '--euid[set effective UNIX user id]:UNIX user:_users' \ + '--reuid[set real and effective UNIX user id]:UNIX user:_users' \ + '--securebits[set "process securebits"]: : _sequence __setpriv_prctl_securebits_set_elements' \ + '--pdeathsig[keep, clear, or set parent death signal]: : __setpriv_death_signals' \ + '--selinux-label[request a selinux label]:SELinux labels: ' \ + '--apparmor-profile[request an apparmor profile]:AppArmor profiles: ' \ + '--reset-env[set environment as for a classic login shell]' \ + '*:::command:_normal' \ + && return 0 + +case $state in + option-dump) + _arguments -S '*'{-d,--dump}'[display the current privilege state]' + ;; + *) ;; +esac diff --git a/Completion/Linux/Command/_sshfs b/Completion/Linux/Command/_sshfs index 3363ecdc0..3467fbd8a 100644 --- a/Completion/Linux/Command/_sshfs +++ b/Completion/Linux/Command/_sshfs @@ -19,8 +19,14 @@ _arguments -C -S : \ ':mountpoint:_files -/' && ret=0 if [[ $state == options ]]; then - _values -s , "sshfs or fuse or mount options" \ + # TODO complete ssh(1) options + _values -s , "options to ssh, sshfs, mount, or FUSE" \ + 'port:number' \ + 'compression: :(yes no)' \ reconnect delay_connect sshfs_sync no_readahead sync_readdir \ + sshfs_debug \ + 'cache: :(yes no)' \ + 'cache_timeout:timeout (seconds)' \ 'dir_cache:cache setting:(yes no)' \ 'dcache_max_size:size [10000]' \ 'dcache_timeout:timeout (seconds) [20]' \ @@ -37,12 +43,13 @@ if [[ $state == options ]]; then sftp_server:path:_files \ directport:port:_ports \ slave disable_hardlink transform_symlinks follow_symlinks no_check_root password_stdin \ + debug \ 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 \ + hard_remove use_ino readdir_ino direct_io kernel_cache auto_cache noauto_cache \ 'umask:permissions' \ 'uid:owner' 'gid:group' \ 'entry_timeout:timeout (seconds) [1]' \ @@ -60,7 +67,7 @@ if [[ $state == options ]]; then 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 + from_code:charset to_code:charset subdir:_directories rellinks norellinks && ret=0 fi return ret diff --git a/Completion/Linux/Command/_strace b/Completion/Linux/Command/_strace index 7d4595a33..b3b6f5096 100644 --- a/Completion/Linux/Command/_strace +++ b/Completion/Linux/Command/_strace @@ -1,50 +1,66 @@ #compdef strace strace64 -local curcontext="$curcontext" state line root expl ret=1 +local curcontext="$curcontext" root +local -i prec=1 form=1 ret=1 +local -a state line expl alts suf typeset -A opt_args -(( EUID )) && root='!' +(( EUID && ! $+_comp_priv_prefix )) && root='!' _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]' \ - '-X+[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \ - '(-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]:(time calls errors 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' \ - '(-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 <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' \ + \*{-E+,--env=}'[set or remove exported environment variable]:variable:->envars' \ + '(:)*'{-p+,--attach=}'[attach to the process with specified process ID and begin tracing]:process ID:_pids' \ + "${root}(-u --user)"{-u+,--user=}'[run as specified user]:user:_users' \ + '(-b --detach-on)'{-b+,--detach-on=}'[detach from process on specified syscall]:syscall:(execve)' \ + '(--daemonize)-D[run tracer as detached grandchild, keeping traced process as direct child of calling process]' \ + '(-D)--daemonize=-[specify how to run tracer process]::method:(grandchild pgroup session)' \ + '(-f --follow-forks)'{-f,--follow-forks}'[trace child processes as they are created by currently traced processes]' \ + '(-I --interruptible)'{-I+,--interruptible=}'[specify 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+,--trace=}'[select events to trace or how to trace]:system call:->expressions' \ + \*{-P+,--path=}'[trace only system calls accessing given path]:path:_files' \ + '(-z -Z --successful-only --failed-only)'{-z,--successful-only}'[trace only system calls that return success]' \ + '(-z -Z --successful-only --failed-only)'{-Z,--failed-only}'[trace only system calls that return an error]' \ + '(-a --columns)'{-a+,--columns=}'[align return values in a specific column]:column number [40]' \ + '(-i --instruction-pointer -c --summary-only)'{-i,--instruction-pointer}'[print instruction pointer at time of syscall]' \ + '(-c --summary-only -k --stack-traces)'{-k,--stack-traces}'[obtain stack trace between each syscall]' \ + '(-n --syscall-number)'{-n,--syscall-number}'[print syscall number]' \ + '(-o --output)'{-o+,--output=}'[send trace output to the specified file]:output file:->file-pipe' \ + '(-A --output-append-mode)'{-A,--output-append-mode}'[open the file provided with the -o option in append mode]' \ + '--output-separately[output to separate files for child processes (by appending pid to file names)]' \ + '(--quiet)-q[suppress messages about attaching, detaching etc]' \ + '(-q --quiet)-qq[suppress messages about process exit status]' \ + '(-q -qq --quiet)-qqq[suppress all suppressible messages]' \ + '(-q -qq -qqq)--quiet=[suppress messages about attaching, detaching etc]:suppression:_sequence compadd - attach personality exit all' \ + '(--relative-timestamps -c --summary-only)-r[print a relative timestamp upon entry to each system call]' \ + '(-r -c --summary-only)--relative-timestamps=-[print a relative timestamp upon entry to each system call]:precision [us]:compadd -o nosort s ms us ns' \ + '(--absolute-timestamps)-t[prefix each line of the trace with the wall clock time]' \ + '(-t)--absolute-timestamps=-[prefix each line of the trace with the wall clock time]:: :->time-formats' \ + '!(-t --absolute-timestamps)--timestamps=-:: :->time-formats' \ + '(-s --string-limit)'{-s+,--string-limit=}'[specify the maximum string size to print]:maximum string size [32]' \ + '(-c --summary-only -ttt)-t[prefix each line of the trace with the time of day]' \ + '(-c --summary-only -ttt -tt)-tt[prefix each line of the trace with the time of day including the microseconds]' \ + '(-c --summary-only -tt -t)-ttt[prefix each line of the trace with the number of seconds and microseconds since the epoch]' \ + '(--syscall-times -c --summary-only)-T[show the time spent in system calls]' \ + '(-T -c --summary-only)--syscall-times=-[show the time spent in system calls]::precision [us]:compadd -o nosort s ms us ns' \ + '(-v --no-abbrev)'{-v,--no-abbrev}'[print unabbreviated versions of environment, stat, termios, etc. calls]' \ + '(-xx --strings-in-hex)-x[print all non-ASCII strings in hexadecimal string format]' \ + '(-x --strings-in-hex)-xx[print all strings in hexadecimal string format]' \ + '(-x -xx)--strings-in-hex=[specify strings to print in hexadecimal format]:string type:(all non-ascii)' \ + '(-X --const-print-style)'{-X+,--const-print-style=}'[set the format for printing of named constants and flags]:format:(raw abbrev verbose)' \ + '(-c --summary-only -yy --decode-fds)-y[print paths associated with file descriptor arguments]' \ + '(-c --summary-only -y --decode-fds)-yy[print protocol specific information associated with socket file descriptors]' \ + '(-c --summary-only -y -yy)--decode-fds=-[print information associated with file descriptors]::information [none]:_sequence compadd - none all path socket dev pidfd' \ + '(-c --summary-only -C --summary -i --instruction-pointer -k --stack-traces -r --relative-timestamps -ff -t -tt -ttt --absolute-timestamps -T --syscall-times -y -yy --decode-fds)'{-c,--summary-only}'[count time, calls, and errors for each system call and report a summary]' \ + '(-c --summary-only -C --summary)'{-C,--summary}'[count time, calls, and errors for each system call and report a summary in addition to regular output]' \ + '(-O --summary-syscall-overhead)'{-O+,--summary-syscall-overhead=}'[specify overhead for tracing system calls]:overhead (microseconds)' \ + '(-S --summary-sort-by)'{-S+,--summary-sort-by=}'[sort the output of the histogram (-c option) by the specified criterion]:sort criterion [time]:(time min-time max-time avg-time calls errors name nothing)' \ + '(-U --summary-columns)'{-U+,--summary-columns=}'[show specific columns in the summary report]:column:_sequence compadd - time-percent total-time min-time max-time avg-time calls errors name' \ + '(-w --summary-wall-clock)'{-w,--summary-wall-clock}'[summarise syscall latency]' \ + '(-c --summary-only -C)-ff[write each process trace to <filename>.<pid> (when using -o <filename>]' \ + '(-d --debug)'{-d,--debug}'[show debug output of strace itself on standard error]' \ + '(- 1 *)'{-h,--help}'[display help information]' \ '--seccomp-bpf[enable seccomp-bpf filtering]' \ - '-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]' \ + '(- 1 *)'{-V,--version}'[display version information]' \ '(-):command name: _command_names -e' \ '*::arguments:_normal' && ret=0 @@ -61,7 +77,9 @@ case $state in '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 + 'quiet[suppress various information messages]:message [none]:_sequence compadd - none attach exit path-resolution personality thread-execve superseded' \ + 'kvm[print the exit reason of kvm vcpu]: :(vcpu)' \ + 'decode-fds[print information associated with file descriptors]:information [none]:_sequence compadd - none all path socket dev pidfd' && ret=0 if [[ $state = status ]]; then _values -s , 'return status [all]' \ all successful failed \ @@ -69,15 +87,17 @@ case $state in '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," + local dedup sets compset -P '!' dedup=( ${(Ms.,.)PREFIX##*,} ${(Ms.,.)SUFFIX%%,*} ) - compset -S ',*' || suf="" + compset -S ',*' || suf=( "-qS," ) compset -P '*,' if compset -P /; then _wanted syscalls expl "system call (regex)" _sys_calls -a -n $suf -F dedup && ret=0 else sets=( + '%clock:trace system calls that read or modify system clocks' + '%creds:trace system calls that read or modify user and group identifiers or capability 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' @@ -122,6 +142,22 @@ case $state in _parameters -qS= -g "*export*" && ret=0 fi ;; + time-formats) + alts=() + compset -P '(precision:*|s|ms|us|ns),' && prec=0 + compset -P '(format:*|none|time|unix),' && form=0 + compset -S ',*' || (( !prec + !form )) || suf=( -S , ) + if compset -P 'precision:'; then + form=0 + elif compset -P 'format:'; then + prec=0 + else + alts=( 'prefixes:prefix:compadd -S ":" ${${(s. .):-format x}[form]} ${${(s. .):-precision x}[prec]}' ) + fi + (( prec )) && alts+=( 'precisions:precision [s]:compadd -o nosort $suf s ms us ns' ) + (( form )) && alts+=( 'formats:format [time]:compadd $suf none time unix' ) + _alternative $alts && ret=0 + ;; esac return ret diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index e091dd3ea..5620da73d 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -11,6 +11,7 @@ _mpstat() { '--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)' \ '-o[display statistics in JSON]:format:(JSON)' \ '(-A)-P[specify processor number]:processor: _values -s "," processor ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ + '-T[display topology elements in the CPU report]' \ '-u[report CPU utilization]' \ '(- 1 2)-V[display version information]' \ '1: : _guard "^-*" interval' \ @@ -26,6 +27,7 @@ _cifsiostat() { '-t[print timestamp for each report]' \ '(- 1 2)-V[print version number]' \ '--human[print sizes in human readable format]' \ + '--pretty[make the CIFS report easier to read by a human]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } @@ -49,8 +51,8 @@ _sadf() { '-H[display only the header of the report]' \ '(-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)' \ + autoscale bwcol customcol height\:value oneday packed showidle showinfo showtoc skipempty hz\:value pcparchive\:name\:_files debug' \ + '-P[restrict processor dependent statistics]:processor number(zero indexed) or ALL:(ALL)' \ '--dev=-[specify block devices for which statistics are to be displayed]:block device:_files -g "*(-%)"' \ '--fs=-[specify filesystems for which statistics are to be displayed]:file system:_dir_list -s ,' \ '--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \ @@ -66,6 +68,7 @@ _sadf() { '-d[output file in SQL format]' \ '-g[print data in SVG format]' \ '-j[output file in JSON]' \ + '-l[export the contents of the data file to a PCP (Performance Co-Pilot) archive]' \ '-p[print in format parsable by tools like awk]' \ '-r[print raw contents of data file]' \ '-x[output file in XML]' \ @@ -96,16 +99,16 @@ _sar() { '(--human -p)-h[make output easier to read: implies --human and -p]' \ '(- 1 2)--help[display usage information]' \ '--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[report statistics for interrupts]: : _values -s "," interrupt 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' \ '--iface=-[specify network interfaces for which statistics are to be displayed]:network interface:_sequence _net_interfaces' \ '-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 FC SOFT ALL' \ + '-m[report power management statistics]:keyword:_sequence compadd - CPU FAN FREQ IN TEMP USB ALL' \ + '-n[report network statistics]:keyword:_sequence compadd - DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT 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]' \ + '-q[report queue length and load averages]::keyword:(CPU IO LOAD MEM PSI ALL)' \ '-R[report memory statistics]' \ '-r[report memory utilization statistics]:: :(ALL)' \ '-S[report swap space utilization]' \ diff --git a/Completion/Linux/Command/_tpb b/Completion/Linux/Command/_tpb index c4c4c2bbd..2bdee0942 100644 --- a/Completion/Linux/Command/_tpb +++ b/Completion/Linux/Command/_tpb @@ -9,7 +9,7 @@ _arguments \ '(-x --xevents)'{-x,--xevents=}':state:(on off)' \ '(-m --mixer)'{-m,--mixer=}':state:(on off)' \ '(-o --osd)'{-o,--osd=}':state:(on off)' \ - '(-p --poll)'{-p,--poll=}':delay in microseconds:' \ + '(-p --poll)'{-p,--poll=}':delay (microseconds)' \ '(-t --thinkpad)'{-t,--thinkpad=}':command to execute:_command_names' \ '(-H --home)'{-H,--home=}':command to execute:_command_names' \ '(-S --search)'{-S,--search=}':command to execute:_command_names' \ diff --git a/Completion/Linux/Command/_unshare b/Completion/Linux/Command/_unshare new file mode 100644 index 000000000..ff6f7042f --- /dev/null +++ b/Completion/Linux/Command/_unshare @@ -0,0 +1,40 @@ +#compdef unshare + +local ign +(( $#words > 2 )) && ign='!' + +# a different unshare exists on some systems +if [[ $OSTYPE != linux* ]]; then + _default + return +fi + +_arguments -S -s \ + '(-m --mount)'{-m-,--mount=-}'[enter mount namespace]::file:_files' \ + '(-u --uts)'{-u-,--uts=-}'[enter UTS namespace (hostname etc)]::file:_files' \ + '(-i --ipc)'{-i-,--ipc=-}'[enter System V IPC namespace]::file:_files' \ + '(-n --net)'{-n-,--net=-}'[enter network namespace]::file:_files' \ + '(-p --pid)'{-p-,--pid=-}'[enter pid namespace]::file:_files' \ + '(-U --user)'{-U-,--user=-}'[enter user namespace]::file:_files' \ + '(-C --cgroup)'{-C-,--cgroup=-}'[enter cgroup namespace]::file:_files' \ + '(-T --time)'{-T-,--time=-}'[enter time namespace]::file:_files' \ + '(-f --fork)'{-f,--fork}"[fork before launching]" \ + '(-r --map-root-user)--map-user=[map current user to uid (implies --user)]:user:_users' \ + '--map-group=[map current group to gid (implies --user)]:group:_groups' \ + '(-r --map-root-user -c --map-current-user --map-user)'{-r,--map-root-user}'[map current user to root (implies --user)]' \ + '(-c --map-current-user)'{-c,--map-current-user}'[map current user to itself (implies --user)]' \ + '(-f --fork)--kill-child=-[when dying, kill the forked child (implies --fork)]::signal [KILL]:_signals' \ + '--mount-proc=-[mount proc filesystem first (implies --mount)]::mount point [/proc]:_directories' \ + '--propagation=[modify mount propagation in mount namespace]:propagation flag:(slave shared private unchanged)' \ + '--setgroups=[control the setgroups syscall in user namespaces]:grant setgroups:(allow deny)' \ + '--keep-caps[retain capabilities granted in user namespaces]' \ + '(-R --root)'{-R+,--root=}'[set the root directory]:directory:_directories' \ + '(-w --wd)'{-w+,--wd=}'[set the working directory]:directory:_directories' \ + '(-S --setuid)'{-S+,--setuid=}'[set uid in entered namespace]:uid [0]' \ + '(-G --setgid)'{-G+,--setgid=}'[set gid in entered namespace]:gid [0]' \ + '--monotonic=[set clock monotonic offset in time namespaces]:offset (seconds)' \ + '--boottime=[set clock boottime offset in time namespaces]:offset (seconds)' \ + "${ign}(- 1 *)"{-h,--help}'[display usage information]' \ + "${ign}(- 1 *)"{-V,--version}'[display version information]' \ + '1: : _command_names -e' \ + '*::args :_normal' diff --git a/Completion/Linux/Command/_valgrind b/Completion/Linux/Command/_valgrind index 4a710e7f7..b4bb3248e 100644 --- a/Completion/Linux/Command/_valgrind +++ b/Completion/Linux/Command/_valgrind @@ -20,7 +20,7 @@ common_own_malloc=( '--alignment=-[set minimum alignment of heap allocations]:number [16]' '--redzone-size=-[set minimum size of redzones added before/after heap blocks]:size (bytes) [16]' '--xtree-memory=-[profile heap memory in an xtree [none]:(none allocs full)' - '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%p]:_files' + '--xtree-memory-file=-[specify xtree memory report file]:file [xtmemory.kcg.%%p]:_files' ) common_read_varinfo=( @@ -67,7 +67,7 @@ args_addrcheck=( '(--show-leak-kinds)--show-reachable=-[show reachable blocks in leak check]:enable:(yes no)' '(--show-leak-kinds)--show-possibly-lost=-:enable:(yes no)' '--xtree-leak=-[output leak result in xtree format]:enable [no]:(yes no)' - '--xtree-leak-file=-[specify xtree leak report file]:file [xtleak.kcg.%p]:_files' + '--xtree-leak-file=-[specify xtree leak report file]:file [xtleak.kcg.%%p]:_files' '--undef-value-errors=-[check for undefined value errors]:enable [yes]:(yes no)' '--track-origins=-[show origins of undefined values]:enable [no]:(yes no)' $common_partial @@ -123,7 +123,7 @@ args_cachegrind=( '--LL=-[set LL cache manually]:size,assoc,line_size' '--cache-sim=-[collect cache stats]:enable [yes]:(yes no)' '--branch-sim=-[collect branch prediction stats]:enable [no]:(yes no)' - '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%p]:_files' + '--cachegrind-out-file=-[specify output file name]:file name [cachegrind.out.%%p]:_files' ) args_helgrind=( @@ -169,7 +169,7 @@ args_massif=( ))" '--detailed-freq=-[every Nth snapshot should be detailed]:snapshot interval [10]' '--max-snapshots=-[specofy maximum number of snapshots recorded]:maximum [100]' - '--massif-out-file=-[specify output file name]:filename [massif.out.%p]:_files' + '--massif-out-file=-[specify output file name]:filename [massif.out.%%p]:_files' ) args_exp_bbv=( @@ -205,6 +205,7 @@ _arguments -C ${(P)args} $cmd \ '(--version)--tool=-[specify valgrind tool]:valgrind tool:->tools' \ '(-h --help)'{-h,--help}'[show help information]' \ '--help-debug[show help info including debugging options]' \ + '--help-dyn-options[show the dynamically changeable options]' \ '(-)--version[show version]' \ '(-q --quiet)'{-q,--quiet}'[run silently; only print error msgs]' \ '(-v --verbose)'{-v,--verbose}'[be more verbose]' \ diff --git a/Completion/Linux/Command/_wipefs b/Completion/Linux/Command/_wipefs index 5142def8a..8642aab92 100644 --- a/Completion/Linux/Command/_wipefs +++ b/Completion/Linux/Command/_wipefs @@ -19,6 +19,7 @@ _arguments -s -S \ '(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)--lock=-[use exclusive device lock]::mode:(yes no nonblock)' \ '(H)*:disk device:_files -g "*(-%)" -P / -W /' \ + '(H)' \ '(- *)'{-h,--help}'[display help information]' \ diff --git a/Completion/Linux/Type/_capabilities b/Completion/Linux/Type/_capabilities new file mode 100644 index 000000000..8cb31878f --- /dev/null +++ b/Completion/Linux/Type/_capabilities @@ -0,0 +1,65 @@ +#autoload + +# This function completes POSIX capabilities for Linux. +# Many command line utilities expect different syntax to encode various kinds +# of capability names or sets, so this function tries to be as generic as +# possible. It accepts compadd options to allow variations on the exact +# generated completion matches. +# +# Usage examples: +# +# Complete full capability names: +# _capabilities -p cap_ +# Sort the completion list by capability number: +# _capabilities -o nosort + +# The list of Linux capabilities is taken from include/uapi/linux/capability.h +# and subject to the following pipe filter: +# grep 'define CAP' | sed -r 's/^[[:space:]]*#define[[:space:]]+CAP_//; s/[[:space:]]+[0-9]+$//' | tr '[[:upper:]]' '[[:lower:]]' +local -a caplist=( + chown + dac_override + dac_read_search + fowner + fsetid + kill + setgid + setuid + setpcap + linux_immutable + net_bind_service + net_broadcast + net_admin + net_raw + ipc_lock + ipc_owner + sys_module + sys_rawio + sys_chroot + sys_ptrace + sys_pacct + sys_admin + sys_boot + sys_nice + sys_resource + sys_time + sys_tty_config + mknod + lease + audit_write + audit_control + setfcap + mac_override + mac_admin + syslog + wake_alarm + block_suspend + audit_read + perfmon + bpf + checkpoint_restore +) +local -a expl + +_description capabilities expl "Linux capability" +compadd "${(@)expl}" "$@" -a - caplist diff --git a/Completion/Linux/Type/_fuse_values b/Completion/Linux/Type/_fuse_values index be830cb40..211eb5b35 100644 --- a/Completion/Linux/Type/_fuse_values +++ b/Completion/Linux/Type/_fuse_values @@ -47,7 +47,7 @@ fvals=( [[ -n $cvalsvar ]] && set -- "$@" ${(P)cvalsvar} if [[ $# -eq 0 ]]; then - set -- 'mount options' $fvals + set -- 'mount option' $fvals else set -- "$@" $fvals fi diff --git a/Completion/Mandriva/Command/_urpmi b/Completion/Mandriva/Command/_urpmi index d897f2c4b..21c44ffaa 100644 --- a/Completion/Mandriva/Command/_urpmi +++ b/Completion/Mandriva/Command/_urpmi @@ -73,7 +73,7 @@ _urpmi() { opts_net=( "($help --wget)--curl[use curl to retrieve distant files]" - "($help)--limit-rate[limit the download speed (b/s)]:download speed in b/s: " + "($help)--limit-rate[limit the download speed]:download speed (b/s)" "($help)--proxy:proxy host:_hosts" "($help)--proxy-user:proxy user:_users" "($help --curl)--wget[use wget to retrieve distant files]" @@ -131,7 +131,7 @@ _urpmi() { "($help --no-probe --probe-hdlist)--probe-synthesis[try to find and use synthesis file]" \ "($help)--update[mark as update media]" \ "($help)--version[use specified distribution version]:Mandrake version: " \ - "($help)--virtual[create virtual media wich are always up-to-date]" \ + "($help)--virtual[create virtual media which are always up-to-date]" \ "($help)-c[clean headers cache directory]" \ "($help)-f[force generation of hdlist files]" \ "($help --distrib):name of media: " \ @@ -286,7 +286,7 @@ _urpmi() { "($help --all --interactive --name)--summary[print tag summary: summary]" \ "($help)--uniq[do not print identical lines]" \ "($help --all --interactive --name)--url[print tag url: url]" \ - "*:hdlist files:_files -g '*.cz(-.)'" \ + "*:hdlist file:_files -g '*.cz(-.)'" \ && ret=0 ;; esac diff --git a/Completion/Redhat/Command/_dnf b/Completion/Redhat/Command/_dnf index 82b9b188f..ce111f38f 100644 --- a/Completion/Redhat/Command/_dnf +++ b/Completion/Redhat/Command/_dnf @@ -1,78 +1,268 @@ #compdef dnf dnf-2 dnf-3 +# +# based on dnf-4.2.18 +# _dnf_helper() { - compadd $($python_exec $helper "$@" -d 0 -q -C 2>/dev/null) + # Get the pathname of the python executable from the 1st line of dnf-2/dnf-3. + # Probably /usr/bin/python{2,3} or /usr/libexec/platform-python. + local shebang + read -u0 shebang < $(readlink -f /usr/bin/dnf) + local python_exec=${${shebang##\#! #}%% *} + local -a helper_script=( + 'import sys' + 'from dnf.cli.completion_helper import main' + 'main(sys.argv[1:])' + ) + $python_exec -c ${(j.;.)helper_script} "$@" "$PREFIX" \ + -d 0 -q -C --assumeno --nogpgcheck 2>/dev/null </dev/null } _dnf_query_db() { - sqlite3 -batch -init /dev/null "$cache_file" "$1" + # $1: table name in the database ('available' or 'installed') + sqlite3 -batch -init /dev/null "$cache_file" \ + "select pkg from $1 WHERE pkg LIKE '$PREFIX%$SUFFIX'" } -_dnf_disabled_repos() { - _dnf_helper repolist disabled "" +_dnf_repositories() { + # required option: -T (all|disabled|enabled) + local selected expl + zparseopts -D -E - T:=selected + selected=$selected[2] + _wanted $selected-repositories expl "$selected repository" \ + compadd "$@" - $(_dnf_helper repolist --$selected) } -_dnf_enabled_repos() { - _dnf_helper repolist enabled "" +_dnf_packages() { + # required option: -T (all|available|installed|upgradable) + local selected pkgs expl + zparseopts -D -E - T:=selected + selected=$selected[2] + if [[ $selected = upgradable ]]; then + pkgs=( $(_dnf_helper upgrade) ) + elif [[ -r $cache_file ]]; then + local table=$selected + # 'available' table contains both 'available' and 'installed' packages + [[ $selected = all ]] && table=available + pkgs=( $(_dnf_query_db $table) ) + if [[ $selected = available ]]; then + local inst=( $(_dnf_query_db installed) ) + pkgs=( ${pkgs:|inst} ) # remove installed packages + fi + else + pkgs=( $(_dnf_helper list --$selected) ) + fi + _wanted $selected-packages expl "$selected package" compadd "$@" -a pkgs } -_dnf_available_packages() { - if [ -r $cache_file ]; then - compadd $(_dnf_query_db "select pkg from available WHERE pkg LIKE \"$1%\"") +_dnf_rpm_files() { + local expl + _wanted rpm-files expl 'rpm file' _files -g '(#i)*.rpm(-.)' +} + +_dnf_packages_or_rpms() { + if [[ "$words[CURRENT]" = (*/*|\~*) ]]; then # if looks like a path name + _dnf_rpm_files else - _dnf_helper install "$1" + _dnf_packages "$@" fi } -_dnf_installed_packages() { - if [ -r $cache_file ]; then - compadd $(_dnf_query_db "select pkg from installed WHERE pkg LIKE \"$1%\"") - else - _dnf_helper remove "$1" +_dnf_groups_caching_policy() { + # TODO: Are there any reliable ways to validate the cache? + local -a newer=( "$1"(Nmw-1) ) # rebuild if more than a week old + return $#newer +} + +_dnf_groups() { + local package_groups update_policy expl + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy _dnf_groups_caching_policy + fi + if _cache_invalid dnf-groups || ! _retrieve_cache dnf-groups; then + # this can be very slow + package_groups=( ${${${(M)${(f)"$(_call_program package-groups \ + $service group list -v 2>/dev/null)"}:# *}#*\(}%\)*} ) + _store_cache dnf-groups package_groups fi + _wanted package-groups expl 'package group' compadd "$@" -a package_groups } -_dnf_local_packages() { - _files -/ -g '(#i)*.rpm(-.)' +_dnf_repoquery() { + local _h='' + # 'dnf deplist' is an alias for 'dnf repoquery --deplist' + [[ $words[1] = deplist ]] && _h='!' + local -a opts=( '(- *)--querytags[list tags recognized by --queryformat]' ) + # Select options + opts+=( + '(-a --all)'{-a,--all}'[query all packages]' + '--arch=[limit results to specified architectures]:list of archs: ' + '--available[limit results to available packages]' + '--disable-modular-filtering[include packages of inactive module streams]' + '(-f --file)'{-f+,--file=}'[limit results to packages which own specified file]:file:_files' + '--latest-limit=[limit results to latest packages of specified number]:number: ' + '--recent[limit results to recently edited packages]' + '(--exactdeps)--alldeps[with --what{depends,requires}, also check non-explicit dependencies]' + '(--alldeps)--exactdeps[with --what{depends,requires}, check only explicit dependencies]' + '*--repo=[limit result to packages from the specified repo]: : _sequence _dnf_repositories -T all' + '--srpm[operate on the corresponding source RPM]' + '--whatdepends=[limit result to packages that require, enhance, recommend, suggest or supplement specified capability]:capability: ' + ) + for v in conflict enhance obsolete provide recommend require suggest supplement; do + opts+=( "--what${v}s=[limit result to packages that $v specified capability]:capability: " ) + done + # Query options + opts+=( + '--location[show a location where package could be downloaded from]' + '--tree[display recursive tree of packages]' + $_h'--deplist[display list of all direct dependencies and their providers]' + '--recursive[query packages recursively]' + '--resolve[resolve capabilities to originating package(s)]' + ) + # mutually exclusive Select options + opts+=( + + '(pkg_filter)' + '--duplicates[limit results to installed duplicate packages]' + '--installonly[limit results to installed installonly packages]' + '--unsatisfied[limit results to installed packages with unsatisfied dependencies]' + + '(list_group)' + '--installed[limit results to installed packages]' + '--extras[limit results to extra packages (not in any repos)]' + '--upgrades[limit results to upgrades for installed packages]' + '--unneeded[limit results to packages which are no longer needed]' + '--userinstalled[limit results to packages installed by user]' + ) + # mutually exclusive Query options + opts+=( + + '(output_format)' + {-i,--info}'[show detailed info about the package]' + {-l,--list}'[show list of files in the packages]' + {-s,--source}'[show source RPM name]' + '--changelogs[print package changelogs]' + '--nvr[show found packages in name-version-release format]' + '--nevra[show found packages in name-epoch:version-release.architecture format]' + '--envra[show found packages in epoch:name-version-release.architecture format]' + {--qf=,--queryformat=}'[specify custom output format]:format: ' + '--groupmember[display groups in which the package belongs]' + + '(pkg_attr)' + '--conflicts[display capabilities that the package conflicts with]' + '--depends[display capabilities that the package depends on, enhances, recommends, suggests or supplements]' + '--enhances[display capabilities that the package enhance]' + '--provides[display capabilities that the package provides]' + '--recommends[display capabilities that the package recommends]' + '--requires[display capabilities that the package depends on]' + '--requires-pre[display capabilities that the package depends on for running %pre script]' + '--suggests[display capabilities that the package suggests]' + '--supplements[display capabilities that the package supplements]' + '--obsoletes[display capabilities that the package obsoletes]' + ) + _arguments : '*: : _dnf_packages -T all' $opts } -_dnf() { - if [[ "$(readlink /usr/bin/dnf)" == "dnf-2" ]]; then - local python_exec="/usr/bin/python2" +_dnf_repository_packages() { + if (( CURRENT == 2 )); then + _dnf_repositories -T all + elif (( CURRENT == 3 )); then + local -a subcmds=( + 'check-update:check if updates are available in the repository' + 'info:list description of packages in the repository' + 'install:install all packages in the repository' + 'list:list packages in the repository' + 'move-to:reinstall all packages that are available in the repository' + 'reinstall:run reinstall-old, or move-to if it fails' + 'reinstall-old:reinstall all packages that were installed from the repository' + 'remove:remove all packages installed from the repository' + 'remove-or-distro-sync:sync packages with other repo if available there, or remove otherwise' + 'remove-or-reinstall:reinstall packages if available in other repo, or remove otherwise' + 'upgrade:update all packages in the repository' + ) + _describe -t subcommands 'subcommand' subcmds + elif [[ $words[3] = (info|list) ]]; then + if (( CURRENT == 4 )); then + _wanted options expl "option" compadd - --all --installed --available \ + --extras --obsoletes --recent --upgrades + else + _dnf_packages -T all + fi + elif [[ $words[3] = install ]]; then + _dnf_packages -T available + elif [[ $words[3] = upgrade* ]]; then + _dnf_packages -T upgradable else - local python_exec="/usr/bin/python3" + _dnf_packages -T installed fi - local helper=$(${python_exec} -c "import dnf.cli; print('{}/completion_helper.py'.format(dnf.cli.__path__[0]))") - local cache_file="/var/cache/dnf/packages.db" +} - _arguments -s \ - '(- *)'{-h,--help}'[show the help message]' \ - '--version[show dnf version]' \ - '(-v --verbose)'{-v,--verbose}'[set verbose, show debug messages]' \ - '(-q --quiet)'{-q,--quiet}'[show just the relevant content]' \ - '--allowerasing[allow erasing of installed packages]' \ - '(-y --assumeyes)'{-y,--assumeyes}'[answer yes for all questions]' \ - '(-C --cacheonly)'{-C,--cacheonly}'[run entirely from cache]' \ - '(-c --config)'{-c,--config=}'[config file location]:config file:_files' \ - '(-R --randomwait)'{-R,--randomwait=}'[maximum command wait time (in minutes)]:max wait time' \ - '--releasever=[configure DNF for another release]:release' \ - '--refresh[set metadata as expired before running the command]' \ - '--nogpgcheck[skip checking GPG signatures on package]' \ - '--installroot=[set install root]:install root:_files -/' \ - '*--enablerepo=[enable one or more repositories]:repos to enable:_dnf_disabled_repos' \ - '*--disablerepo=[disable one or more repositories]:disable repos:_dnf_enabled_repos' \ - '*::dnf command:_dnf_command' +_dnf() { + local cache_file="/var/cache/dnf/packages.db" + local -a opts=( + '(-6)-4[resolve to IPv4 addresses only]' + '(-4)-6[resolve to IPv6 addresses only]' + '*--advisory=[include packages for specified advisory]:advisory: ' + '--allowerasing[allow erasing installed packages to resolve dependencies]' + '(-y --assumeyes)--assumeno[answer no for all questions]' + '(-b --best)'{-b,--best}'[try the best available package version]' + '--bugfix[include bugfix relevant packages]' + '*'{--bz=,--bzs=}'[include packages needed to fix the specified Bugzilla]:BZ ID: ' + '(-C --cacheonly)'{-C,--cacheonly}"[run entirely from system cache, don't update cache]" + '--color=[control whether color is used]:when:(always never auto)' + '--comment=[add comment to transaction history]:comment: ' + '(-c --config)'{-c+,--config=}'[specify configuration file]:config file:_files' + '*'{--cve=,--cves=}'[include packages needed to fix the specified CVE]:CVE ID: ' + '(-d --debuglevel)'{-d+,--debuglevel=}'[specify debugging output level]:level (0-10): ' + '--debugsolver[dump detailed solving results in file ./debugdata]' + '*--disableexcludes=[disable config file excludes]: : _alternative "sections\:section\:(all main)" "repositories\:repository\:_dnf_repositories -T all"' + '(--disable --set-disabled)'{--disable,--set-disabled}'[disable repos with config-manager command]' + '*--disableplugin=[disable specified plugins]:list of plugin names: ' + '(--repo)*--disablerepo=[disable specified repos]: : _sequence _dnf_repositories -T enabled' + '(--downloaddir --destdir)'{--downloaddir=,--destdir=}'[redirect downloaded packages to the specified dir]:directory:_files -/' + '--downloadonly[only download the resolved packages]' + '(-e --errorlevel)'{-e+,--errorlevel=}'[specify error output level]:level (0-10): ' + '(--enable --set-enabled)'{--enable,--set-enabled}'[enable repos with config-manager command]' + '--enableplugin=[enable specified plugins]:list of plugin names: ' + '*--enablerepo=[enable additional repos]: : _sequence _dnf_repositories -T disabled' + '--enhancement[include enhancement relevant packages]' + '*'{-x+,--exclude=}'[exclude specified packages]: : _sequence _dnf_packages -T all' + '--forcearch=[force the use of the specified arch]:arch: ' + '(-)'{-h,--help}'[show the help message]' + '--installroot=[set install root]:directory:_files -/' + '--newpackage[include newpackage relevant packages]' + '--noautoremove[disable removal of dependencies that are no longer used]' + '--nobest[do not limit transactions to best candidates]' + '--nodocs[do not install documentation]' + '--nogpgcheck[skip checking GPG signatures on packages]' + '--noplugins[disable all plugins]' + '--obsoletes[enable obsoletes processing logic]' + '(-q --quiet)'{-q,--quiet}'[show just the relevant content]' + '(-R --randomwait)'{-R+,--randomwait=}'[maximum command wait time]:max wait time (minutes): ' + '--refresh[set metadata as expired before running the command]' + '--releasever=[configure DNF for another release]:release: ' + '*--repofrompath=[specify additional repos]:repository_label,path_or_url: ' + '(--disablerepo)*'{--repo=,--repoid=}'[enable just the specified repo]: : _sequence _dnf_repositories -T all' + '--rpmverbosity=[set RPM debug scriptlet output level]:debug level:(critical emergency error warn info debug)' + '*--sec-severity=[include security relevant packages matching specified severity]:severity:(Critical Important Moderate Low)' + '--security[include security relevant packages]' + '*--setopt=[override config option]:repoid.option=value: ' + '--skip-broken[resolve depsolve problems by skipping packages]' + '--show-duplicates[show duplicate packages in repos]' + '(-v --verbose)'{-v,--verbose}'[set verbose, show debug messages]' + '(- *)--version[show dnf version]' + '(-y --assumeyes --assumeno)'{-y,--assumeyes}'[answer yes for all questions]' + ) + _arguments -s : $opts '*::dnf command:_dnf_command' } _dnf_command() { - local -a _dnf_cmds - _dnf_cmds=( + local -a dnf_cmds=( + 'alias:define and manage aliases' "autoremove:automatically remove no longer required packages" + 'check:report problems in local packagedb if any' "check-update:check for available package upgrades" "clean:remove cached data" + 'deplist:alias for "repoquery --deplist"' "distro-sync:synchronize installed packages to the latest available versions" "downgrade:downgrade a package" - "erase:deprecated alias for remove" "group:display, or use, the groups information" "help:display a helpful usage message" "history:display, or use, the transaction history" @@ -81,117 +271,280 @@ _dnf_command() { "list:list a package or groups of packages" "makecache:generate the metadata cache" "mark:mark or unmark installed packages as installed by user" + 'module:interact with modules' "provides:find what package provides the given value" "reinstall:reinstall a package" "remove:remove a package or packages from your system" "repolist:display the configured software repositories" + 'repoquery:search repos for packages and display info about them' "repository-packages:run commands on top of all packages in given repository" "search:search package details for the given string" - "update:deprecated alias for upgrade" + 'shell:open an interactive shell' + 'swap:replace a package by another' "updateinfo:display advisories about packages" "upgrade:upgrade a package or packages on your system" - "upgrade-to:upgrade a package on your system to the specified version" + 'upgrade-minimal:upgrade only bugfix, enhancement or security fix' ) if (( CURRENT == 1 )); then - _describe -t commands 'dnf command' _dnf_cmds || compadd "$@" + _describe -t dnf-commands 'dnf command' dnf_cmds else - local command="${${_dnf_cmds[(r)$words[1]:*]%%:*}}" - # Deal with any aliases - case $command in - erase) command="remove";; - whatprovides) command="provides";; - update) command="upgrade";; + local curcontext=$curcontext cur=$words[CURRENT] cmd tmp expl ret=1 + # Deal with aliases (not comprehensive) + case $words[1] in + check-updgrade) cmd=check-update;; + distrosync|dsync) cmd=distro-sync;; + dg) cmd=downgrade;; + erase|rm) cmd=remove;; + groups|grp) cmd=group;; + hist) cmd=history;; + in) cmd=install;; + mc) cmd=makecache;; + prov|whatprovides) cmd=provides;; + rei) cmd=reinstall;; + repoinfo) cmd=repolist;; + rq) cmd=repoquery;; + se) cmd=search;; + sh) cmd=shell;; + update|up) cmd=upgrade;; + update-minimal|up-min) cmd=upgrade-minimal;; + *) cmd="${${dnf_cmds[(r)$words[1]:*]%%:*}}";; esac + (( $#cmd )) && curcontext="${curcontext%:*:*}:dnf-${cmd}:" - _is_path() { - [[ "$1" == *\/* ]] || [[ "$1" == \~* ]] - } - - local cur=$words[CURRENT] - local prev="" - [[ $CURRENT > 2 ]] && prev=$words[$((CURRENT - 1))] - - case $command in - install|upgrade|reinstall|info|check-update|distro-sync) - if ! _is_path "$cur"; then - _dnf_available_packages "$cur" + case $cmd in + alias) + if (( CURRENT == 2 )); then + _wanted subcommands expl 'subcommand' \ + compadd - list add delete && ret=0 + elif [[ $words[2] = add ]]; then + _message "name='value'" && ret=0 else - _dnf_local_packages + _message "alias name" && ret=0 fi ;; - remove|downgrade) - if ! _is_path "$cur"; then - _dnf_installed_packages "$cur" - elif [[ "$command" == downgrade ]]; then - _dnf_local_packages + autoremove|downgrade|reinstall) + _dnf_packages_or_rpms -T installed && ret=0 + ;; + check) + tmp=( + '--all:show all problems (default)' + '--dependencies:show dependency problems' + '--duplicates:show duplicate problems' + '--obsoleted:show obsoleted packages' + '--provides:show problems with provides' + ) + _describe -t options 'option' tmp && ret=0 + ;; + check-update) + if [[ $cur = -* ]]; then + _wanted options expl 'option' compadd - --changelogs && ret=0 + else + _dnf_packages -T installed && ret=0 fi ;; - list|clean) - _dnf_helper $command "$prev" "$cur" + clean) + tmp=( + 'dbcache:remove cache files generated from the repository metadata' + 'expire-cache:mark the repository metadata expired' + 'metadata:remove the repository metadata' + 'packages:remove any cached packages' + 'all:clean all' + ) + _describe -t targets 'clean target' tmp && ret=0 + ;; + distro-sync) + _dnf_packages -T installed && ret=0 ;; group) - local -a _dnf_group_cmds - _dnf_group_cmds=( - "summary:display groups overview" - "info:display package lists of a group" - "install:install packages from a group" - "list:list all matching groups" - "remove:mark the group removed" - "upgrade:upgrades the group and its packages" - "mark:mark a group for installation or removal" - ) if (( CURRENT == 2 )); then - _describe -t commands 'dnf group command' _dnf_group_cmds + tmp=( + "summary:display groups overview" + "info:display package lists of a group" + "install:install packages from a group" + "list:list all matching groups" + "remove:remove packages in a group not used by other groups" + "upgrade:upgrade the group and its packages" + "mark:mark a group for installation or removal" + ) + _describe -t subcommands 'subcommand' tmp && ret=0 + elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then + if [[ $words[2] == install ]]; then + _wanted options expl 'option' compadd - --with-optional && ret=0 + elif [[ $words[2] == list ]]; then + tmp=( + '--available:show only available groups' + '--installed:show only installed groups' + '--hidden:show also hidden groups' + '--ids:show also ID of groups' + ) + _describe -t options 'option' tmp && ret=0 + fi + elif (( CURRENT == 3 )) && [[ $words[2] == mark ]]; then + _wanted subcommands expl 'subcommand' \ + compadd - install remove && ret=0 + else + _dnf_groups && ret=0 fi ;; help) if (( CURRENT == 2 )); then - _dnf_helper '_cmds' '' + _wanted commands expl 'dnf command or alias' \ + compadd - $(_dnf_helper '_cmds') && ret=0 fi ;; history) - local -a _dnf_history_cmds - _dnf_history_cmds=( - "list:list transactions" - "info:describe the given transactions" - "redo:repeat the specified transaction" - "rollback:undo all since the given transaction" - "undo:undo transactions" - "userinstalled:list names of all packages installed by a user" - ) if (( CURRENT == 2 )); then - _describe -t commands 'dnf history command' _dnf_history_cmds + tmp=( + "list:list transactions" + "info:describe the given transactions" + "redo:repeat the specified transaction" + "rollback:undo all since the given transaction" + "undo:undo transactions" + "userinstalled:list all packages installed by users" + ) + _describe -t subcommands 'subcommand' tmp && ret=0 + elif [[ $words[2] != userinstalled ]]; then + _message 'transaction' && ret=0 + fi + ;; + info|list) + if (( CURRENT == 2 )); then + if [[ $cur = -* ]]; then + tmp=( --all --available --installed --extras + --obsoletes --upgrades --autoremove --recent ) + _wanted options expl 'option' compadd -a tmp + else + _dnf_packages -T all && ret=0 + fi + elif [[ $words[2] == --(all|recent) ]]; then + _dnf_packages -T all && ret=0 + elif [[ $words[2] == --available ]]; then + _dnf_packages -T available && ret=0 + elif [[ $words[2] == --upgrades ]]; then + _dnf_packages -T upgradable && ret=0 else - _dnf_helper $command "$prev" "$cur" + _dnf_packages -T installed && ret=0 fi ;; + install) + _dnf_packages_or_rpms -T available && ret=0 + ;; makecache) if (( CURRENT == 2 )); then - _values 'make cache' 'timer' + _describe -t options 'option' \ + '(--timer:"be more resource-aware")' && ret=0 fi ;; mark) if (( CURRENT == 2 )); then - _values 'mark' 'install' 'remove' + _wanted subcommands expl 'mark as' \ + compadd - install remove group && ret=0 + else + _dnf_packages -T installed && ret=0 + fi + ;; + module) + if (( CURRENT == 2 )); then + tmp=( + 'install:install a module profile including its packages' + 'update:update packages associated with an active module stream' + 'remove:remove installed module profiles and their packages' + 'enable:enable a module stream' + 'disable:disable a module with all its streams' + 'reset:reset module state, no longer enabled or disabled' + 'provides:list modular packages, with modules they belong to' + 'list:list all (or selected) module streams, profiles and states' + 'info:print detailed information about a module' + 'repoquery:list packages belonging to a module' + ) + _describe -t subcommands 'subcommand' tmp && ret=0 + elif (( CURRENT == 3 )) && [[ $cur = -* ]]; then + if [[ $words[2] = remove ]]; then + tmp=( --all ) + elif [[ $words[2] = list ]]; then + tmp=( --all --enabled --disabled --installed ) + elif [[ $words[2] = info ]]; then + tmp=( --profile ) + elif [[ $words[2] = repoquery ]]; then + tmp=( --available --installed ) + fi + _wanted options expl 'option' compadd -a tmp && ret=0 else - _dnf_installed_packages "$cur" + # TODO: complete module name or spec + if [[ $words[2] = provides ]]; then + _dnf_packages -T all && ret=0 + elif [[ $words[2] = (disable|reset|list) ]]; then + _message 'module name' && ret=0 + else + _message 'module spec' && ret=0 + fi fi ;; provides) - _files + _files && ret=0 + ;; + remove) + if (( CURRENT == 2 )) && [[ $cur = -* ]]; then + _wanted options expl 'option' \ + compadd - --duplicates --oldinstallonly && ret=0 + elif [[ $words[2] != -* ]]; then + _dnf_packages_or_rpms -T installed && ret=0 + fi ;; repolist) if (( CURRENT == 2 )); then - _values 'repolist' 'enabled' 'disabled' 'all' + _wanted options expl 'option' \ + compadd - --enabled --disabled --all && ret=0 fi ;; + repoquery|deplist) + _dnf_repoquery && ret=0 + ;; + repository-packages) + _dnf_repository_packages + ;; search) + if [[ $cur = -* ]]; then + _wanted options expl 'option' compadd - --all && ret=0 + else + _message 'keywords' && ret=0 + fi + ;; + shell) if (( CURRENT == 2 )); then - _values 'search' 'all' + _wanted script-files expl 'script file' _files && ret=0 fi ;; + swap) + case $CURRENT in + 2) _dnf_packages -T installed && ret=0 ;; + 3) _dnf_packages -T available && ret=0 ;; + esac + ;; + updateinfo) + tmp=( + '--with-cve[print only advisories referencing CVE]' + '--with-bz[print only advisories referencing bugzilla]' + + '(output-type)' + '--summary[display just counts of advisories of each type]' + '--list[display list of advisories]' + '--info[display detailed information of advisories]' + + '(availability)' + '--available[limit to advisories about newer versions of installed packages]' + '--installed[limit to advisories about equal or older versions of installed packages]' + '--updates[limit to advisories about newer and available versions of installed packages]' + ) + _arguments '*: : _dnf_packages -T installed' $tmp && ret=0 + ;; + upgrade) + _dnf_packages_or_rpms -T upgradable && ret=0 + ;; + upgrade-minimal) + _dnf_packages -T upgradable && ret=0 + ;; esac + return ret fi } diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm index e3469245f..d00f88429 100644 --- a/Completion/Redhat/Command/_rpm +++ b/Completion/Redhat/Command/_rpm @@ -129,6 +129,7 @@ _rpm () { '--scm=[select the SCM to use with %autosetup]:scm [patch]:(patch gendiff git quilt)' '*--buildpolicy=[set buildroot policy]:policy:->brp_policies' '!--sign' + '--trace[trace macro expansion]' "--nodebuginfo[don't generate debuginfo for this package]" ) @@ -282,7 +283,7 @@ _rpm () { build_r) tmp=( '*:source package:_files -g "*.(#i)src.rpm(-.)"' ) ;| build_t) tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' ) ;| build_?) - _arguments -s -C $buildopts $commonopts $pathopts \ + _arguments -s -C $buildopts $commonopts $pathopts "${tmp[@]}" \ ;; checksig) _arguments -s -C \!-K \ diff --git a/Completion/Redhat/Command/_yum b/Completion/Redhat/Command/_yum index a30aa579f..9425ba57c 100644 --- a/Completion/Redhat/Command/_yum +++ b/Completion/Redhat/Command/_yum @@ -167,7 +167,7 @@ _yumdb() { if [ "$cmd" = "help" ]; then if (( CURRENT == 2 )); then - _describe -t commands 'yum commands' _yum_cmds && ret=0 + _describe -t commands 'yum command' _yum_cmds && ret=0 else # help takes one argument _message 'no more arguments' diff --git a/Completion/Solaris/Command/_coreadm b/Completion/Solaris/Command/_coreadm index 7262e6423..655b48e63 100644 --- a/Completion/Solaris/Command/_coreadm +++ b/Completion/Solaris/Command/_coreadm @@ -40,6 +40,6 @@ _arguments -s \ - set2 \ '-p[PID-specific per-process core file name pattern]:' \ '-P[PID-specific per-process core file content]:content:_values -s + "content" $content' \ - '*:pids:_pids' \ + '*:pid:_pids' \ - set3 \ '-u[update options from coreadm.conf]' diff --git a/Completion/Solaris/Command/_dhcpinfo b/Completion/Solaris/Command/_dhcpinfo index 079b6e6f6..1dac684af 100644 --- a/Completion/Solaris/Command/_dhcpinfo +++ b/Completion/Solaris/Command/_dhcpinfo @@ -1,36 +1,32 @@ #compdef dhcpinfo -_dhcpinfo() { - local -a mnemonics_v4 mnemonics_v6 +local -a mnemonics_v4 mnemonics_v6 - mnemonics_v4=( - Subnet UTCoffst Router Timeserv IEN116ns DNSserv Logserv - Cookie Lprserv Impress Resource Hostname Bootsize Dumpfile - DNSdmain Swapserv Rootpath ExtendP IpFwdF NLrouteF PFilter - MaxIpSiz IpTTL PathTO PathTbl MTU SameMtuF Broadcst - MaskDscF MaskSupF RDiscvyF RSolictS StaticRt TrailerF - ArpTimeO EthEncap TcpTTL TcpKaInt TcpKaGbF NISdmain - NISservs NTPservs NetBNms NetBDsts NetBNdT NetBScop - XFontSrv XDispMgr LeaseTim Message T1Time T2Time NW_dmain - NWIPOpts NIS+dom NIS+serv TFTPsrvN OptBootF MblIPAgt - OptBootF MblIPAgt SMTPserv POP3serv NNTPserv WWWservs - Fingersv IRCservs STservs STDAservs UserClas SLP_DA SLP_SS - AgentOpt FQDN PXEarch BootFile BootPath BootSrvA BootSrvN - EchoVC LeaseNeg - ) +mnemonics_v4=( + Subnet UTCoffst Router Timeserv IEN116ns DNSserv Logserv + Cookie Lprserv Impress Resource Hostname Bootsize Dumpfile + DNSdmain Swapserv Rootpath ExtendP IpFwdF NLrouteF PFilter + MaxIpSiz IpTTL PathTO PathTbl MTU SameMtuF Broadcst + MaskDscF MaskSupF RDiscvyF RSolictS StaticRt TrailerF + ArpTimeO EthEncap TcpTTL TcpKaInt TcpKaGbF NISdmain + NISservs NTPservs NetBNms NetBDsts NetBNdT NetBScop + XFontSrv XDispMgr LeaseTim Message T1Time T2Time NW_dmain + NWIPOpts NIS+dom NIS+serv TFTPsrvN OptBootF MblIPAgt + OptBootF MblIPAgt SMTPserv POP3serv NNTPserv WWWservs + Fingersv IRCservs STservs STDAservs UserClas SLP_DA SLP_SS + AgentOpt FQDN PXEarch BootFile BootPath BootSrvA BootSrvN + EchoVC LeaseNeg +) - mnemonics_v6=( - ClientID ServerID Preference Unicast UserClass VendorClass - SIPNames SIPAddresses DNSAddresses DNSSearch NISServers - NIS+Servers NISDomain NIS+Domain SNTPServers InfoRefresh - BCMCDomain BCMCAddresses - ) +mnemonics_v6=( + ClientID ServerID Preference Unicast UserClass VendorClass + SIPNames SIPAddresses DNSAddresses DNSSearch NISServers + NIS+Servers NISDomain NIS+Domain SNTPServers InfoRefresh + BCMCDomain BCMCAddresses +) - _arguments -A \ - '-c[]' \ - '-i[interface]:interface:' \ - '-n[maximum number of lines]:limit:' \ - ':DHCP Parameter:_values "DHCP Parameter" $mnemonics_v4' \ -} - -_dhcpinfo "$@" +_arguments -A "-*" \ + '-c[]' \ + '-i[interface]:interface' \ + '-n[maximum number of lines]:limit' \ + ':DHCP parameter:_values "DHCP parameter" $mnemonics_v4' diff --git a/Completion/Solaris/Command/_dtrace b/Completion/Solaris/Command/_dtrace index a095589eb..06e0dc4f6 100644 --- a/Completion/Solaris/Command/_dtrace +++ b/Completion/Solaris/Command/_dtrace @@ -1,41 +1,152 @@ #compdef dtrace -# Synced with Nevada build 160 man pages -_dtrace() { - _arguments -s \ - '-32[generate 32-bit D programs and ELF files]' \ - '-64[generate 64-bit D programs and ELF files]' \ - '-a[claim anonymous tracing state]' \ - '-A[generate driver.conf(4) directives for anonymous tracing]' \ - '-b[set trace buffer size]' \ - '-c[run specified command and exit upon its completion]' \ - '-C[run cpp(1) preprocessor on script files]' \ - '-D[define symbol when invoking preprocessor]' \ - '-e[exit after compiling request but prior to enabling probes]' \ - '-f[enable or list probes matching the specified function name]:function: ' \ - '-F[coalesce trace output by function]' \ - '-G[generate an ELF file containing embedded dtrace program]' \ - '-H[print included files when invoking preprocessor]' \ - '-h[Generate a header file]' \ - '-i[enable or list probes matching the specified probe id]' \ - '-I[add include directory to preprocessor search path]:include dir:_files -/' \ - '-L[Add directory to search path for DTrace libraries]:lib dir:_files -/' \ - '-l[list probes matching specified criteria]' \ - '-m[enable or list probes matching the specified module name]:module: ' \ - '-n[enable or list probes matching the specified probe name]:name: ' \ - '-o[set output file]:output file:_files' \ - '-p[grab specified process-ID and cache its symbol tables]:pid:_pids' \ - '-P[enable or list probes matching the specified provider name]:provider: ' \ - '-q[set quiet mode (only output explicitly traced data)]' \ - '-s[enable or list probes according to the specified D script]' \ - '-S[print D compiler intermediate code]' \ - '-U[undefine symbol when invoking preprocessor]' \ - '-v[set verbose mode (report program stability attributes)]' \ - '-V[report DTrace API version]' \ - '-w[permit destructive actions]' \ - '-x[enable or modify compiler and tracing options]' \ - '-X[specify ISO C conformance settings for preprocessor]:ISO C conformance:((a\:"ISO plus K&R extensions (default)" c\:"Strictly conformant ISO C" s\:"K&R C only" t\:"ISO plus K&R extensions"))' \ - '-Z[permit probe descriptions that match zero probes]' -} +local curcontext="$curcontext" ret=1 +local -a state line args xopts -_dtrace "$@" +case $OSTYPE in + ^darwin*) + args=( + '-32[generate 32-bit D programs and ELF files]' + '-64[generate 64-bit D programs and ELF files]' + '(-A -h -l -V)-G[generate an ELF file containing embedded dtrace program]' + '-X+[specify ISO C conformance settings for preprocessor]:ISO C conformance:((a\:"ISO plus K&R extensions (default)" c\:"Strictly conformant ISO C" s\:"K&R C only" t\:"ISO plus K&R extensions"))' + ) + xopts=( + 'errexit[exit on error with specified status code]::status [1]' + 'noresolve[do not perform user address symbol resolution]' + 'uresolve[specify resolution of user addresses]:how:(no symbol basename absolute)' + ) + ;; + darwin*) + args=( + '*-W[wait for the named process to launch]:name' + ) + xopts=( + 'amin[set minimum stability attributes]:attribute' + 'arch[set target data model]:arch' + 'argref[ignore additional positional command-line args]' + 'core[create core dump when exiting dtrace]' + 'cpp[run C preprocessor over D programs before compiling]' + 'cpphdrs[print each header file name used]' + 'ctypes[write all CTF definitions into a file]:file:_file' + 'debug[enable DTrace debug messages]' + 'define[add preprocessor define]:var[=val]' + 'disallow_dsym[do not use dSYM files]' + 'droptags[print drop tags to stderr]' + 'empty[allow empty D files]' + 'encoding[set encoding used for output]:encoding:(ascii utf8)' + 'errtags[prefix error message with error tags]' + 'evaltime[when to start instrumenting a new process]:when:(preinit postinit)' + 'incdir[add include file search directory]:directory:_files -/' + 'ireg[specify size of DIF integer register set]:size' + 'late[set whether references to dynamic translators are allowed]: :(dynamic static)' + 'libdir[add library search directory]:directory:_files -/' + 'mangled[show mangled symbols for C++/Swift probes]' + 'nolibs[do not include D system libraries]' + 'nojtanalysis[disable jump table analysis]' + 'noerror[do not show error messages]' + 'pgmax[set maximum number of processes DTrace can grab at the same time]:number' + 'preallocate[preallocate memory in dtrace before running the script]:size' + 'pspec[interpret ambiguous specifications as probe names]' + 'strip[strip non-loadable sections from D program]' + 'tree[show dtrace compiler parse tree at different stages]:bitmap:(1 2 4)' + 'tregs[specify size of DIF tuple register set]:size' + 'undef[add #undef into preprocessor predefines]:var name' + 'verbose[show D compiler intermediate code]' + 'version[request specific version of DTrace scripting language]:version' + 'zdefs[permit probe descriptions that match zero probes]' + 'buflimit[specify threshold percentage for early buffer switches]:percentage (1-99)' + 'temporal[whether to sort events in time order]:bool:(true false)' + 'stacksymbols[whether to symbolicate stack symbols]:bool:(true false)' + ) + ;; +esac + +xopts+=( + 'aggrate[rate of aggregation reading]:time' + 'aggsize[aggregation buffer size]:size' + 'ustackframes[number of user stack frames]:scalar' + 'bufpolicy[specify the buffer policy for the principal buffer]:policy:(fill switch ring)' + 'bufresize[buffer resizing policy]:policy:(auto manual)' + 'bufsize[size of the per-CPU principal buffer]:size' + 'cleanrate[cleaning rate (hz)]:time' + 'cpu[specify the CPU on which to enable tracing]:scalar' + 'defaultargs[allow references to unspecified macro arguments]' + 'destructive[allow destructive actions]' + 'dynvarsize[size of the dynamic variable space]:size' + 'flowindent[turn on flow indentation]' + 'grabanon[claim anonymous state]' + 'jstackframes[number of default stack frames for jstack()]:scalar' + 'jstackstrsize[default string space size for jstack()]:scalar' + 'nspec[number of speculations]:scalar' + 'quiet[set quiet mode]' + 'specsize[size of the speculation buffer]:size' + 'strsize[maximum size of strings]:size' + 'stackframes[maximum number of kernelspace stack frames to unwind for stack()]:scalar' + 'stackindent[whitespace characters to use when indenting stack() and ustack() output]:scalar' + 'statusrate[rate of status checking]:time' + 'switchrate[rate of buffer switching]:time' + 'ustackframes[maximum number of userspace stack frames to unwind for ustack()]:scalar' + 'agghist[whether to show histogram for all aggregations]:bool:(true false)' + 'aggpack[pack aggregations together]' + 'aggsortkey[sort aggregation by key]' + 'aggsortkeypos[position of aggregate key used for sorting]:position' + 'aggsortpos[position of the aggregate variable used for sorting]:position' + 'aggsortrev[sort aggregations in reverse order]' + 'aggzoom[zoom aggregation histogram to the maximum value]' + 'rawbytes[always print tracemem output in hexadecimal]' +) + +_arguments -C -s $args \ + '-a[claim anonymous tracing state]' \ + '(-G -h -l -V)-A[generate driver.conf(4) directives for anonymous tracing]' \ + '-b+[set trace buffer size]:size' \ + '*-c+[run specified command and exit upon its completion]:command' \ + '-C[run cpp(1) preprocessor on script files]' \ + '*-D+[define symbol when invoking preprocessor]:name' \ + '-e[exit after compiling request but prior to enabling probes]' \ + '-f+[enable or list probes matching the specified function name]:function:->functions' \ + '-F[coalesce trace output by function]' \ + '-H[print included files when invoking preprocessor]' \ + '(-A -G -l -V)-h[generate a header file]' \ + '*-i+[enable or list probes matching the specified probe id]:probe-id' \ + '-I+[add include directory to preprocessor search path]:path:_directories' \ + '(-A -G -h -V)-l[list probes instead of enabling them]' \ + '-L+[add directory to search path for DTrace libraries]:path:_directories' \ + '*-m+[trace or list probes matching the specified module name]:module:->modules' \ + '*-n+[trace or list probes matching the specified probe name]:name:->probes' \ + '-o+[set output file]:output file:_files' \ + '-p+[grab specified process-ID and cache its symbol tables]:pid:_pids' \ + '*-P+[trace or list probes matching the specified provider name]:provider:->providers' \ + '-q[set quiet mode (only output explicitly traced data)]' \ + '*-s+[enable or list probes according to the specified D script]:script file:_files' \ + '-S[print D compiler intermediate code]' \ + '*-U+[undefine symbol when invoking preprocessor]:name' \ + '-v[set verbose mode (report program stability attributes)]' \ + '(-A -G -h -l)-V[report DTrace API version]' \ + '-w[permit destructive actions]' \ + '*-x+[enable or modify compiler and tracing options]: : _values option $xopts' \ + '-Z[permit probe descriptions that match zero probes]' && return + +if [[ -n $state ]]; then + local -a fields=( providers modules functions probes ) + local -a suf=( : : : ) + typeset -ga _cache_dtrace_probes + (( $#_cache_dtrace_probes )) || _cache_dtrace_probes=( + ${${${${(f)"$(_call_program dtrace-probes dtrace -l)"}[2,-1]}:#*[:[#]*}/(#b) #<-> #([^ ]#) #([^ ]#) #([^ ]#) ##([^ ]##)/${match[1]}:${match[3]:+$match[2]}:${match[3]:-$match[2]}:$match[4]} + ) # filtering out those containing : and [, they occur on macos but may just be unmangled forms and not directly usable + suf[${fields[(i)$state]}]=( "${compstate[quote][-1]} " ) # field matching the state gets a space suffix + while compset -P 1 '*:'; do + shift fields # each already listed field reduces one being possible + done + _tags dtrace-${^fields[1,(r)$state]} + while _tags; do + _requested dtrace-probes expl 'probe name' compadd -S "$suf[4]" - ${${(M)_cache_dtrace_probes:#((#s)|*:)${IPREFIX}[^:]#(#e)}##*:} && ret=0 + _requested dtrace-functions expl 'function' compadd -S "$suf[3]" - ${${${(M)_cache_dtrace_probes:#((#s)|*:)${IPREFIX}[^:]#:[^:]#(#e)}%:*}##*:} && ret=0 + _requested dtrace-modules expl 'module' compadd -S "$suf[2]" - ${${${(M)_cache_dtrace_probes:#((#s)|*:)${IPREFIX}[^:]#:[^:]#:[^:]#(#e)}#*:}%%:*} && ret=0 + _requested dtrace-providers expl 'provider' compadd -S "$suf[1]" - ${_cache_dtrace_probes%%:*} && ret=0 + (( ret )) || return 0 + done +fi + +return 1 diff --git a/Completion/Solaris/Command/_inetadm b/Completion/Solaris/Command/_inetadm index 0c8b14a4e..527cc5a71 100644 --- a/Completion/Solaris/Command/_inetadm +++ b/Completion/Solaris/Command/_inetadm @@ -1,16 +1,10 @@ #compdef inetadm -_inetadm() { - _arguments -s \ - '-?[help]' \ - '-l[list service instance properties]:FMRI:_svcs_fmri -i' \ - '-e[enable specified instance]:FMRI:_svcs_fmri -i' \ - '-d[disable specified instance]:FMRI:_svcs_fmri -i' \ - '-p[list inet service properties]' \ - '-m[modify service instance properties]:FMRI:_svcs_fmri -i' \ - '-M[modify inet service properties]' -} - -_inetadm "$@" - -# vi:tw=0 +_arguments -s \ + '-?[help]' \ + '-l[list service instance properties]:FMRI:_svcs_fmri -i' \ + '-e[enable specified instance]:FMRI:_svcs_fmri -i' \ + '-d[disable specified instance]:FMRI:_svcs_fmri -i' \ + '-p[list inet service properties]' \ + '-m[modify service instance properties]:FMRI:_svcs_fmri -i' \ + '-M[modify inet service properties]' diff --git a/Completion/Solaris/Command/_pfexec b/Completion/Solaris/Command/_pfexec index 2519c3cdc..e90f33222 100644 --- a/Completion/Solaris/Command/_pfexec +++ b/Completion/Solaris/Command/_pfexec @@ -22,11 +22,15 @@ _privset() { } _pfexec() { + local cmd cpp local -a _comp_priv_prefix - _arguments \ - '-P[privileges to acquire]:privspec:_privset' \ - '(-):command name: _command_names -e' \ - '*::arguments:{ _comp_priv_prefix=( pfexec ${(kv)opt_args[-P]} ) ; _normal }' + local -A opt_args + cmd="$words[1]" + cpp='_comp_priv_prefix=( $cmd ${(kv)opt_args[(I)-P]} )' + _arguments \ + '-P+[privileges to acquire]:privspec:_privset' \ + "(-): :{ $cpp; _command_names -e }" \ + "*:: :{ $cpp; _normal }" } _pfexec "$@" diff --git a/Completion/Solaris/Command/_prstat b/Completion/Solaris/Command/_prstat index 1eb38845c..a95919127 100644 --- a/Completion/Solaris/Command/_prstat +++ b/Completion/Solaris/Command/_prstat @@ -1,46 +1,41 @@ #compdef prstat -_prstat() -{ - local d_opt sort_key - d_opt=( - "u"\:"seconds past the epoch" - "d"\:"standard date format" - ) +local d_opt sort_key +d_opt=( + "u"\:"seconds past the epoch" + "d"\:"standard date format" +) - sort_key=( - "cpu"\:"process CPU usage (default)" - "pri"\:"process priority" - "rss"\:"resident set size" - "size"\:"size of process image" - "time"\:"process execution time" - ) +sort_key=( + "cpu"\:"process CPU usage" + "pri"\:"process priority" + "rss"\:"resident set size" + "size"\:"size of process image" + "time"\:"process execution time" +) - _arguments -A "-*" \ - '-a[information about processes and users]' \ - '-c[new reports below previous reports instead of overprinting them]' \ - '-C[processes or lwps that are bound to processor sets in the list]:processor set list:' \ - '-d[specify the representation of time]:time representation:(($d_opt))' \ - '-h[only processes or lwps whose home lgroup is in the list]:lgroup list:' \ - '-H[information about home lgroup]' \ - '-j[only processes or lwps whose project ID is in the given list]:project list:' \ - '-J[information about processes and projects]' \ - '-k[only processes or lwps whose task ID is in tasklist]:task list'\ - '-L[statistics for each light-weight process (LWP)]' \ - '-m[microstate process accounting information]' \ - '-n[restrict number of output lines]:ntop,[nbottom]' \ - '-p[only processes whose process ID is in the list]:PID list' \ - '-P[only processes or lwps which have most recently executed on a CPU in the list]:CPU list' \ - '-R[Put prstat in the real time scheduling class]' \ - '-s[Sort key (descending)]:key:(($sort_key))' \ - '-S[Sort key (ascending)]:key:(($sort_key))' \ - '-t[total usage summary for each user]' \ - '-T[information about processes and tasks]' \ - '-u[only processes whose effective user ID is in the list]:UID:_users' \ - '-U[only processes whose real user ID is in the list]:UID:_users' \ - '-v[verbose process usage]' \ - '-z[only processes or LWPs whose zone ID is in the list]:zone ID:' \ - '-Z[information about processes and zones]' -} - -_prstat "$@" +_arguments -A "-*" \ + '-a[information about processes and users]' \ + '-c[new reports below previous reports instead of overprinting them]' \ + '-C[processes or lwps that are bound to processor sets in the list]:processor set list' \ + '-d[specify the representation of time]:time representation:(($d_opt))' \ + '-h[only processes or lwps whose home lgroup is in the list]:lgroup list' \ + '-H[information about home lgroup]' \ + '-j[only processes or lwps whose project ID is in the given list]:project list' \ + '-J[information about processes and projects]' \ + '-k[only processes or lwps whose task ID is in tasklist]:task list'\ + '-L[statistics for each light-weight process (LWP)]' \ + '-m[microstate process accounting information]' \ + '-n[restrict number of output lines]:ntop,[nbottom]' \ + '-p[only processes whose process ID is in the list]:PID list' \ + '-P[only processes or lwps which have most recently executed on a CPU in the list]:CPU list' \ + '-R[put prstat in the real time scheduling class]' \ + '-s[sort key (descending)]:sort key [cpu]:(($sort_key))' \ + '-S[sort key (ascending)]:sort key [cpu]:(($sort_key))' \ + '-t[total usage summary for each user]' \ + '-T[information about processes and tasks]' \ + '-u[only processes whose effective user ID is in the list]:UID:_users' \ + '-U[only processes whose real user ID is in the list]:UID:_users' \ + '-v[verbose process usage]' \ + '-z[only processes or LWPs whose zone ID is in the list]:zone ID' \ + '-Z[information about processes and zones]' diff --git a/Completion/Solaris/Command/_svcadm b/Completion/Solaris/Command/_svcadm index c9826f2eb..22780d03f 100644 --- a/Completion/Solaris/Command/_svcadm +++ b/Completion/Solaris/Command/_svcadm @@ -1,78 +1,75 @@ #compdef svcadm -_svcadm() { - local curcontext="$curcontext" state line expl subcmds - typeset -A opt_args +local curcontext="$curcontext" state line expl subcmds +typeset -A opt_args - subcmds=( enable disable restart refresh mark delegate clear milestone ) +subcmds=( enable disable restart refresh mark delegate clear milestone ) - if [[ $service == "svcadm" ]]; then - _arguments -C -A "-*" \ - '-v[Print actions verbosely]' \ - '*::command:->subcmd' && return 0 +if [[ $service == "svcadm" ]]; then + _arguments -C -A "-*" \ + '-v[print actions verbosely]' \ + '*::command:->subcmd' && return 0 - if (( CURRENT == 1 )); then - _wanted commands expl 'svcadm subcommand' compadd -a subcmds - return - fi - service="$words[1]" - curcontext="${curcontext%:*}=$service:" - fi + if (( CURRENT == 1 )); then + _wanted commands expl 'svcadm subcommand' compadd -a subcmds + return + fi + service="$words[1]" + curcontext="${curcontext%:*}-$service:" +fi - case $service in - (enable) - _arguments -A "-*" \ - '-r[Recursively enable dependencies]' \ - '-s[Wait for service to come online]' \ - '-T[Timeout for -s]:seconds:' \ - '-t[State change is temporary]' \ - '*:instance FMRI:_svcs_fmri -i' - ;; +case $service in + (enable) + _arguments -A "-*" \ + '-r[recursively enable dependencies]' \ + '-s[wait for service to come online]' \ + '-T[timeout for -s]:timeout (seconds)' \ + '-t[state change is temporary]' \ + '*:instance FMRI:_svcs_fmri -i' + ;; - (disable) - _arguments -A "-*" \ - '-s[Wait for service to become disabled]' \ - '-T[Timeout for -s]:seconds:' \ - '-t[State change is temporary]' \ - '*:instance FMRI:_svcs_fmri -i' - ;; + (disable) + _arguments -A "-*" \ + '-s[wait for service to become disabled]' \ + '-T[timeout for -s]:timeout (seconds)' \ + '-t[state change is temporary]' \ + '*:instance FMRI:_svcs_fmri -i' + ;; - (mark) - _arguments -A "-*" \ - '-I[Change state immediately]' \ - "-s[Wait for service to reach the new state]" \ - '-T[Timeout for -s]:seconds:' \ - '-t[State change is temporary]' \ - ':state:(degraded maintenance)' \ - ':instance FMRI:_svcs_fmri -i' - ;; + (mark) + _arguments -A "-*" \ + '-I[change state immediately]' \ + "-s[wait for service to reach the new state]" \ + '-T[timeout for -s]:timeout (seconds)' \ + '-t[state change is temporary]' \ + ':state:(degraded maintenance)' \ + ':instance FMRI:_svcs_fmri -i' + ;; - (restart|refresh|clear) - _arguments \ - "-s[Wait for service to $service]" \ - '-T[Timeout for -s]:seconds:' \ - '*:instance FMRI:_svcs_fmri -i' - ;; + (restart|refresh|clear) + _arguments \ + "-s[wait for service to $service]" \ + '-T[timeout for -s]:timeout (seconds)' \ + '*:instance FMRI:_svcs_fmri -i' + ;; - (delegate) - _arguments -A "-*" \ - '-s[Wait for instances to come online]' \ - '-T[Timeout for -s]:seconds:' \ - ':restarter FMRI:_svcs_fmri -r' \ - '*:FMRI:_svcs_fmri -i' - ;; + (delegate) + _arguments -A "-*" \ + '-s[wait for instances to come online]' \ + '-T[timeout for -s]:timeout (seconds)' \ + ':restarter FMRI:_svcs_fmri -r' \ + '*:FMRI:_svcs_fmri -i' + ;; - (milestone) - _arguments -A "-*" \ - '-d[Make milestone the default]' \ - '-s[Wait for the transition to the new milestone]' \ - '-T[Timeout for -s]:seconds:' \ - '*:milestone FMRI:_svcs_fmri -m' - ;; + (milestone) + _arguments -A "-*" \ + '-d[make milestone the default]' \ + '-s[wait for the transition to the new milestone]' \ + '-T[timeout for -s]:timeout (seconds)' \ + '*:milestone FMRI:_svcs_fmri -m' + ;; - (*) - _message "unknown svcadm subcommand: $service" - esac -} - -_svcadm "$@" + (*) + _message "unknown svcadm subcommand: $service" + ;; +esac diff --git a/Completion/Solaris/Command/_svcprop b/Completion/Solaris/Command/_svcprop index 4a5436caf..19c65d3cf 100644 --- a/Completion/Solaris/Command/_svcprop +++ b/Completion/Solaris/Command/_svcprop @@ -1,26 +1,20 @@ #compdef svcprop -_svcprop() { - _arguments -s \ - '-f[designate properties by their FMRI]' \ - '-q[quiet]' \ - '-t[use multi-property output format]' \ - '-v[verbose]' \ - - set1 \ - '-w[waits for the selected property or property group to change]' \ - '-p[prints values of named property or property group]' \ - ':FMRI:_svcs_fmri -i' \ - - set2 \ - '-a[display all properties]' \ - '-g[group type filter]:group type:' \ - '*-l[properties from a layer]:layer:(admin site-profile system-profile manifest)' \ - '(-c -s)-C[retrieve properties without composition]' \ - '(-C -s)-c[retrieve properties with composition]' \ - '(-c -C)-s[retrieve properties from snapshot]:snapshot:' \ - '*-p[prints values of named property or property group]' \ - '*:FMRI:_svcs_fmri -i' -} - -_svcprop "$@" - -# vi:tw=0 +_arguments -s \ + '-f[designate properties by their FMRI]' \ + '-q[quiet]' \ + '-t[use multi-property output format]' \ + '-v[verbose]' \ + - set1 \ + '-w[wait for the selected property or property group to change]' \ + '-p[print values of named property or property group]' \ + ':FMRI:_svcs_fmri -i' \ + - set2 \ + '-a[display all properties]' \ + '-g[group type filter]:group type' \ + '*-l[properties from a layer]:layer:(admin site-profile system-profile manifest)' \ + '(-c -s)-C[retrieve properties without composition]' \ + '(-C -s)-c[retrieve properties with composition]' \ + '(-c -C)-s[retrieve properties from snapshot]:snapshot' \ + '*-p[print values of named property or property group]' \ + '*:FMRI:_svcs_fmri -i' diff --git a/Completion/Solaris/Command/_zlogin b/Completion/Solaris/Command/_zlogin index 74cbafe82..142114302 100644 --- a/Completion/Solaris/Command/_zlogin +++ b/Completion/Solaris/Command/_zlogin @@ -1,20 +1,16 @@ #compdef zlogin # Synced with the Nevada build 162 man page -_zlogin() { - local -a _comp_priv_prefix - _arguments -s \ - '-E[Disable escape character]' \ - '-e[Specify escape character]:character:' \ - '-l[Specify username]:username:_users' \ - ':zonename:_zones' \ - - set1 \ - '-C[Connect to zone console]' \ - '-d[Disconnect on zone halt]' \ - - set2 \ - '-S["Safe" login mode]' \ - '(-):command name: _command_names -e' \ - '*::utility: _normal' -} - -_zlogin "$@" +local -a _comp_priv_prefix +_arguments -s \ + '-E[disable escape character]' \ + '-e[specify escape character]:character' \ + '-l[specify username]:username:_users' \ + ':zonename:_zones' \ + - set1 \ + '-C[connect to zone console]' \ + '-d[disconnect on zone halt]' \ + - set2 \ + '-S["safe" login mode]' \ + '(-):command name: _command_names -e' \ + '*::utility: _normal' diff --git a/Completion/Solaris/Type/_svcs_fmri b/Completion/Solaris/Type/_svcs_fmri index ffade6985..b090461c5 100644 --- a/Completion/Solaris/Type/_svcs_fmri +++ b/Completion/Solaris/Type/_svcs_fmri @@ -66,18 +66,18 @@ _svcs_fmri() { # _wanted fmri expl "full or unambiguously abbreviated FMRIs" \ # _multi_parts -i / fmri_abbrevs - _wanted fmri expl "full or unambiguously abbreviated FMRIs" \ + _wanted fmri expl "full or unambiguously abbreviated FMRI" \ compadd $fmri_abbrevs ;; (-m) - _wanted fmri expl "milestone FMRIs" \ + _wanted fmri expl "milestone FMRI" \ compadd $(svcs -H -o fmri svc:/milestone/\*) all ;; (-r) # TODO: need some way to pick out only restarters - _wanted fmri expl "restarter FMRIs" \ + _wanted fmri expl "restarter FMRI" \ compadd master reset svc:/network/inetd:default ;; diff --git a/Completion/Unix/Command/_aap b/Completion/Unix/Command/_aap index 089a993c3..38e50f1fc 100644 --- a/Completion/Unix/Command/_aap +++ b/Completion/Unix/Command/_aap @@ -20,7 +20,7 @@ _arguments -C -s -S \ \*{-c,--command=}'[execute a command after reading the recipe]:aap command:' \ '(-k --continue)'{-k,--continue}'[continue building after an error]' \ '(-S --stop)'{-S,--stop}'[stop building at first error (default)]' \ - '(-N,--nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \ + '(-N --nofetch-recipe -R --fetch-recipe)'{-R,--fetch-recipe}'[fetch recipe file and child recipes]' \ '(-R --fetch-recipe -N --nofetch-recipe)'{-N,--nofetch-recipe}'[do not fetch recipes for "fetch" target]' \ '(-a --nocache)'{-a,--nocache}"[always download files, don't use the cache]" \ '(-l --local)'{-l,--local}'[do not recurse into subdirectories]' \ diff --git a/Completion/Unix/Command/_abcde b/Completion/Unix/Command/_abcde index 361b43091..3f748d373 100644 --- a/Completion/Unix/Command/_abcde +++ b/Completion/Unix/Command/_abcde @@ -1,50 +1,41 @@ #compdef abcde -(( $+functions[_abcde_fields] )) || -_abcde_fields(){ - _values -s , field year genre -} - -(( $+functions[_abcde_actions] )) || -_abcde_actions(){ - _values -s , action cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean -} - -_arguments -s \ +_arguments -s -S -A "-*" \ '(-t -T -p)-1[encode the whole CD in a single file]' \ - '-a[comma-delimited list of actions to perform]:action:_abcde_actions' \ + '-a[comma-delimited list of actions to perform]:action:_sequence compadd - cddb cue read getalbumart embedalbumart normalize encode tag move replaygain playlist clean' \ '-b[enable batch mode normalization]' \ '-B[enable automatic embedding of album art with certain containers]' \ - '-c[specify an additional configuration file to parse]:config:_files' \ - '-C[resume a session for discid when you no longer have the CD available]:discid' \ - '-d[CD-ROM block device that contains audio tracks to be read]:cd-rom-file:_files' \ + '-c+[specify an additional configuration file to parse]:config:_files' \ + '-C+[resume a session when read was completed but CD is not present]:disc id:compadd abcde.*(N:e)' \ + '-d+[specify CD device from which to read audio tracks]:CD device:_files -g "*(-%)" -P / -W /' \ '-D[capture debugging information]' \ '-e[erase information about encoded tracks from the internal status file]' \ '-f[force the removal of the temporary ABCDETEMPDIR directory]' \ "-g[enable lame's --nogap option]" \ '-G[download album art using the getalbumart function]' \ '(- :)-h[get help information]' \ - '-j[start a specified number of encoder processes at once]:number' \ + '-j+[start specified number of encoder processes at once]:number' \ '-k[keep the wav files after encoding]' \ - '-l[use the low-diskspace algorithm]' \ + '-l[use the low disk space algorithm]' \ '-L[use a local CDDB repository]' \ '-m[create DOS-style playlists, modifying the resulting one by adding CRLF line endings those to work]' \ "-n[don't query CDDB database]" \ '-N[non interactive mode]' \ - '-o[select output type]:outputtype:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \ + '-o+[select output type]:output type [vorbis]:(vorbis ogg mp3 flac spx mpc m4a wav wv ape opus mka aiff)' \ "-p[pads track numbers with 0's]" \ '-P[use Unix PIPES to read and encode in one step]' \ - '-r[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \ - '-s[fields to be shown in the CDDB parsed entries]:field:_abcde_fields' \ - '-S[set the speed of the CD drive]:speed' \ - '-t[start the numbering of the tracks at a given number]:track-number' \ - '-T[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \ + '-Q+[specify CD lookup methods]:lookup method [musicbrainz]:_sequence compadd - musicbrainz cddb cdtext' \ + '-r+[remote encode on this comma-delimited list of machines using distmp3]:hosts:_sequence _hosts' \ + '-s+[fields to be shown in the CDDB parsed entries]:field:_sequence compadd - year genre' \ + '-S+[set the speed of the CD drive]:speed' \ + '-t+[start the numbering of the tracks at a given number]:track-number' \ + '-T+[start the numbering of the tracks at a given number and change internal tag numbering]:track-number' \ '-U[set CDDBPROTO to version 5]' \ '(- :)-v[show the version and exit]' \ '-V[be more verbose]' \ '-x[eject the CD when all tracks have been read]' \ - '-X[use an alternative "cue2discid" implementation]:cue2discid' \ - '-w[add a comment to the tracks ripped from the CD]:comment' \ - "-W[concatenate CD's]:cd-number" \ + '-X+[use an alternative "cue2discid" implementation]:cue2discid:_command_names -e' \ + '-w+[add a comment to the tracks ripped from the CD]:comment' \ + "-W+[concatenate CD's]:cd-number" \ '-z[debug mode]' \ - '*:tracks:' + '*: :_guard "^-*" "track list"' diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack index e83a9330e..6dc3ab0d1 100644 --- a/Completion/Unix/Command/_ack +++ b/Completion/Unix/Command/_ack @@ -72,7 +72,7 @@ _arguments -C -s -S \ '(1)-g[print files where the relative path + filename matches the given pattern]:pattern to match against filenames' \ '--sort-files[sorts the found files lexically]' \ '--show-types[print the file types that ack associates with each file]' \ - '(--files-from -x)--files-from=[read the list of files to search from specified file]:files:_files' \ + '(--files-from -x)--files-from=[read the list of files to search from specified file]:file:_files' \ '(-x --files-from)-x[read the list of files to search from standard input]' \ '*--ignore-dir'{,ectory}'=[ignore directory]:directory:_directories' \ '*--noignore-dir'{,ectory}'=[remove directory from ignored list]:directory:_directories' \ @@ -86,7 +86,7 @@ _arguments -C -s -S \ '*--type-'{add,set}'=[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \ '*--type-del=[remove all filters associated with specified file type]: :->file-types' \ '(--env)--noenv[ignore environment variables and global ackrc files]' '!(--noenv)--env)' \ - '--ackrc=[specify an ackrc file to use]:files:_files' \ + '--ackrc=[specify an ackrc file to use]:file:_files' \ '--ignore-ack-defaults[ignore default definitions included with ack]' \ "${ign}(- 1 *)--create-ackrc[output an ackrc based on customizations]" \ "${ign}(- 1 *)"{-\?,--help}'[display usage information]' \ diff --git a/Completion/Unix/Command/_adb b/Completion/Unix/Command/_adb index 75a447dfc..8a071fa8e 100644 --- a/Completion/Unix/Command/_adb +++ b/Completion/Unix/Command/_adb @@ -43,6 +43,7 @@ _adb() { "disconnect" "emu" "enable-verity" + "exec-out" "forward" "get-devpath" "get-serialno" @@ -81,11 +82,12 @@ _adb() { if ! adb ${ADB_DEVICE_SPECIFICATION} shell exit 2>/dev/null; then # early bail-out until a single valid device/emulator is specified and up-and-running [[ $words[CURRENT-1] = -s ]] || _message -r "No (started) device specified, completions do not yet work" + #TODO handle -t transport-id _arguments \ '-s[serial]: :_adb_device_serial' \ '( -e)-d[device]' \ '(-d )-e[emulator]' \ - '1:options:_adb_options_handler' \ + '1:option:_adb_options_handler' \ '*: : _default' return @@ -109,7 +111,7 @@ _adb_dispatch_command () { fi case ${curcontext} in - (*:adb-shell:) + (*:adb-shell:|*:adb-exec-out:) (( $+functions[_adb_dispatch_shell] )) && _adb_dispatch_shell ;; (*:adb-backup:) @@ -141,7 +143,7 @@ _adb_dispatch_command () { '(-d -e)-s[serial]: :_adb_device_serial' \ '(-s -e)-d[device]' \ '(-d -s)-e[emulator]' \ - '*:options:_adb_options_handler' + '*:option:_adb_options_handler' ;; esac } @@ -164,18 +166,16 @@ _adb_sanitize_context () { (( $+functions[_adb_device_specification] )) || _adb_device_specification () { - local -a word - word=($words[(R)-[des]]) - if [[ $words[(R)-s] == -s ]]; then - local i=$words[(I)-s] - word=($words[i,i+1]) + if [[ $words[2] == -[de] ]]; then + ADB_DEVICE_SPECIFICATION=($words[2]) + elif [[ $words[2] == -[st] ]]; then + ADB_DEVICE_SPECIFICATION=($words[2,3]) fi - ADB_DEVICE_SPECIFICATION=($word) } (( $+functions[_adb_dispatch_shell] )) || _adb_dispatch_shell () { - if [[ ${#words} -le 2 ]] + if [[ $CURRENT -le 2 ]] then (( $+functions[_adb_shell_commands_handler] )) && _adb_shell_commands_handler return @@ -188,6 +188,15 @@ _adb_dispatch_shell () { (pm) (( $+functions[_adb_package_manager_handler] )) && _adb_package_manager_handler ;; + (cmd) + (( $+functions[_adb_cmd_handler] )) && _adb_cmd_handler + ;; + (dumpsys) + (( $+functions[_adb_dumpsys_handler] )) && _adb_dumpsys_handler + ;; + (start|stop) + (( $+functions[_adb_startstop] )) && _adb_startstop ${words[2]} + ;; (*) _arguments '*: :_adb_remote_folder' ;; @@ -262,7 +271,7 @@ _adb_intent_handler () { (( $+functions[_adb_activity_manager_handler] )) || _adb_activity_manager_handler () { - if [[ ${#words} -le 3 ]] + if [[ $CURRENT -le 3 ]] then _wanted am_argument expl 'am argument' compadd start startservice broadcast instrument profile return @@ -318,6 +327,79 @@ _adb_package_manager_handler () { esac } +(( $+functions[_adb_cmd_handler] )) || +_adb_cmd_handler () { + local -a cmds + cmds=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out cmd -l)"}[2,-1]}##[[:space:]]##}) + _wanted dumpsys expl 'cmd command' compadd ${cmds%$'\r'} +} + +(( $+functions[_adb_dumpsys_handler] )) || +_adb_dumpsys_handler () { + if [[ $CURRENT -eq 3 ]]; then + local -a services + services=(${${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys -l)"}[2,-1]}##[[:space:]]##}) + _wanted dumpsys expl 'dumpsys service' compadd - ${services%$'\r'} + elif [[ $CURRENT -ge 4 && $words[3] == SurfaceFlinger ]]; then + (( CURRENT -= 2 )) + shift 2 words + typeset -A opt_args + local context state state_descr line + _arguments -R \ + '--file[start/stop continuous dumpsys to file]' \ + '--no-limit[disable wrapping around continuous dumpsys at ~20MB]' \ + '--full-dump[set fullDump = true]' \ + '--allocated_buffers[show allocated buffers dump]' \ + '--display-id[show display id dump]' \ + '--dispsync[show dispsync dump]' \ + '--edid[raw edid dump for specified hwc display (binary output)]:*:hwc display:->hwcdisplay' \ + '--latency[show latency stats]:*:layer:->layer' \ + '--latency-clear[clear latency stats]:*:layer:->layer' \ + '--list[list all layers]' \ + '--planner[pass planner dump arguments]:*:planner arguments:->planner' \ + '--static-screen[show static screen stats]' \ + '--timestats[pass time stats arguments]:*:timestats arguments:->timestats' \ + '--vsync[show vsync dump]' \ + '--wide-color[show wide color info]' \ + '--frametimeline[pass frametimeline arguments]:*:frametimeline arguments:->frametimeline' \ + '--mini[show mini dump]' + if [[ $? == 300 ]]; then + case $state in + layer) + typeset -a layers + layers=(${${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out dumpsys SurfaceFlinger --list)"}[2,-1]}) + _wanted dumpsys expl 'layers' compadd - ${layers%$'\r'} + ;; + planner) + _arguments \ + {--compare,-c}'[compare predictions of two hashes]:left: :right: :' \ + {--describe,-d}'[describe hash]:hash: :' \ + {--help,-h}'[help]' \ + {--similar,-s}'[show similar stacks matching given plan]:plan: :' \ + {--layers,-l}'[show current layers]' + ;; + timestats) + _arguments -disable -enable -clear -dump -maxlayers'[only with -dump]:int:' + ;; + frametimeline) + _arguments -jank -all + ;; + esac + fi + fi +} + +(( $+functions[_adb_startstop] )) || +_adb_startstop () { + local -a services + local -A service_status + services=(${(f)"$(adb ${ADB_DEVICE_SPECIFICATION} exec-out getprop)"}) + service_status=( ${(s,: ,)${(j,: ,)${(M)services:#\[init.svc.*}}} ) + local -A map=(start stopped stop running) + services=( ${(k)service_status[(R)*$map[$1]*]} ) + _wanted services expl "$map[$1] services" compadd - ${${${services#\[}%\]}#init.svc.} +} + (( $+functions[_adb_dispatch_uninstall] )) || _adb_dispatch_uninstall () { _arguments \ @@ -344,12 +426,12 @@ _adb_dispatch_install () { (( $+functions[_adb_dispatch_push] )) || _adb_dispatch_push () { - if [[ ${#words} -gt 3 ]] + if [[ $CURRENT -gt 3 ]] then _message -r "Notice: you can only push a single item at a time" return fi - if [[ ${#words} -gt 2 ]] + if [[ $CURRENT -gt 2 ]] then _arguments '*: :_adb_remote_folder' else @@ -359,12 +441,12 @@ _adb_dispatch_push () { (( $+functions[_adb_dispatch_pull] )) || _adb_dispatch_pull () { - if [[ ${#words} -gt 3 ]] + if [[ $CURRENT -gt 3 ]] then _message -r "Notice: you can only pull a single item at a time" return fi - if [[ ${#words} -gt 2 ]] + if [[ $CURRENT -gt 2 ]] then _arguments '*:local file/folder:_files' else @@ -392,7 +474,7 @@ _adb_check_log_redirect () { (( $+functions[_adb_trace_opts] )) || _adb_trace_opts() { - _values -s , 'adb trace options' \ + _values -s , 'adb trace option' \ '(1 adb sockets packets rwx usb sync sysdeps transport jdwp)all' \ '(all adb sockets packets rwx usb sync sysdeps transport jdwp)1' \ 'adb' \ @@ -411,14 +493,16 @@ _adb_device_serial() { local expl local -a devices device_desc local device - devices=( $(adb devices -l | sed -n 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') ) + devices=( $(adb devices -l | sed -n -e 's/:/\\:/' -e 's/^\([^[:space:]]*\)[[:space:]]*.*product:\([^[:space:]]*\).*$/\1:\2/p') ) zstyle -a :completion:${curcontext} device-names device_desc for device in $device_desc; do if [[ -n $devices[(r)${device%:*}:*] ]]; then devices[(i)${device%:*}:*]=$device + elif [[ -n $devices[(r)*:${device%:*}] ]]; then + devices[(i)*:${device%:*}]=${${devices[(r)*:${device%:*}]}%:*}:${device#*:} fi done - _describe -t dev_serial 'available devices' devices + _describe -t dev_serial 'available device' devices } (( $+functions[_adb_logcat_filter_specification] )) || @@ -446,8 +530,8 @@ _adb_dispatch_logcat() { _arguments \ '(-c -g)-s[set default filter to silent]' \ '(-c -g)-f[log output to file (defaults to stdout)]:logfile:_files' \ - '(-c -g -d)-r[rotate log every kbytes (default 16, requires -f)]:logsize:_guard "[0-9]#" "numeric value"' \ - '(-c -g -d)-n[max number of rotated logs (default 4)]:number :_guard "[0-9]#" "numeric value"' \ + '(-c -g -d)-r[rotate log at specified size, requires -f]:log size (kbytes) [16]' \ + '(-c -g -d)-n[specify max number of rotated logs]:number [4]' \ '(-c -g -d)-v[log format]:format: _values "format" brief process tag thread raw time threadtime long' \ '(-d -t -g)-c[clear log]' \ '(-c -g)-d[dump log]' \ @@ -459,13 +543,13 @@ _adb_dispatch_logcat() { (( $+functions[_adb_options_handler] )) || _adb_options_handler() { local expl - _wanted adb_options expl 'adb options' compadd "${ALL_ADB_COMMANDS[@]}" + _wanted adb_options expl 'adb option' compadd "${ALL_ADB_COMMANDS[@]}" } (( $+functions[_adb_shell_commands_handler] )) || _adb_shell_commands_handler() { local expl - _wanted adb_shell_commands expl 'adb shell commands' compadd ls pm am mkdir rmdir rm cat + _wanted adb_shell_commands expl 'adb shell command' compadd ls pm am mkdir rmdir rm cat cmd dumpsys start stop } (( $+functions[_adb_device_available] )) || @@ -514,7 +598,7 @@ _adb_installed_packages() { _adb_users() { local -a users users=( ${${${(M)${(f)"$(adb shell pm list users)"}:#*UserInfo*}#*UserInfo\{}%:*} ) - _describe -t users 'users' users + _describe -t users 'user' users } (( $+functions[_adb_cache_policy_single_command] )) || diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index f1e13a813..2d976b0a0 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -1,7 +1,7 @@ -#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default- +#compdef ansible ansible-config ansible-console ansible-doc ansible-galaxy ansible-inventory ansible-playbook ansible-pull ansible-vault -value-,ANSIBLE_STDOUT_CALLBACK,-default- -value-,ANSIBLE_INVENTORY_ENABLED,-default- -local curcontext="$curcontext" plug plugvar ign ret=1 -local -a args state line +local curcontext="$curcontext" plug plugvar subcmd ign ret=1 +local -a args state line expl gactions local -A opt_args case $service in @@ -9,6 +9,10 @@ case $service in plug=callback state=plugins ;; + *,ANSIBLE_INVENTORY_ENABLED,*) + plug=inventory + state=plugins + ;; ansible|ansible-console|ansible-doc|ansible-playbook) args=( \*{-M+,--module-path=}'[specify path to modules]:module path:_dir_list' @@ -18,6 +22,8 @@ case $service in args+=( '(-K --ask-become-pass)'{-K,--ask-become-pass}'[ask for privilege escalation password]' '(-k --ask-pass)'{-k,--ask-pass}'[ask for connection password]' + '--list-hosts[output list of matching hosts]' + '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' '(-T --timeout)'{-T+,--timeout=}'[override the connection timeout]:timeout (seconds) [10]' '(-c --connection)'{-c+,--connection=}'[specify connection type]:connection type [smart]:->connect-types' '(-u --user)'{-u+,--user=}'[specify remote user for connection]:remote user:_users' @@ -40,31 +46,17 @@ case $service in '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' ) ;| - ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault) - args+=( - '--ask-vault-pass[ask for vault password]' - '--vault-id=[specify vault identity to use]:vault identity' - '--vault-password-file=[specify vault password file]:vault password file:_files' - ) - ;| ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) args+=( + --ask-vault-pass{,word}'[ask for vault password]' + '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' + '--vault-id=[specify vault identity to use]:vault identity' + --vault-pass{,word}-file='[specify vault password file]:vault password file:_files' \*{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files" "hosts\:host\: _sequence _hosts"' '!(-i --inventory)--inventory-file=:inventory file:_files' ) ;| - ansible|ansible-console|ansible-playbook|ansible-pull) - args+=( - '--list-hosts[output list of matching hosts]' - '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' - ) - ;| - ansible|ansible-playbook|ansible-pull) - args+=( - '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' - ) - ;| ansible|ansible-console|ansible-inventory) args+=( '--playbook-dir=[specify substitute playbook directory]:directory:_directories' @@ -72,15 +64,20 @@ case $service in ;| ansible-playbook|ansible-pull) args+=( - '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' + '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]:tag:->tags' "--skip-tags[only run plays and tasks whose tags don't match]" ) ;| + ansible|ansible-console) + args+=( + '--task-timeout[set the task timeout limit]:timeout (seconds)' + ) + ;| ansible) args+=( '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args' '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)' - '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' + '(-m --module-name)'{-m+,--module-name=}'[specify action to execute]: :->plugins' '(-o --one-line)'{-o,--one-line}'[condense output]' '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]' '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories' @@ -106,11 +103,15 @@ case $service in ;; ansible-doc) args+=( - '!(-l --list -F --list_files -s --snippet)'{-j,--json} # "internal testing only" - '(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]' - '(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]' - '(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' - '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup shell module strategy vars)' + '!--metadata-dump' # "internal testing only" + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-j,--json}'[change output to json format]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-l,--list}'[list available plugins]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-F,--list_files}'[show plugin names and their source files without summaries]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-s,--snippet}'[show playbook snippet for specified plugins]' + '(-l --list -F --list_files -s --snippet -e --entry-point)--metadata-dump[dump json metadata for all plugins]' + '(-l --list -F --list_files -s --snippet --metadata-dump -e --entry-point)'{-e+,--entry-point=}'[select the entry point for roles]:entry point' + '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(become cache callback cliconf connection httpapi inventory lookup netconf shell vars module strategy role keyword)' + '(-r --roles-path)'{-r+,--roles-path=}'[specify directory containing roles]:directory:_directories' '*:plugin:->plugins' ) ;; @@ -124,15 +125,16 @@ case $service in '(-y --yaml --vars --graph)--toml[use TOML format instead of JSON]' '(-y --yaml)--vars[add variables to the graph display]' '(-y --yaml --toml --vars --graph)'{-y,--yaml}'[use YAML format instead of JSON]' + ':host or group:->hosts' ) ;; ansible-galaxy) - args+=( -A "-*" $args + args=( -A "-*" $args '--list[list integrations]' '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' '(-s --server)'{-s+,--server=}'[specify API server destination]:server destination' '--remove=[remove integration]:integration id' - '1:action:(delete import info init install list login remove search setup)' + '::type:(collection role)' '*::args:->galaxy' ) ;; @@ -154,7 +156,7 @@ case $service in '(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories' '--full[do a full instead of a shallow clone]' '(-m --module-name)'{-m+,--module-name=}'[specify repository module used for checking out repository]:module:(git subversion hg bzr)' - '--accept-host-key[adds the hostkey for the repo url if not already added]' + '--accept-host-key[add the hostkey for the repo url if not already added]' '--purge[purge checkout after playbook run]' '(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]' '(-C --checkout)'{-C,--checkout}'[specify branch/tag/commit to checkout]:branch/tag/commit' @@ -168,9 +170,7 @@ case $service in ;; ansible-vault) args=( -A "-*" $args - '::action:(create decrypt edit encrypt encrypt_string rekey view)' - '--new-vault-id=[specify new vault identity to use for rekey]:vault id' - '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' + '::action:compadd -M "r:|_=* r:|=*" - create decrypt edit encrypt encrypt_string rekey view' '*::args:->vault' ) ;; @@ -225,34 +225,82 @@ case $state in if zstyle -T ":completion:${curcontext}:plugins" verbose; then (( ${(P)#plugvar} )) || set -A ${plugvar} \ ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:} - _describe -t plugins "${plug} plugin" $plugvar && ret=0 + _describe -t plugins "${plug} plugin" $plugvar -M 'r:|.=* r:|=*' && ret=0 else (( ${(P)#plugvar} )) || set -A ${plugvar} \ ${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *} - _wanted plugins expl "${plug} plugin" compadd -a $plugvar && ret=0 + _wanted plugins expl "${plug} plugin" compadd -M 'r:|.=* r:|=*' -a $plugvar && ret=0 fi ;; + tags) + # The recursive glob here is questionable and perhaps there should be a style. + _sequence _wanted tags expl tag compadd - \ + ${(s.,.)${(j.,.)${(M)${(f)"$(cat **/*.yml)"}:# #tags:*}#*: }} && ret=0 + ;; galaxy) ign='' - curcontext="${curcontext%:*}-${line[1]}:" - (( $#words > 2 )) && ign='!' + gactions=( delete import info init install list remove search setup ) + case ${(j.:.)line[1,3]} in + (role|collection):*:*) + subcmd="${line[1]}-${line[2]}" + ;; + collection:*) + gactions=( init build publish install ) + subcmd=collection + ;; + role:*) subcmd=role ;; + *:*) subcmd="role-${line[1]}" ;& + [^:]#) + words=( role "$words[@]" ) + (( CURRENT++ )) + ;; + esac + curcontext="${curcontext%:*}-${subcmd}:" + (( $#words > 3 )) && ign='!' args=( "${ign}(-)"{-h,--help}'[display usage information]' - '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' - '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts' - {-v,--verbose}'[verbose mode]' + '1: :{ _wanted actions expl action compadd -a gactions }' ) - case $line[1] in - info|search|list|remove|install) + case $subcmd in + *-*) + args+=( + '(-c --ignore-certs)'{-c,--ignore-certs}'[ignore SSL certificate validation errors]' + '(-s --server)'{-s+,--server=}'[specify API server destination]:server:_hosts' + --{token,api-key}='[specify ansible galaxy API key]:api key' + \*{-v,--verbose}'[verbose mode]' + ) + ;| + role-setup) # order important here, source comes before github args + args+=( ': :_guard "^-*" "source"' '*:secret' ) + ;| + role-(delete|import|setup)) + args+=( ': :_guard "^-*" "github username"' ':github repository' ) + ;| + role-(info|init|install|list|remove)) + args+=( '*: :_guard "^-*" "role name"' ) + ;| + role-(info|search|list|remove|install)) args+=( '(-p --roles-path)'{-p,--roles-path}'[specify location of roles]:path:_directories' ) ;| - info|init) + role-(info|init)) args+=( "--offline[don't query the galaxy API]" ) ;| - init|install) - args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role]' ) + *-(init|build|install)) + args+=( '(-f --force)'{-f,--force}'[force overwriting an existing role or collection]' ) ;| - search) + *-install) + args+=( + '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role/collection]' + '(-n --no-deps)'{-n,--no-deps}"[don’t download roles/collections listed as dependencies]" + "--force-with-deps[force overwriting an existing role/collection and it's dependencies]" + ) + ;| + *-init) + args+=( + '--init-path=[specify path in which the skeleton will be created]:path:_directories' + ) + ;| + role-search) args+=( '--author=[specify GitHub username]:username' '--galaxy-tags=[specify list of galaxy tags to filter by]:galaxy tags' @@ -260,29 +308,25 @@ case $state in '*: :_guard "^-*" "search term"' ) ;; - setup) + role-setup) args+=( '--list[list integrations]' '--remove=[remove integration]:integration id' ) ;; - init) + role-init) args+=( - '--init-path=[specify path in which the skeleton role will be created]:path:_directories' - '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]' + '--role-skeleton=[specify path to a role skeleton that the new role should be based upon]:path:_files' '--type=[initialize using an alternate role type]:role type:(container apb network)' ) ;; - install) + role-install) args+=( - "--force-with-deps[force overwriting an existing role and it's dependencies]" - '(-n --no-deps)'{-n,--no-deps}"[don’t download roles listed as dependencies]" - '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors and continue with the next specified role]' '(-g --keep-scm-meta)'{-g,--keep-scm-meta}'[use tar instead of the scm archive option when packaging the role]' '(-r --role-file)'{-r+,--role-file=}'[specify file containing a list of roles to be imported]:file:_files' ) ;; - import) + role-import) args+=( '--status[check the status of the most recent import request for given github_user/github_repo]' "--no-wait[don’t wait for import results]" @@ -290,34 +334,70 @@ case $state in '--role-name=[specify name the role should have]:role' ) ;; - login) + collection-build) + args+=( + '--output-path=[specify path in which the collection is built to]:path [.]:_directories' + '*:collection directory to build:_directories' + ) + ;; + collection-init) args+=( - '--github-token=[identify with github token rather than username and password]' + '--collection-skeleton=[specify path to a collection skeleton that the new role should be based upon]:path:_files' + ': :_guard "^-*" "collection name"' ) ;; + collection-publish) + args+=( + "--no-wait[don't wait for import validation results]" + '--import-timeout=[specify time to wait for import process]:time' + ':collection tarball:_files' + ) + ;; + collection-install) + args+=( + '(-p --collections-path)'{-p+,--collections-path=}'[specify directory containing collections]:_directories' + '(-r --requirements-file *)'{-r+,--requirements-file=}'[specify file containing a list of collections to install]:file:_files' + '--pre[include pre-release versions]' + '*:collection name:_files' + ) + ;; esac - _arguments -s -S $args && ret=0 + _arguments -s -S : $args && ret=0 ;; vault) + ign='' curcontext="${curcontext%:*}-${line[1]}:" - args=() + (( $#words > 2 )) && ign='!' + args=( + "${ign}(-)"{-h,--help}'[display usage information]' + --ask-vault-pass{,word}'[ask for vault password]' + '--vault-id=[specify vault identity to use]:vault identity' + --vault-pass{,word}-file='[specify vault password file]:vault password file:_files' + \*{-v,--verbose}'[verbose mode]' + ) case $line[1] in - encrypt*|edit|rekey) + create|(de|en)crypt*|edit|rekey) args+=( '--encrypt-vault-id=[specify vault id to use to encrypt (required if more than one vault-id is provided)]:vault id' ) ;| - (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;| + (de|en)crypt*) args+=( '--output=[specify output file name]:file:_files' ) ;| encrypt_string) args+=( '(-p --prompt)'{-p,--prompt}'[prompt for the string to encrypt]' + "--show-input[don't hide input when prompted for the string to encrypt]" '(-n --name)'{-n+,--name=}'[specify the variable name]:variable' '--stdin-name=[specify the variable name for stdin]:variable' ) ;| create|edit|rekey|view) args+=( ':file:_files' ) ;| - (en|de)crypt) args+=( '::file:_files' ) - ;; + decrypt|rekey) + args+=( + '--new-vault-id=[specify new vault identity to use]:vault identity' + '--new-vault-password-file=[specify new vault password file]:vault password file:_files' + ) + ;| + (en|de)crypt) args+=( '::file:_files' ) ;; esac _arguments -s -S $args && ret=0 ;; diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 080ce6857..7401c7449 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -56,7 +56,7 @@ _arguments -C \ '-propertyfile[load all properties from specified file with -D properties taking precedence]:property file:_files -g "*.properties(-.)"' \ '-inputhandler[specify class which will handle input requests]:class:->class' \ '(-s -find -f -file -buildfile)'{-s,-find}'[search for specified build file towards the root of filesystem]:build file:(build.xml)' \ - '-nice[specify a niceness value for the main thread]:niceness value (default 5):({1..10})' \ + '-nice[specify a niceness value for the main thread]:niceness value [5]:({1..10})' \ '-nouserlib[run ant without using the jar files from ${user.home}/.ant/lib]' \ '-noclasspath[run ant without using CLASSPATH]' \ '-autoproxy[Java1.5+: use the OS proxy settings]' \ diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 389f1099b..7727de28c 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -61,7 +61,7 @@ case $OSTYPE in openbsd*) args+=( '(-a -d -W)-F[overwrite existing entries]' - '(-W)-V+[select the routing domain]:routing domain' + '(-W)-V+[select the routing domain]:routing domain:_routing_domains' ) cmds+=( '(- 1)-W[send the wake on LAN frame]' diff --git a/Completion/Unix/Command/_attr b/Completion/Unix/Command/_attr index 121c0c539..efa7c5c4f 100644 --- a/Completion/Unix/Command/_attr +++ b/Completion/Unix/Command/_attr @@ -23,6 +23,7 @@ case $service in '(-e --encoding)'{-e+,--encoding=}'[encode values after retrieving them]:encoding:(text hex base64)' \ '(-h --no-dereference)'{-h,--no-dereference}"[don't follow symbolic links]" \ '(-m --match)'{-m+,--match=}'[only include attributes with names matching regex]:regular expression' \ + '--one-file-system[skip files on different filesystems]' \ "--absolute-names[don't strip leading slash characters]" \ '--only-values[dump only attribute values]' \ '(-R --recursive)'{-R,--recursive}'[list attributes of all files and directories recursively]' \ diff --git a/Completion/Unix/Command/_awk b/Completion/Unix/Command/_awk index dcb2a6c21..e8f4a2530 100644 --- a/Completion/Unix/Command/_awk +++ b/Completion/Unix/Command/_awk @@ -1,6 +1,6 @@ #compdef awk gawk nawk -# For gawk ver.3 and 4, in addition to POSIX. +# For gawk ver.3 to 5, in addition to POSIX. # # gawk's options '-W ...' (such as '-W help') are not supported. # gawk3 has some synonyms for long options (e.g., --compat is a synonym @@ -14,7 +14,7 @@ local variant curcontext="$curcontext" state state_descr line ret=1 local -A opt_args local -a args -_pick_variant -r variant gawk4='GNU Awk 4' gawk3='GNU Awk 3' posix --version +_pick_variant -r variant gawk4='GNU Awk [45]' gawk3='GNU Awk 3' posix --version args=( {-F+,--field-separator}'[define input field separator by extended regex]:extended regular expression:' diff --git a/Completion/Unix/Command/_baz b/Completion/Unix/Command/_baz index 6787f41e2..0acdc4639 100644 --- a/Completion/Unix/Command/_baz +++ b/Completion/Unix/Command/_baz @@ -38,8 +38,8 @@ _baz_revisions () { _arch_namespace baz 4 "$argv[@]" } (( $+functions[_baz_local_revisions] )) || _baz_local_revisions () { local expl1 expl2 tree_version=`$BAZ tree-version` - _description -V applied-patches expl1 "patches from this version" - _description -V other-patches expl2 "patches from other versions" + _description -V applied-patches expl1 "patch from this version" + _description -V other-patches expl2 "patch from other versions" compadd "$expl1[@]" `$BAZ logs` compadd "$expl2[@]" `$BAZ logs --full $($BAZ log-versions | grep -v $tree_version)` # This is incredibly slow. @@ -64,7 +64,7 @@ _baz_config () { if [[ -d "$root/configs" ]]; then configdir=("$root/configs") - _description files expl '%Bconfig file%b' + _description files expl 'config file' _files -W configdir "$expl[@]" && ret=0 else _message -e messages "No configs/ directory in tree whose root is $root" @@ -82,7 +82,7 @@ _baz_limit () { #presently only does push-mirror style limits if [[ $PREFIX != *--* ]]; then _description -V categories expl "categories in $archive" - compadd -q -S -- "$expl[@]" `$BAZ categories $archive` + compadd -q -S -- "$expl[@]" `$BAZ category $archive` else _baz_namespace_branches 3 fi @@ -98,7 +98,7 @@ _baz_tree_or_rev () { _baz_libraries () { local libraries expl libraries=($(_call_program baz $BAZ my-revision-library)) - _description -V libraries expl "revision libraries" + _description -V libraries expl "revision library" compadd "$expl[@]" -a libraries } @@ -115,7 +115,7 @@ _baz_my_revision_library () { _baz_log_versions () { local logs expl logs=($(_call_program baz $BAZ log-versions)) - _description -V versions expl "log versions" + _description -V versions expl "log version" compadd "$expl[@]" -a logs } @@ -238,12 +238,12 @@ methods=( cmd_tagging_method=($cmd_id_tagging_method) local cmd_add cmd_add_id cmd_add_tag -cmd_add=('*:files to add:_files') +cmd_add=('*:file to add:_files') cmd_add_id=($cmd_add) cmd_add_tag=($cmd_add) local cmd_delete cmd_delete_id cmd_delete_tag -cmd_delete=('*:files to delete:_files') +cmd_delete=('*:file to delete:_files') cmd_delete_id=($cmd_delete) cmd_delete_tag=($cmd_delete) @@ -272,7 +272,7 @@ cmd_changeset=( ':ORIG:_files -/' ':MOD:_files -/' ':DEST:_files -/' - '*:files:_files' + '*:file:_files' ) cmd_mkpatch=("$cmd_changeset[@]") @@ -288,7 +288,7 @@ local cmd_make_archive cmd_make_archive=('::name:' ':location:_files -/') local cmd_archive_setup -cmd_archive_setup=('*:versions:_baz_branches --trailing-dashes') +cmd_archive_setup=('*:version:_baz_branches --trailing-dashes') local cmd_make_category cmd_make_category=(':category:_baz_archives -S /') @@ -304,7 +304,7 @@ cmd_import=('::version:_baz_versions') cmd_imprev=($cmd_import) local cmd_commit cmd_cmtrev -cmd_commit=('*:files:_files') +cmd_commit=('*:file:_files') cmd_cmtrev=($cmd_commit) local cmd_get cmd_getrev @@ -573,7 +573,7 @@ _baz_main () { local -U cmds help=(${(f)"$($BAZ help)"}) cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #}) - arguments=(':commands:(($cmds))') + arguments=(':command:(($cmds))') fi _arguments -S -A '-*' \ {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \ diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent index 1f305a1c0..1fbab35ef 100644 --- a/Completion/Unix/Command/_bittorrent +++ b/Completion/Unix/Command/_bittorrent @@ -69,7 +69,7 @@ case $service in '--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \ "--comment+[specify human-readable comment to put in .torrent]:comment:"\ "--target+[specify target file for the torrent]:file:_files"\ - ':file:_files -g "*"' + ':file:_files' return ;; diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython index 233e032e6..2c2ea11b8 100644 --- a/Completion/Unix/Command/_bpython +++ b/Completion/Unix/Command/_bpython @@ -41,6 +41,3 @@ case "$service" in "$gtk_opts[@]" ;; esac - - -# vim:autoindent expandtab shiftwidth=2 tabstop=2 softtabstop=2 filetype=zsh diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr index 1b755b4ec..121c28166 100644 --- a/Completion/Unix/Command/_bzr +++ b/Completion/Unix/Command/_bzr @@ -65,7 +65,7 @@ case $cmd in '--no-recurse[do not recurse into subdirectories]' '(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]' '(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]' - '*:unknown files:_bzr_unknownFiles' + '*:unknown file:_bzr_unknownFiles' ) ;; @@ -74,7 +74,7 @@ case $cmd in '--all[show annotations on all lines]' '--long[show date in annotations]' '(-r --revision)'{--revision=,-r}'[the revision to show]:rev:' - '*:files:_bzr_versionedFiles' + '*:file:_bzr_versionedFiles' ) ;; @@ -100,7 +100,7 @@ case $cmd in (rename|move|mv) if (( CURRENT == 2 )); then - args+=( '*:files:_bzr_versionedFiles' ) + args+=( '*:file:_bzr_versionedFiles' ) else args=( '*:destination dir:_files -/' ) fi @@ -218,7 +218,7 @@ case $cmd in '--unchanged[include unchanged files]' '(-q --quiet -v --verbose)'{--quiet,-q}'[be quiet]' '(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]' - '*:modified files:_bzr_modifiedFiles' + '*:modified file:_bzr_modifiedFiles' ) ;; @@ -229,7 +229,7 @@ case $cmd in '--all[shelve all changes]' '(-q --quiet)'{--quiet,-q}'[be quiet]' '(-v --verbose)'{--verbose,-v}'[display more information]' - '*:modified files:_bzr_modifiedFiles' + '*:modified file:_bzr_modifiedFiles' ) ;; @@ -279,7 +279,7 @@ case $cmd in '(-r --revision)'{--revision=,-r}'[revision]:revision:' '--diff-options=[options to pass to gdiff]:diff options:' '(-p --prefix)'{--prefix,-p}'[set prefix added to old and new filenames]' - '*:files:_files' + '*:file:_files' ) ;; @@ -376,7 +376,7 @@ case $cmd in args+=( '--all[show annotations on all lines]' "--plain[don't highlight annotation lines]" - '*:files:_bzr_versionedFiles' + '*:file:_bzr_versionedFiles' ) ;; diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod index 3f6db7e91..42e3fa63b 100644 --- a/Completion/Unix/Command/_chmod +++ b/Completion/Unix/Command/_chmod @@ -1,7 +1,10 @@ #compdef chmod gchmod zf_chmod local curcontext="$curcontext" state line expl ret=1 variant -local -a args privs aopts=( -A '-*' ) +local -a args privs aopts + +# usual -* pattern picks up valid non-options, e.g. -x which is like a-x +aopts=( -A '-[^gorstuwxX]*' ) args=( '*: :->files' '1: :_file_modes' ) diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio index 699b1d8f2..20f8c712d 100644 --- a/Completion/Unix/Command/_cpio +++ b/Completion/Unix/Command/_cpio @@ -25,15 +25,15 @@ else '--message=:message at end of volume:' '--null' '--reset-access-time' '--verbose' '--dot' '--append' - '--block-size=:block size in 512 byte units:' + '--block-size=:block size (512 byte units)' '--dereference' - '--io-size=:block size in bytes' + '--io-size=:block size (bytes)' '--quiet' '--force-local' '--help' '--version') fi args+=( '-A[append files to archive]' '-B[block size 5120 bytes with special file]' - '-C[set block size per record]:block size in bytes:(8192)' + '-C[set block size per record]:block size (bytes)' '-F[set archive file to use]:archive file:->afile' '(-H)-c[read/write header in ASCII]' "(-c)-H[set format type for archive header]:$fmts" @@ -49,7 +49,7 @@ else '--preserve-modification-time' '--numeric' '--rename' '--list' '--swap-bytes' '--swap-halfwords' '--dot' '--unconditional' '--verbose' - '--block-size=:block size in 512 byte units:' + '--block-size=:block size (512 byte units)' '--swap-halfwords' '--io-size=:block size in bytes:' '--pattern-file=:file with list of patterns:_files' @@ -63,7 +63,7 @@ else '-b[reverse bytes in word]' '-B[block size 5120 bytes with special file]' '-d[create directories as needed]' - '-C[set block size per record]:block size in bytes:(8192)' + '-C[set block size per record]:block size (bytes)' '-E[read filenames from file]:file name for list of files:_files' '-f[only copy files not matching patterns]' '-F[set archive file to use]:archive file:->afile' diff --git a/Completion/Unix/Command/_csplit b/Completion/Unix/Command/_csplit new file mode 100644 index 000000000..5f72232bb --- /dev/null +++ b/Completion/Unix/Command/_csplit @@ -0,0 +1,51 @@ +#compdef csplit + +local curcontext=$curcontext cnt_info ret=1 +local -a state state_descr line specs optA +typeset -A opt_args + +# common specs +specs=( + '(hv -f --prefix)'{-f+,--prefix=}'[specify prefix for output file names]:prefix [xx]: ' + '(hv -n --digits -b --suffix-format)'{-n+,--digits=}'[specify number of digits in output file names]:number [2]: ' + '(hv -k --keep-files)'{-k,--keep-files}'[do not remove output files on errors]' + '(hv -s --quiet --silent)'{-s,--quiet,--silent}'[do not print counts of output file sizes]' + '(hv)1: :_files' + '(hv)*: :->patterns' +) + +if _pick_variant gnu=GNU unix --version; then + # GNU coreutils 8.32 + specs+=( + '(hv -b --suffix-format -n --digits)'{-b+,--suffix-format=}'[specify format for numbers in output file names]:format [%%02d]: ' + '(hv)--suppress-matched[suppress the lines matching the pattern]' + '(hv -z --elide-empty)'{-z,--elide-empty-files}'[remove empty output files]' + + hv + '(: * -)--help[display help and exit]' + '(: * -)--version[output version information and exit]' + ) + cnt_info="(integer or '*')" +else + # POSIX ({Free,Open}BSD, DragonFly, macOS) + specs=( ${specs:#(|*\))--*} ) # remove long options + optA=( -A '-?*' ) # a single '-' is a valid file name (stdin) +fi + +_arguments -C -s -S $optA : $specs && ret=0 + +case $state in + patterns) + if compset -P '(/?*/|%?*%)'; then + _message '[+|-]offset' && ret=0 + elif compset -P '[/%]'; then + _message 'regex' && ret=0 + elif compset -P '(|\\){'; then + _message "count $cnt_info" && ret=0 + elif compset -P '[0-9]*'; then + _message 'line number' && ret=0 + elif [[ ${words[CURRENT]} != -* ]] then + _message "line_number, '/regex/[offset]', '%%regex%%[offset]', or '{count}'" && ret=0 + fi +esac + +return ret diff --git a/Completion/Unix/Command/_ctags b/Completion/Unix/Command/_ctags new file mode 100644 index 000000000..e2b28011b --- /dev/null +++ b/Completion/Unix/Command/_ctags @@ -0,0 +1,244 @@ +#compdef ctags arduino-ctags ctags-exuberant ctags-universal + +local context state line expl +local -A opt_args +local -a arguments + +if [ -z "$_ctags_type" ]; then + local output=`ctags --version 2>&1` + if [[ "$output" = *Universal\ Ctags* ]]; then + _ctags_type="universal" + elif [[ "$output" = *Exuberant\ Ctags* ]]; then + _ctags_type="exuberant" + elif [[ "$output" = *usage:\ ctags* ]]; then + _ctags_type="bsd" + elif [[ "$output" = *Emacs* ]]; then + _ctags_type="etags" + else + _ctags_type="universal" + fi +fi + +if [ "$_ctags_type" = "etags" ]; then + _etags + return $? +fi + +_ctags_languages() { + _call_program languages $service --list-languages | sed -n 's/^\([A-Za-z][A-Za-z0-9#_+]*\).*/\1/p' +} + +if [[ "$PREFIX" = --alias-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --extras-*=* ]]; then + _message flags + return 1 +elif [[ "$PREFIX" = --fields-*=* ]]; then + _message flags + return 1 +elif [[ "$PREFIX" = --input-encoding-*=* ]]; then + _message encoding + return 1 +elif [[ "$PREFIX" = --kinddef-*=* ]]; then + _message kind + return 1 +elif [[ "$PREFIX" = --kinds-*=* ]]; then + _message kind + return 1 +elif [[ "$PREFIX" = --map-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --mline-regex-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --param-*=* ]]; then + _message argument + return 1 +elif [[ "$PREFIX" = --regex-*=* ]]; then + _message pattern + return 1 +elif [[ "$PREFIX" = --roles-*.*=* ]] then + _message role + return 1 +elif [[ "$PREFIX" = --roles-*.* ]] then + _message kind + return 1 +fi + +if [ "$_ctags_type" = "universal" ]; then + arguments=( + "-a[append to tags file]" + "-B[use backward searching patterns (?...?)]" + "-D[give definition for macro]:macro definition:" + "-e[output tag file for use with emacs]" + {-f+,-o+}"[write tags to specified file]:output file:_files" + "-F[use forward searching patterns (/.../)]" + "-h[specify a list of file extensions to be treated as include files]:extensions" + "-I[specify a list of tokens to be specially handled]:identifier list" + "-L[read a list of input file names from the specified file]:input file:_files" + "-n[equivalent to --excmd=number]" + "-N[equivalent to --excmd=pattern]" + "(--recurse -R)--recurse=-[search files recursively]::bool:(yes no)" + "(--recurse -R)-R[search files recursively]" + "-u[equivalent to --sort=no]" + "-x[print a tabular cross reference file to stdout]" + "--alias--[add a pattern detecting a name, can be used as an alt name for lang]:language:->languageequals" + "--append=-[should tags be appended to existing tag file]:bool:(yes no)" + "--etags-include=-[include reference to file in emacs style tag file]:file:_files" + "--exclude=-[exclude files and directories matching pattern]:pattern" + "--exclude-exception=-[don't exclude files and directories matching pattern even if they match the pattern specified with --exclude]:pattern" + "--excmd=-[uses the specified type of ex command to locate tags]:ex command type:(number pattern mix combine)" + "--extras=-[include extra tag entries for selected information]:flags (fFgpqrs)" + "--extras--[include <lang> own extra tag entries for selected information]:language:->languageequals" + "--fields=-[include selected extension fields]:flags (aCeEfFikKlmnNpPrRsStxzZ)" + "--fields--[include selected <lang> own extension fields]:language:->languageequals" + "--filter=-[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)" + "--filter-terminator=-[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string" + "--format=-[force output of specified tag file format]:level" + "(--guess-language-eagerly -G)"{--guess-language-eagerly,-G}"[guess the language of input file more eagerly]" + {--help,-?}"[display help text]" + "--help-full[display help text with experimental features]" + "--if0=-[should code within #if 0 conditionals be parsed]:bool:(yes no)" + "--input-encoding=-[specify encoding of all input files]:encoding" + "--input-encoding--[specify encoding of the <lang> input files]:language:->languageequals" + "--kinddef--[define new kind for <lang>]:language:->languageequals" + "--kinds--[enable/disable tag kinds for <lang>]:language:->languageequals" + "--langdef=-[define a new language to be parsed with regular expressions]:name" + "--langmap=-[override default mapping of language to input file extension]:maps" + "--language-force=-[force all files to be interpreted using specified language]:language:->language" + "--languages=-[restrict files scanned to these comma-separated languages]:language:->languages" + "--license[print details of software license]" + "--line-directives=-[should #line directives be processed]:bool:(yes no)" + "--links=-[indicate whether symlinks should be followed]:bool:(yes no)" + "--list-aliases=-[list of alias patterns]:language:->language" + "--list-excludes[list of exclude patterns for files/dirs]" + "--list-extras=-[list of extra tag flags]:language:->language" + "--list-features[list of compiled features]" + "--list-fields=-[list of fields]:language:->language" + "--list-kinds=-[list of all tag kinds for lang]:language:->language" + "--list-kinds-full=-[list details of all tag kinds for lang]:language:->language" + "--list-languages[list of supported languages]" + "--list-map-extensions=-[list of language extensions in mapping]:language:->language" + "--list-map-patterns=-[list of language patterns in mapping]:language:->language" + "--list-maps=-[list of language mappings (both extensions and patterns)]:language:->language" + "--list-mline-regex-flags[list of flags which can be used in a multiline regex parser definition]" + "--list-params=-[list of language parameters. works with --machinable]:language:->language" + "--list-pseudo-tags[list of pseudo tags]" + "--list-regex-flags[list of flags which can be used in a regex parser definition]" + "--list-roles=-[list of all roles of tag kinds specified for langs]:language:->language" + "--list-subparsers=-[list of subparsers for the base lang]:language:->language" + "--machinable=-[use tab separated representation in --list-* output]:bool:(yes no)" + "--map--[set, add(+), or remove(-) the map for <lang>]:language:->languageequals" + "--maxdepth=-[specify maximum recursion depth]:depth" + "--mline-regex--[define multiline regex for locating tags in <lang>]:language:->languageequals" + "--options=-[specify file (or dir) from which command line options should be read]:file:_files" + "--options-maybe=-[same as --options but doesn't error]:file:_files" + "--optlib-dir=-[add or set dir to optlib search path]:dir:_files -/" + "--output-encoding=-[the encoding to write the tag file in]:encoding" + "--output-format=-[specify the output format]:format:(u-ctags e-ctags etags xref)" + "--param--[set <lang> specific parameter]:language:->languageequals" + "--pattern-length-limit=-[cutoff patterns of tag entries after N characters]:number" + "--print-language[don't make tags file but just print the guessed lang name for input file]" + "--pseudo-tags=-[enable/disable emitting pseudo tag named ptag. if *, enable emitting all pseudo tags]:ptag" + "--put-field-prefix[put UCTAGS as prefix for the name of fields newly introducted in universal ctags]" + "--quiet=-[don't print notice class messages]:bool:(yes no)" + "--regex--[define regex for locating tags in specific lang]:language:->languageequals" + "--roles--[enable/disable tag roles for kinds of <lang>]:language:->languagedot" + "--sort=-[should tags be sorted]:argument:(yes no foldcase)" + "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no always never)" + "--totals=-[print stats about input and tag files]:argument:(yes no extra)" + "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)" + "(--verbose -V)-V[enable verbose messages describing actions]" + "--version[print version]" + "--with-list-header=-[prepend the column descriptions in --list-* output]:bool:(yes no)" + "*:file:_files" + ) +elif [ "$_ctags_type" = "exuberant" ]; then + arguments=( + "-a[append to tags file]" + "-B[use backward searching patterns (?...?)]" + "-e[output tag file for use with emacs]" + {-f+,-o+}"[write tags to specified file]:output file:_files" + "-F[use forward searching patterns (/.../)]" + "-h[specify a list of file extensions to be treated as include files]:extensions" + "-I[specify a list of tokens to be specially handled]:identifier list" + "-L[read a list of input file names from the specified file]:input file:_files" + "-n[equivalent to --excmd=number]" + "-N[equivalent to --excmd=pattern]" + "(--recurse -R)--recurse=-[search files recursively]::bool:(yes no)" + "(--recurse -R)-R[search files recursively]" + "-u[equivalent to --sort=no]" + "-x[print a tabular cross reference file to stdout]" + "--append=-[should tags be appended to existing tag file]:bool:(yes no)" + "--etags-include=-[include reference to file in emacs style tag file]:file:_files" + "--exclude=-[exclude files and directories matching pattern]:pattern" + "--excmd=-[uses the specified type of ex command to locate tags]:ex command type:(number pattern mix)" + "--extra=-[include extra tag entries for selected information]:flags (fg)" + "--fields=-[include selected extension fields]:flags (afmikKlnsStz)" + "--file-scope=-[should tags scoped only for a single file be included in output]:bool:(yes no)" + "--filter=-[behave as a filter, reading file names from stdin and writing tags to stdout]:bool:(yes no)" + "--filter-terminator=-[specify string to print to stdout following the tags for each file parsed when --filter is enabled]:string" + "--format=-[force output of specified tag file format]:level" + "--help[display help text]" + "--if0=-[should code within #if 0 conditionals be parsed]:bool:(yes no)" + "--langdef=-[define a new language to be parsed with regular expressions]:name" + "--langmap=-[override default mapping of language to input file extension]:maps" + "--language-force=-[force all files to be interpreted using specified language]:language:->language" + "--languages=-[restrict files scanned to these comma-separated languages]:language:->languages" + "--license[print details of software license]" + "--line-directives=-[should #line directives be processed]:bool:(yes no)" + "--links=-[indicate whether symlinks should be followed]:bool:(yes no)" + "--list-kinds=-[list of all tag kinds for lang]:language:->language" + "--list-languages[list of supported languages]" + "--list-maps=-[list of language mappings (both extensions and patterns)]:language:->language" + "--options=-[specify file (or dir) from which command line options should be read]:file:_files" + "--regex--[define regex for locating tags in specific lang]:language:->language" + "--sort=-[should tags be sorted]:argument:(yes no foldcase)" + "--tag-relative=-[should paths be relative to location of tag file]:argument:(yes no)" + "--totals=-[print stats about input and tag files]:argument:(yes no)" + "(--verbose -V)--verbose=-[enable verbose messages describing actions]:bool:(yes no)" + "(--verbose -V)-V[enable verbose messages describing actions]" + "--version[print version]" + "*:file:_files" + ) + if [[ "$PREFIX" = -* ]]; then + local -a languages=(`_ctags_languages`) + local -a languages2 + for language in $languages; do + arguments+=("--$language-kinds=-:kinds") + done + fi +elif [ "$_ctags_type" = "bsd" ]; then + arguments=( + "-a[append to tags file]" + "-B[use backward searching patterns (?...?)]" + "-d[create tags for #defines that don't take arguments]" + "-F[use forward searching patterns (/.../)]" + "-f+[write tags to specified file]:output file:_files" + "-t[create tags for typedefs, structs, unions, and enums]" + "-u[update the specified files in the tags file]" + "-v[an index of the form expected by vgrind(1) is produced]" + "-w[suppress warning diagnostics]" + "-x[ctags produces a simple function index]" + "*:file:_files" + ) +fi + +_arguments -s $arguments + +if [ "$state" = "language" ]; then + local -a languages=(`_ctags_languages`) + _wanted languages expl language compadd -a languages +elif [ "$state" = "languageequals" ]; then + local -a languages=(`_ctags_languages`) + _wanted languages expl language compadd -S = -a languages +elif [ "$state" = "languagedot" ]; then + local -a languages=(`_ctags_languages`) + _wanted languages expl language compadd -S . -a languages +elif [ "$state" = "languages" ]; then + local -a languages=(`_ctags_languages`) + _values -s , languages $languages +fi + +return $(( compstate[nmatches] > 0 ? 0 : 1 )) diff --git a/Completion/Unix/Command/_curl b/Completion/Unix/Command/_curl index 72e2e5b53..ecccdd389 100644 --- a/Completion/Unix/Command/_curl +++ b/Completion/Unix/Command/_curl @@ -4,4 +4,4 @@ # definition is provided as a fallback, and should be installed later # in $fpath than the curl-provided definition of _curl. -_urls "$@" +_gnu_generic || _urls "$@" diff --git a/Completion/Unix/Command/_cvs b/Completion/Unix/Command/_cvs index cba3eb773..4dc5b6c60 100644 --- a/Completion/Unix/Command/_cvs +++ b/Completion/Unix/Command/_cvs @@ -371,10 +371,10 @@ _cvs_log() { '-R[print the name of RCS file in the repository]' \ '-N[don'\''t list tags]' \ '(-h)-t[header with descriptive text]' \ - '-d+[specify dates]:dates' \ + '-d+[specify dates]:date range' \ '-r-[specify revisions]:revisions' \ - '-s+[specify states]:states:(Exp Stab Rel dead)' \ - '-w-[specify logins]:logins' \ + '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \ + '-w-[specify logins]:login list' \ '*:file:_cvs_files' } @@ -388,10 +388,10 @@ _cvs_rlog() { '(-l)-R[recursive]' \ '-N[don'\''t list tags]' \ '(-h)-t[header with descriptive text]' \ - '-d+[specify dates]:dates' \ + '-d+[specify dates]:date range' \ '-r-[specify revisions]:revisions' \ - '-s+[specify states]:states:(Exp Stab Rel dead)' \ - '-w-[specify logins]:logins' \ + '-s+[specify states]:state:_sequence compadd - Exp Stab Rel dead' \ + '-w-[specify logins]:login list' \ '*:file:_cvs_modules' } diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date index 68bd357fb..97c272830 100644 --- a/Completion/Unix/Command/_date +++ b/Completion/Unix/Command/_date @@ -61,9 +61,13 @@ else ;| freebsd*|dragonfly*|darwin*) args+=( + "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" + ) + ;| + freebsd<-12>.*|darwin*) + args+=( '-d+:daylight saving time value' '-t+:minutes west of GMT' - "*-v+[adjust and print (but don't set) date]:[+-]value[ymwdHMS]" ) ;| freebsd*|dragonfly*) diff --git a/Completion/Unix/Command/_dd b/Completion/Unix/Command/_dd index e5c5e63ce..10682bc8e 100644 --- a/Completion/Unix/Command/_dd +++ b/Completion/Unix/Command/_dd @@ -1,18 +1,19 @@ #compdef dd gdd -local -a vals conv flags +local -a vals conv flags units local variant +units=( w:word b:block k:1024 m g t ) _pick_variant -r variant gnu=GNU $OSTYPE --version vals=( - '(ibs obs)bs[block size]:block size (bytes)' - 'cbs[conversion buffer size]:buffer size (bytes)' + '(ibs obs)bs[block size]: :_numbers -u bytes "block size" $units' + 'cbs[conversion buffer size]: :_numbers -u bytes "buffer size" $units' 'conv[specify conversions to apply]: :_values -s , conversion $conv' 'count[number of input blocks to copy]:blocks' - '(bs)ibs[input block size]:block size (bytes)' + '(bs)ibs[input block size]: :_numbers -u bytes -d 512 "block size" $units' 'if[specify input file]:input file:_tilde_files' - '(bs)obs[output block size]:block size (bytes)' + '(bs)obs[output block size]: :_numbers -u bytes -d 512 "block size" $units' 'of[specify output file]:output file:_tilde_files' 'seek[output blocks initially skipped]:blocks' 'skip[input blocks initially skipped]:blocks' @@ -63,7 +64,7 @@ case $variant in freebsd*) vals+=( 'fillchar[specify padding character]:character' - 'speed[limit copying speed]:speed (bytes/second)' + 'speed[limit copying speed]: :_numbers -u bytes/second speed $units' ) conv+=( '(pareven parnone parodd parset)'{pareven,parnone,parodd,parset} @@ -75,6 +76,7 @@ case $variant in ) flags+=( fullblock noatime nocache count_bytes skip_bytes seek_bytes ) conv+=( excl nocreat fdatasync fsync ) + units=( c:1 w:2 b:512 kB:1000 K:1024 MB:1000^2 M:1024\^2 GB G TB T PB P EB E ZB Z YB Y ) ;; netbsd*) vals+=( diff --git a/Completion/Unix/Command/_dhclient b/Completion/Unix/Command/_dhclient index d5ca5b271..e22586b04 100644 --- a/Completion/Unix/Command/_dhclient +++ b/Completion/Unix/Command/_dhclient @@ -20,7 +20,6 @@ case $OSTYPE in openbsd*) args+=( '-i+[ignore values provided by leases for specified options]:options' - '-L+[specify file to write option data too]:file:_files' "-n[don't configure any interfaces]" '-r[release the current lease back to the server it came from]' '-v[verbose log messages]' diff --git a/Completion/Unix/Command/_dict b/Completion/Unix/Command/_dict index 202fc5bab..928728e06 100644 --- a/Completion/Unix/Command/_dict +++ b/Completion/Unix/Command/_dict @@ -21,6 +21,8 @@ _arguments -C -S \ '(--key -k)'{--key=,-k+}'[specify key for authentication]:shared secret:' \ '(-)'{--version,-V}'[display program version]' \ '(-)'{--license,-L}'[display program license]' \ + '(-6)-4[force use of IPv4 addresses only]' \ + '(-4)-6[force use of IPv6 addresses only]' \ '(-)--help[display usage info]' \ '(--verbose -v)'{--verbose,-v}'[verbose output]' \ '(--raw -r)'{--raw,-r}'[be very verbose]' \ diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index d2ffb0a33..3081e2cfd 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -24,10 +24,12 @@ local -a alts args '*+'{no,}'ednsnegotiation[set EDNS version negotiation]' '*+ednsopt=[specify EDNS option]:code point' '*+noedns[clear EDNS options to be sent]' + '*+'{no,}'expandaaaa[expand AAAA records]' '*+'{no,}'expire[send an EDNS Expire option]' '*+'{no,}'header-only[send query without a question section]' '*+'{no,}'idnin[set processing of IDN domain names on input]' '*+'{no,}'idnout[set conversion of IDN puny code on output]' + '*+'{no,}'keepalive[request EDNS TCP keepalive]' '*+'{no,}'keepopen[keep TCP socket open between queries]' '*+'{no,}'mapped[allow mapped IPv4 over IPv6 to be used]' '*+'{no,}'recurse[set the RD (recursion desired) bit in the query]' @@ -40,12 +42,15 @@ local -a alts args '*+'{no,}'identify[print IP and port of responder]' '*+'{no,}'comments[print comment lines in output]' '*+'{no,}'stats[print statistics]' + '*+padding[set padding block size]:size [0]' '*+'{no,}'qr[print query as it was sent]' '*+'{no,}'question[print question section of a query]' + '*+'{no,}'raflag[set RA flag in the query]' '*+'{no,}'answer[print answer section of a reply]' '*+'{no,}'authority[print authority section of a reply]' '*+'{no,}'all[set all print/display flags]' '*+'{no,}'subnet[send EDNS client subnet option]:addr/prefix-length' + '*+'{no,}'tcflag[set TC flag in the query]' '*+timeout=[set query timeout]:timeout (seconds) [5]' '*+tries=[specify number of UDP query attempts]:tries' '*+retry=[specify number of UDP query retries]:retries' @@ -57,13 +62,12 @@ local -a alts args '*+'{no,}"fail[don't try next server on SERVFAIL]" '*+'{no,}'besteffort[try to parse even malformed messages]' '*+'{no,}'dnssec[request DNSSEC records]' - '*+'{no,}'sigchase[chase DNSSEC signature chains]' - '*+trusted-key=[specify file containing trusted keys]:file:_files' - '*+'{no,}'topdown[do DNSSEC validation in top down mode]' '*+'{no,}'nsid[include EDNS name server ID request in query]' '*+'{no,}'ttlid[display the TTL whening printing the record]' '*+'{no,}'ttlunits[display the TTL in human-readable units]' + '*+'{no,}'unexpected[print replies from unexpected sources]' '*+'{no,}'unknownformat[print RDATA in RFC 3597 "unknown" format]' + '*+'{no,}'yaml[present the results as YAML]' '*+'{no,}'zflag[set Z flag in query]' ) _arguments -s -C $args \ @@ -89,7 +93,7 @@ if [[ -n $state ]]; then _wanted hosts expl 'DNS server' _hosts && ret=0; else case $#line in - <3->) alts+=( 'classes:query class:compadd -M "m\:{a-z}={A-Z}" - IN CS CH HS' ) ;& + <3->) alts+=( 'classes:query class:compadd -M "m:{a-z}={A-Z}" - IN CS CH HS' ) ;& 2) alts+=( 'types:query type:_dns_types' ) ;; esac _alternative 'hosts:host:_hosts' $alts && ret=0 diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django index 9eaa2284a..1d5cf7311 100644 --- a/Completion/Unix/Command/_django +++ b/Completion/Unix/Command/_django @@ -146,9 +146,9 @@ case $state in args+=( $locale $verbosity - {-d,--domain=}'[domain of the message files (default: "django")]:domain' + {-d,--domain=}'[domain of the message files]:domain [django]:(django djangojs)' {-a,--all}'[re-examine all code and templates]' - {-e,--extensions=}'[file extension(s) to examine (default: ".html")]:extension' + {-e,--extensions=}'[file extension(s) to examine]:extension [html]' ) ;; diff --git a/Completion/Unix/Command/_dmesg b/Completion/Unix/Command/_dmesg index 3dd059214..1aa3bc262 100644 --- a/Completion/Unix/Command/_dmesg +++ b/Completion/Unix/Command/_dmesg @@ -1,6 +1,6 @@ #compdef dmesg -local args +local -a args case $OSTYPE in linux*) args=( -S -- ) ;; @@ -27,6 +27,13 @@ case $OSTYPE in '-n[use specified kernel core]:number' ) ;; + netbsd*) + args+=( + '-d[show timestamp deltas]' + '(-t)-T[format uptime timestamps in a human readable form]' + '(-T)-t[suppress printing uptime timestamps]' + ) + ;; esac -_arguments -s $args +_arguments -s : $args diff --git a/Completion/Unix/Command/_doas b/Completion/Unix/Command/_doas index 94395557c..3ef036a88 100644 --- a/Completion/Unix/Command/_doas +++ b/Completion/Unix/Command/_doas @@ -1,7 +1,8 @@ #compdef doas -local environ e cmd +local environ e cmd cpp local -a _comp_priv_prefix +local -A opt_args zstyle -a ":completion:${curcontext}:" environ environ @@ -10,13 +11,13 @@ do local -x "$e" done cmd="$words[1]" +cpp='_comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)-u]} )' _arguments -s -S -A '-*' : \ - - optL \ - '-L[clear any persisted authorizations]' \ - - default \ - '-a+[specify authentication style]:authentication style' \ - '(-n -s)-C+[check config file and report on command matching]:config:_files' \ - '(-C)-n[non-interactive: fail rather than prompt for a password]' \ - '(-C *)-s[run a shell]' \ - '-u+[run command as specified user]:user:_users' \ - '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[-u]} ) ; _normal }' + '(: * -)-L[clear any persisted authorizations]' \ + '(-L)-a+[specify authentication style]:authentication style' \ + '(-L -n -s)-C+[check config file and report on command matching]:config:_files' \ + '(-C -L)-n[non-interactive: fail rather than prompt for a password]' \ + '(-C -L *)-s[run a shell]' \ + '(-L)-u+[run command as specified user]: :_users' \ + "(-)1: :{ $cpp; _command_names -e }" \ + "*:: :{ $cpp; _normal }" diff --git a/Completion/Unix/Command/_dropbox b/Completion/Unix/Command/_dropbox new file mode 100644 index 000000000..45c77ae09 --- /dev/null +++ b/Completion/Unix/Command/_dropbox @@ -0,0 +1,66 @@ +#compdef dropbox + +if [[ CURRENT -eq 2 || $words[2] = help ]]; then + local -a line progs + + _call_program command dropbox help | + while read -A line; do + if [[ $line[1] = [a-z]## ]]; then + progs+=("${line[1]}:${line[2,-1]}") + fi + done + + _describe -t command 'Dropbox command' progs +else + local -a opts + + case $words[2] in + (exclude) + _path_files -g '*(/)' + ;; + + (filestatus) + shift words + (( CURRENT-- )) + _arguments -s : \ + '(-l --list)'{-l,--list}'[use format like ls]' \ + '(-a --all)'{-a,--all}'[do not ignore entries starting .]' \ + '*:File to list:_files' + ;; + + (ls|puburl|sharelink) + _files + ;; + + (autostart|lansync) + opts=("y:turn $words[2] on" "n:turn $words[2] off") + _describe "$words[2] behaviour" opts + ;; + + (proxy) + _arguments \ + '2:proxy mode:(none auto manual)' \ + '3:proxy type for manual mode:(http socks4 socks5)' \ + '4:proxy host for manual mode:_hosts' \ + '5:proxy port for manual mode:_ports' \ + '6:proxy user for manual mode:_users' \ + '7:proxy password for manual mode:' + ;; + + (start) + shift words + (( CURRENT-- )) + _arguments -s : '(-i --install)'{-i,--install}'[auto install dropboxd]' + ;; + + (throttle) + _arguments \ + '2:download limit (KB/s):(unlimited)' \ + '3:upload limit (KB/s):(unlimited)' + ;; + + (*) + _default + ;; + esac +fi diff --git a/Completion/Unix/Command/_dtruss b/Completion/Unix/Command/_dtruss index bd1ae8bc5..b56e713d2 100644 --- a/Completion/Unix/Command/_dtruss +++ b/Completion/Unix/Command/_dtruss @@ -2,7 +2,7 @@ _arguments -s : \ '-a[print all details]' \ - '-b+[specify dynamic variable buffer size]:buffer size (default 4m)' \ + '-b+[specify dynamic variable buffer size]:buffer size [4m]' \ '-c[print system call counts]' \ '-d[print relative timestamps]' \ '-e[print elapsed times]' \ diff --git a/Completion/Unix/Command/_ecasound b/Completion/Unix/Command/_ecasound index a39e426db..5fd9055a7 100644 --- a/Completion/Unix/Command/_ecasound +++ b/Completion/Unix/Command/_ecasound @@ -102,9 +102,9 @@ case $state in elif compset -P '*,*,'; then _message 'sampling rate' elif compset -P '*,'; then - _message 'channels' + _message 'channel' else - _values 'sampling parameters' \ + _values 'sampling parameter' \ 'u8[unsigned 8-bit]' \ 's16_le[signed 16-bit little endian]' \ 's16_be[signed 16-bit big endian]' \ diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr index 3e2261a18..438ab179a 100644 --- a/Completion/Unix/Command/_entr +++ b/Completion/Unix/Command/_entr @@ -11,6 +11,7 @@ _arguments -s -S \ '-p[postpone first execution of the utility]' \ '(-a)-r[reload a persistent child process]' \ '(*)-s[evaluate the first argument using interpreter specified by $SHELL]' \ + '-z[exit after the utility completes]' \ '(-): :->command' \ '*::arguments:_normal' && ret=0 diff --git a/Completion/Unix/Command/_env b/Completion/Unix/Command/_env index 27978d936..a5dd49d37 100644 --- a/Completion/Unix/Command/_env +++ b/Completion/Unix/Command/_env @@ -1,6 +1,7 @@ #compdef env genv -local context state line variant args ign ret=1 +local context state line variant ign ret=1 +local -a args suf _pick_variant -r variant gnu=Free\ Soft $OSTYPE --version case $variant in @@ -20,8 +21,15 @@ case $variant in "${ign}(- *)--version[display version information]" ) ;; - freebsd*|darwin*) + freebsd*) args=( + '-0[use NUL, not newline after each variable in output]' + '-L[add variables from system login.conf(5)]: :->user-class' + '-U[add variables from user and system login.conf(5)]: :->user-class' + ) + ;| + freebsd*|darwin*|dragonfly*) + args+=( '(-i)*-u+[remove variable from the environment]:env var to remove:_parameters -g "*export*"' '-P+[specify alternate executable search PATH]:path:_dir_list' '-S+[perform word splitting]:string to split' @@ -44,11 +52,23 @@ _arguments $args \ '*::arguments:->normal' && ret=0 if [[ -n $state ]]; then - while [[ $words[1] = *=* ]]; do - shift words - (( CURRENT-- )) - done - _normal && ret=0 + case $state in + normal) + while [[ $words[1] = *=* ]]; do + shift words + (( CURRENT-- )) + done + _normal && ret=0 + ;; + user-class) + if compset -P 1 '*/'; then + _login_classes && ret=0 + else + compset -S '/*' || suf=( -qS/ ) + _users $suf && ret=0 + fi + ;; + esac fi return ret diff --git a/Completion/Unix/Command/_fetchmail b/Completion/Unix/Command/_fetchmail index 31a92d984..bc5a39688 100644 --- a/Completion/Unix/Command/_fetchmail +++ b/Completion/Unix/Command/_fetchmail @@ -4,7 +4,7 @@ _arguments -S \ {--bsmtp,'(--logfile)-L','(-L)--logfile','(--fetchmailrc)-f','(-f)--fetchmailrc','(--idfile)-i','(-i)--idfile'}':file:_files' \ {--plugin,--plugout,'(--mda)-m','(-m)--mda'}':command:_command_names -e' \ {'(--username)-u','(-u)--username'}:user:_users \ - '--auth:authentication types:(password kerberos kerberos_v5)' \ + '--auth:authentication type:(password kerberos kerberos_v5)' \ {'(--protocol)-p','(-p)--protocol'}:protocol:'(auto pop2 pop3 apop rpop kpop sdps imap imap-k4 imap-gss etrn)' \ {'(--port)-P','(-P)--port'}':port number' \ '*:mail server:_hosts' \ diff --git a/Completion/Unix/Command/_ffmpeg b/Completion/Unix/Command/_ffmpeg index c0b229f35..1329939cd 100644 --- a/Completion/Unix/Command/_ffmpeg +++ b/Completion/Unix/Command/_ffmpeg @@ -6,7 +6,7 @@ typeset -A opt_args (( $+functions[_ffmpeg_presets] )) || _ffmpeg_presets() { local presets presets=(~/.ffmpeg/*.ffpreset(:t:r) "$FFMPEG_DATADIR"/*.ffpreset(:t:r)) - _wanted ffmpeg-presets expl 'select preset' compadd -a presets + _wanted ffmpeg-presets expl 'preset' compadd -a presets } (( $+functions[_ffmpeg_acodecs] )) || _ffmpeg_acodecs() { @@ -49,7 +49,7 @@ typeset -A _ffmpeg_flags (( $+functions[_ffmpeg_flag_options] )) || _ffmpeg_flag_options() { local expl - _wanted options expl 'select flags' compadd -S '' -- {-,+}${^flag_options} + _wanted options expl 'flag' compadd -S '' -- {-,+}${^flag_options} } (( $+functions[_ffmpeg_more_flag_options] )) || _ffmpeg_more_flag_options() { @@ -177,7 +177,7 @@ _arguments -C -S \ && return [[ "$state" == "vfilters" ]] && - _values -s , -S = 'video filters' \ + _values -s , -S = 'video filter' \ 'aspect:set aspect ratio (rational number X\:Y or decimal number):' \ 'crop:crop input video (x\:y\:width\:height):' \ 'format: :_sequence -s : _ffmpeg_pix_fmts' \ diff --git a/Completion/Unix/Command/_find b/Completion/Unix/Command/_find index 916fcf2e6..74111f92b 100644 --- a/Completion/Unix/Command/_find +++ b/Completion/Unix/Command/_find @@ -89,7 +89,7 @@ case $variant in '-X[warn if filename contains characters special to xargs]' '-f[specify file hierarchy to traverse]:path:_directories' "-x[don't span filesystems]" - '*-flags:flags:_chflags' + '*-flags:flag:_chflags' ) ;| freebsd*|dragonfly*) args+=( '*-sparse' ) ;| @@ -156,11 +156,11 @@ if [[ $state = times ]]; then if zstyle -t ":completion:${curcontext}:senses" verbose; then zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=-- default=" [default exactly]" - disp=( "- $sep before" "+ $sep since" ) + disp=( "+ $sep before (older files)" "- $sep since (newer files)" ) smatch=( - + ) else disp=( before exactly since ) - smatch=( - '' + ) + smatch=( + '' - ) fi alts=( "senses:sense${default}:compadd -V times -S '' -d disp -a smatch" ) fi diff --git a/Completion/Unix/Command/_fuser b/Completion/Unix/Command/_fuser index f497729fc..05de1c529 100644 --- a/Completion/Unix/Command/_fuser +++ b/Completion/Unix/Command/_fuser @@ -50,7 +50,7 @@ case $variant in ) argf=( '*:name: _alternative "files:file:_files" "services:service:_fuser_services"' ) [[ -prefix - && -z ${${words[1,CURRENT-1]}[(r)-[A-Z][A-Z]*]} ]] && - argf[1]+=' "signal:signals:_signals -P-"' + argf[1]+=' "signals:signal:_signals -P-"' ;; freebsd*|openbsd*|solaris2.<9->) args+=( diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 9ec09200e..ac0e8fda3 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -1,6 +1,7 @@ #compdef gcc g++ cc c++ llvm-gcc llvm-g++ clang clang++ -value-,LDFLAGS,-default- -value-,CFLAGS,-default- -value-,CXXFLAGS,-default- -value-,CPPFLAGS,-default- -P gcc-* -P g++-* -P c++-* -local curcontext="$curcontext" state line ret=1 expl args args2 march +local curcontext="$curcontext" state line ret=1 expl i +local -a args args2 warnings arch typeset -A opt_args if [[ "$service" = -value-* ]]; then @@ -23,6 +24,7 @@ fi args=() case $MACHTYPE in + m68*) args=( -m68000 -m68020 -m68020-40 -m68030 -m68040 -m68881 @@ -56,6 +58,16 @@ amd290?0) arm) args=( -mapcs -m2 -m3 -m6 -mbsd -mxopen -mno-symrename + '-faapcs-bitfield-load[all volatile bit-field write generates at least one load]' + '-faapcs-bitfield-width[volatile bit-field width is dictated by the field container type]' + '-mcmse[allow use of CMSE]' + '-mexecute-only[disallow generation of data access to code sections]' + '-mno-movt[disallow use of movt/movw pairs]' + '-mno-neg-immediates[disallow converting instructions with negative immediates to their negation]' + '-mnocrc[disallow use of CRC instructions]' + '-mrestrict-it[disallow generation of deprecated IT blocks for ARMv8]' + '-mtp=[thread pointer access method]:arg' + '-munaligned-access[allow memory accesses to be unaligned]' ) ;; m88k) @@ -74,8 +86,8 @@ m88k) ) ;; rs6000|powerpc*) + arch=(rios1 rios2 rsc 501 603 604 power powerpc 403 common) args=( - '-mcpu=:CPU type:(rios1 rios2 rsc 501 603 604 power powerpc 403 common)' -mpower -mno-power -mpower2 -mno-power2 -mpowerpc -mno-powerpc -mpowerpc-gpopt -mno-powerpc-gpopt @@ -88,6 +100,32 @@ rs6000|powerpc*) -mtoc -mno-toc -mtraceback -mno-traceback -mlittle -mlittle-endian -mbig -mbig-endian -mcall-aix -mcall-sysv -mprototype + '-mcpu=:CPU type:->arch' + '-maltivec[altivec]' + '-mcmpb[cmpb]' + '-mcrbits[crbits]' + '-mcrypto[crypto]' + '-mdirect-move[direct move]' + '-mefpu2[efpu2]' + '-mfloat128[float128]' + '-mfprnd[fprnd]' + '-mhtm[htm]' + '-minvariant-function-descriptors[invariant function descriptors]' + '-misel[isel]' + '-mlongcall[longcall]' + '-mmfocrf[mfocrf]' + '-mmfcrf[mfcrf]' + '-mmma[mma]' + '-mpaired-vector-memops[paired vector memops]' + '-mpcrel[pcrel]' + '-mpopcntd[popcntd]' + '-mpower10-vector[power10 vector]' + '-mpower8-vector[power8 vector]' + '-mpower9-vector[power9 vector]' + '-mrop-protection[rop protection]' + '-msecure-plt[secure plt]' + '-mspe[spe]' + '-mvsx[vsx]' ) ;; romp) @@ -98,179 +136,233 @@ romp) ) ;; mips*) + arch=(r2000 r3000 r4000 r4400 r4600 r6000) args=( - '-mcpu=:CPU type:(r2000 r3000 r4000 r4400 r4600 r6000)' - -mabicalls -membedded-data - -membedded-pic -mfp32 -mfp64 -mgas -mgp32 -mgp64 - -mgpopt -mhalf-pic -mhard-float -mint64 -mips1 - -mips2 -mips3 -mlong64 -mlong-calls -mmemcpy - -mmips-as -mmips-tfile -mno-abicalls - -mno-embedded-data -mno-embedded-pic - -mno-gpopt -mno-long-calls - -mno-memcpy -mno-mips-tfile -mno-rnames -mno-stats - -mrnames -msoft-float - -m4650 -msingle-float -mmad - -mstats -EL -EB -nocpp - '-G:maximum size for small section objects:' + -membedded-pic -mgas -mgp32 -mgp64 -mhalf-pic -mhard-float -mint64 -mips1 + -mips2 -mips3 -mlong64 -mmemcpy -mmips-as -mmips-tfile -mno-abicalls + -mno-embedded-data -mno-embedded-pic -mno-gpopt -mno-long-calls -mno-memcpy + -mno-mips-tfile -mno-rnames -mno-stats -mrnames -msoft-float -m4650 -mmad + -mstats -nocpp + '-mcpu=:CPU type:->arch' + '-mabicalls[enable SVR4-style position-independent code]' + '-mabs=[abs]:arg' + '-mcheck-zero-division[check zero division]' + '-mcompact-branches=[compact branches]:arg' + '-mdouble-float[double float]' + '-mdsp[dsp]' + '-mdspr2[dspr2]' + '-membedded-data[place constants in the .rodata section instead of the .sdata section]' + '-mextern-sdata[assume that externally defined data is in the small data]' + '-mfp32[use 32-bit floating point registers]' + '-mfp64[use 64-bit floating point registers]' + '-mginv[ginv]' + '-mgpopt[use GP relative accesses for symbols known to be in a small data section]' + '-mindirect-jump=[change indirect jump instructions to inhibit speculation]:arg' + '-mips16[ips16]' + '-mldc1-sdc1[ldc1 sdc1]' + '-mlocal-sdata[extend the -G behaviour to object local data]' + '-mmadd4[enable the generation of 4-operand madd.s, madd.d, etc]' + '-mmicromips[micromips]' + '-mmsa[enable MSA ASE]' + '-mmt[enable MT ASE]' + '-mnan=[nan]:arg' + '-mno-mips16[no mips16]' + '-msingle-float[single float]' + '-mvirt[virt]' + '-mxgot[xgot]' ) ;; i[3456]86|x86_64) - march="native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 c3-2 geode" + arch=( + native i386 i486 i586 pentium pentium-mmx pentiumpro i686 pentium2 pentium3 + pentium3m pentium-m pentium4 pentium4m prescott nocona core2 corei7 corei7-avx + core-avx-i core-avx2 atom k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp + athlon-mp k8 opteron athlon64 athlon-fx k8-sse3 opteron-sse3 athlon64-sse3 + amdfam10 barcelona bdver1 bdver2 bdver3 btver1 btver2 winchip-c6 winchip2 c3 + c3-2 geode + ) args=( - '-mtune=-[tune code for CPU type]:CPU type:('"$march"')' - #'-mtune-ctrl=-[Fine grain control of tune features]:feature-list:' #for dev use only - '-march=-[generate instructions for CPU type]:CPU type:('"generic $march"')' - -mthreads - '-mreg-alloc=:default register allocation order:' - - # arguments with options - '-mabi=-[Generate code that conforms to the given ABI]:abi:(ms sysv)' - '-maddress-mode=-[Use given address mode]:address mode:(short long)' - '-malign-data=-[Use the given data alignment]:type:(compat abi cacheline)' - '-malign-functions=-[Function starts are aligned to this power of 2]: **2 base for function alignment: ' - '-malign-jumps=-[Jump targets are aligned to this power of 2]: **2 base for jump goal alignment: ' - '-malign-loops=-[Loop code aligned to this power of 2]: **2 base for loop alignment: ' - '-masm=-[Use given assembler dialect]:asm dialect:(att intel)' - '-mbranch-cost=-[Branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): ' - '-mcmodel=-[Use given x86-64 code model]:memory model:(32 small kernel medium large)' - '-mfpmath=-[Generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)' - '-mfunction-return=-[Convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)' - '-mincoming-stack-boundary=-[Assume incoming stack aligned to this power of 2]:assumed size of boundary: ' - '-mindirect-branch=-[Convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)' - '-mlarge-data-threshold=-[Data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: ' - '-mmem'{set,cpy}'-strategy=-[Specify memcpy expansion strategy when expected size is known]:strategy:' - '-mpreferred-stack-boundary=-[Attempt to keep stack aligned to this power of 2]:size of boundary: ' - '-mrecip=-[Control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' #TODO comma separated and can have ! - '-mregparm=-[Number of registers used to pass integer arguments]:number of integer argument registers: ' - '-mstack-protector-guard=-[Use given stack-protector guard]:guard:(global tls)' - '-mstringop-strategy=-[Chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)' - '-mtls-dialect=-[Use given thread-local storage dialect]:TLS dialect:(gnu gnu2)' - '-mveclibabi=-[Vector library ABI to use]:vector library ABI:(acml svml)' - - # arguments without options - '-m3dnow[Support 3DNow! built-in functions]' - '-m3dnowa[Support Athlon 3Dnow! built-in functions]' - '-m8bit-idiv[Expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]' - '-m16[Generate 16bit i386 code]' - '-m32[Generate 32bit i386 code]' - '-m64[Generate 64bit x86-64 code]' - '-m96bit-long-double[sizeof(long double) is 12]' '-m128bit-long-double[sizeof(long double) is 16]' - '-m80387[Use hardware fp]' - '-mabm[Support code generation of Advanced Bit Manipulation (ABM) instructions]' - '-maccumulate-outgoing-args[Reserve space for outgoing arguments in the function prologue]' - '-madx[Support flag-preserving add-carry instructions]' - '-maes[Support AES built-in functions and code generation]' - '-malign-double[Align some doubles on dword boundary]' - '-malign-stringops[Align destination of the string operations]' - '-mandroid[Generate code for the Android platform]' - '-mavx2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]' - '-mavx256-split-unaligned-load[Split 32-byte AVX unaligned load]' - '-mavx256-split-unaligned-store[Split 32-byte AVX unaligned store]' - '-mavx512bw[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]' - '-mavx512cd[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]' - '-mavx512dq[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]' - '-mavx512er[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]' - '-mavx512f[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]' - '-mavx512ifma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]' - '-mavx512pf[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]' - '-mavx512vbmi[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]' - '-mavx512vl[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]' - '-mavx512vpopcntdq[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]' - '-mavx5124fmaps[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]' - '-mavx5124vnniw[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]' - '-mavx[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]' - '-mbionic[Use Bionic C library]' - '-mbmi2[Support BMI2 built-in functions and code generation]' - '-mbmi[Support BMI built-in functions and code generation]' - '-mcld[Generate cld instruction in the function prologue]' - '-mclflushopt[Support CLFLUSHOPT instructions]' - '-mclwb[Support CLWB instruction]' - '-mclzero[Support CLZERO built-in functions and code generation]' - '-mcrc32[Support code generation of crc32 instruction]' - '-mcx16[Support code generation of cmpxchg16b instruction]' - '-mdispatch-scheduler[Do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]' - '-mf16c[Support F16C built-in functions and code generation]' - '-mfancy-math-387[Generate sin, cos, sqrt for FPU]' - '-mfentry[Emit profiling counter call at function entry before prologue]' - '-mfma4[Support FMA4 built-in functions and code generation]' - '-mfma[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]' - '-mforce-drap[Always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]' - '-mfp-ret-in-387[Return values of functions in FPU registers]' - '-mfsgsbase[Support FSGSBASE built-in functions and code generation]' - '-mfxsr[Support FXSAVE and FXRSTOR instructions]' - '-mgeneral-regs-only[Generate code which uses only the general registers]' - '-mglibc[Use GNU C library]' - '-mhard-float[Use hardware fp]' - '-mhle[Support Hardware Lock Elision prefixes]' - '-miamcu[Generate code that conforms to Intel MCU psABI]' - '-mieee-fp[Use IEEE math for fp comparisons]' - '-mindirect-branch-register[Force indirect call and jump via register]' - '-minline-all-stringops[Inline all known string operations]' - '-minline-stringops-dynamically[Inline memset/memcpy string operations, but perform inline version only for small blocks]' - '-mlong-double-64[Use 64-bit long double]' - '-mlong-double-80[Use 80-bit long double]' - '-mlong-double-128[Use 128-bit long double]' - '-mlwp[Support LWP built-in functions and code generation]' - '-mlzcnt[Support LZCNT built-in function and code generation]' - '-mmitigate-rop[Attempt to avoid generating instruction sequences containing ret bytes]' - '-mmmx[Support MMX built-in functions]' - '-mmovbe[Support code generation of movbe instruction]' - '-mmpx[Support MPX code generation]' - '-mms-bitfields[Use native (MS) bitfield layout]' - '-mmusl[Use musl C library]' - '-mmwaitx[Support MWAITX and MONITORX built-in functions and code generation]' - '-mno-default[Clear all tune features]' - '-mno-sse4[Do not support SSE4.1 and SSE4.2 built-in functions and code generation]' - '-mnop-mcount[Generate mcount/__fentry__ calls as nops. To activate they need to be patched in]' - '-momit-leaf-frame-pointer[Omit the frame pointer in leaf functions]' - '-mpc32[Set 80387 floating-point precision to 32-bit]' - '-mpc64[Set 80387 floating-point precision to 64-bit]' - '-mpc80[Set 80387 floating-point precision to 80-bit]' - '-mpclmul[Support PCLMUL built-in functions and code generation]' - '-mpku[Support PKU built-in functions and code generation]' - '-mpopcnt[Support code generation of popcnt instruction]' - '-mprefer-avx128[Use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]' - '-mprefetchwt1[Support PREFETCHWT1 built-in functions and code generation]' - '-mprfchw[Support PREFETCHW instruction]' - '-mpush-args[Use push instructions to save outgoing arguments]' - '-mrdpid[Support RDPID built-in functions and code generation]' - '-mrdrnd[Support RDRND built-in functions and code generation]' - '-mrdseed[Support RDSEED instruction]' - '-mrecip[Generate reciprocals instead of divss and sqrtss]' - '-mrecord-mcount[Generate __mcount_loc section with all mcount or __fentry__ calls]' - '-mred-zone[Use red-zone in the x86-64 code]' - '-mrtd[Alternate calling convention]' - '-mrtm[Support RTM built-in functions and code generation]' - '-msahf[Support code generation of sahf instruction in 64bit x86-64 code]' - '-msgx[Support SGX built-in functions and code generation]' - '-msha[Support SHA1 and SHA256 built-in functions and code generation]' - '-mskip-rax-setup[Skip setting up RAX register when passing variable arguments]' - '-msoft-float[Do not use hardware fp]' - '-msse2[Support MMX, SSE and SSE2 built-in functions and code generation]' - '-msse2avx[Encode SSE instructions with VEX prefix]' - '-msse3[Support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]' - '-msse4.1[Support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]' - '-msse4.2[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' - '-msse4[Support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' - '-msse4a[Support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]' - '-msse[Support MMX and SSE built-in functions and code generation]' - '-msseregparm[Use SSE register passing conventions for SF and DF mode]' - '-mssse3[Support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]' - '-mstack-arg-probe[Enable stack probing]' - '-mstackrealign[Realign stack in prologue]' - '-mstv[Disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]' - '-mtbm[Support TBM built-in functions and code generation]' - '-mtls-direct-seg-refs[Use direct references against %gs when accessing tls data]' - '-muclibc[Use uClibc C library]' - '-mvect8-ret-in-mem[Return 8-byte vectors in memory]' - '-mvzeroupper[Generate vzeroupper instruction before a transfer of control flow out of the function]' - '-mx32[Generate 32bit x86-64 code]' - '-mxop[Support XOP built-in functions and code generation]' - '-mxsave[Support XSAVE and XRSTOR instructions]' - '-mxsavec[Support XSAVEC instructions]' - '-mxsaveopt[Support XSAVEOPT instruction]' - '-mxsaves[Support XSAVES and XRSTORS instructions]' + '-m16[generate 16bit i386 code]' + '-m32[generate 32bit i386 code]' + '-m3dnowa[support Athlon 3Dnow! built-in functions]' + '-m3dnow[support 3DNow! built-in functions]' + '-m64[generate 64bit x86-64 code]' + '-m80387[use hardware fp]' + '-m8bit-idiv[expand 32bit/64bit integer divide into 8bit unsigned integer divide with run-time check]' + '-m96bit-long-double[sizeof(long double) is 12]' + '-mabi=-[generate code that conforms to the given ABI]:abi:(ms sysv)' + '-mabm[support code generation of Advanced Bit Manipulation (ABM) instructions]' + '-maccumulate-outgoing-args[reserve space for outgoing arguments in the function prologue]' + '-maddress-mode=-[use given address mode]:address mode:(short long)' + '-madx[support flag-preserving add-carry instructions]' + '-maes[support AES built-in functions and code generation]' + '-malign-data=-[use the given data alignment]:type:(compat abi cacheline)' + '-malign-double[align some doubles on dword boundary]' + '-malign-functions=-[function starts are aligned to this power of 2]: **2 base for function alignment: ' + '-malign-jumps=-[jump targets are aligned to this power of 2]: **2 base for jump goal alignment: ' + '-malign-loops=-[loop code aligned to this power of 2]: **2 base for loop alignment: ' + '-malign-stringops[align destination of the string operations]' + '-mamx-bf16[amx bf16]' + '-mamx-int8[amx int8]' + '-mamx-tile[amx tile]' + '-mandroid[generate code for the Android platform]' + '-march=-[generate instructions for CPU type]:CPU type:->archgeneric' + '-masm=-[use given assembler dialect]:asm dialect:(att intel)' + '-mavx256-split-unaligned-load[split 32-byte AVX unaligned load]' + '-mavx256-split-unaligned-store[split 32-byte AVX unaligned store]' + '-mavx2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and AVX2 built-in functions and code generation]' + '-mavx5124fmaps[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124FMAPS built- in functions and code generation]' + '-mavx5124vnniw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX5124VNNIW built- in functions and code generation]' + '-mavx512bf16[avx512bf16]' + '-mavx512bitalg[avx512bitalg]' + '-mavx512bw[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512BW built- in functions and code generation]' + '-mavx512cd[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512CD built- in functions and code generation]' + '-mavx512dq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512DQ built- in functions and code generation]' + '-mavx512er[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512ER built- in functions and code generation]' + '-mavx512f[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F built-in functions and code generation]' + '-mavx512ifma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512IFMA built-in functions and code generation]' + '-mavx512pf[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512PF built- in functions and code generation]' + '-mavx512vbmi2[avx512vbmi2]' + '-mavx512vbmi[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VBMI built-in functions and code generation]' + '-mavx512vl[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2 and AVX512F and AVX512VL built- in functions and code generation]' + '-mavx512vnni[avx512vnni]' + '-mavx512vp2intersect[avx512vp2intersect]' + '-mavx512vpopcntdq[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX, AVX2, AVX512F and AVX512VPOPCNTDQ built-in functions and code generation]' + '-mavx[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2 and AVX built-in functions and code generation]' + '-mavxvnni[avxvnni]' + '-mbionic[use Bionic C library]' + '-mbmi2[support BMI2 built-in functions and code generation]' + '-mbmi[support BMI built-in functions and code generation]' + '-mbranch-cost=-[branches are this expensive (1-5, arbitrary units)]:branch cost (1-5): ' + '-mcldemote[cldemote]' + '-mcld[generate cld instruction in the function prologue]' + '-mclflushopt[support CLFLUSHOPT instructions]' + '-mclwb[support CLWB instruction]' + '-mclzero[support CLZERO built-in functions and code generation]' + '-mcmodel=-[use given x86-64 code model]:memory model:(32 small kernel medium large)' + '-mcpu=-[set CPU type]:CPU type:->arch' + '-mcrc32[support code generation of crc32 instruction]' + '-mcx16[support code generation of cmpxchg16b instruction]' + '-mdispatch-scheduler[do dispatch scheduling if processor is bdver1, bdver2, bdver3, bdver4 or znver1 and Haifa scheduling is selected]' + '-menqcmd[enqcmd]' + '-mf16c[support F16C built-in functions and code generation]' + '-mfancy-math-387[generate sin, cos, sqrt for FPU]' + '-mfentry[emit profiling counter call at function entry before prologue]' + '-mfma4[support FMA4 built-in functions and code generation]' + '-mfma[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX and FMA built-in functions and code generation]' + '-mforce-drap[always use Dynamic Realigned Argument Pointer (DRAP) to realign stack]' + '-mfpmath=-[generate floating point mathematics using given instruction set]:FPU type:(387 sse sse,387 both)' + '-mfp-ret-in-387[return values of functions in FPU registers]' + '-mfsgsbase[support FSGSBASE built-in functions and code generation]' + '-mfunction-return=-[convert function return to call and return thunk]:choice:(keep thunk thunk-inline thunk-extern)' + '-mfxsr[support FXSAVE and FXRSTOR instructions]' + '-mgeneral-regs-only[generate code which uses only the general registers]' + '-mgfni[gfni]' + '-mglibc[use GNU C library]' + '-mhard-float[use hardware fp]' + '-mhle[support Hardware Lock Elision prefixes]' + '-mhreset[hreset]' + '-miamcu[generate code that conforms to Intel MCU psABI]' + '-mieee-fp[use IEEE math for fp comparisons]' + '-mincoming-stack-boundary=-[assume incoming stack aligned to this power of 2]:assumed size of boundary: ' + '-mindirect-branch=-[convert indirect call and jump to call and return thunks]:choice:(keep thunk thunk-inline thunk-extern)' + '-mindirect-branch-register[force indirect call and jump via register]' + '-minline-all-stringops[inline all known string operations]' + '-minline-stringops-dynamically[inline memset/memcpy string operations, but perform inline version only for small blocks]' + '-minvpcid[invpcid]' + '-mkl[kl]' + '-mlarge-data-threshold=-[data greater than given threshold will go into .ldata section in x86-64 medium model]:threshold: ' + '-mlong-double-128[use 128-bit long double]' + '-mlong-double-64[use 64-bit long double]' + '-mlong-double-80[use 80-bit long double]' + '-mlwp[support LWP built-in functions and code generation]' + '-mlzcnt[support LZCNT built-in function and code generation]' + {'-mmemset-strategy=-','-mmemcpy-strategy=-'}'[specify memcpy expansion strategy when expected size is known]:strategy:' + '-mmitigate-rop[attempt to avoid generating instruction sequences containing ret bytes]' + '-mmmx[support MMX built-in functions]' + '-mmovbe[support code generation of movbe instruction]' + '-mmovdir64b[movdir64b]' + '-mmovdiri[movdiri]' + '-mmpx[support MPX code generation]' + '-mms-bitfields[use native (MS) bitfield layout]' + '-mmusl[use musl C library]' + '-mmwaitx[support MWAITX and MONITORX built-in functions and code generation]' + '-mno-default[clear all tune features]' + '-mnop-mcount[generate mcount/__fentry__ calls as nops. To activate they need to be patched in]' + '-mno-sse4[do not support SSE4.1 and SSE4.2 built-in functions and code generation]' + '-momit-leaf-frame-pointer[omit the frame pointer in leaf functions]' + '-mpc32[set 80387 floating-point precision to 32-bit]' + '-mpc64[set 80387 floating-point precision to 64-bit]' + '-mpc80[set 80387 floating-point precision to 80-bit]' + '-mpclmul[support PCLMUL built-in functions and code generation]' + '-mpconfig[pconfig]' + '-mpku[support PKU built-in functions and code generation]' + '-mpopcnt[support code generation of popcnt instruction]' + '-mprefer-avx128[use 128-bit AVX instructions instead of 256-bit AVX instructions in the auto-vectorizer]' + '-mpreferred-stack-boundary=-[attempt to keep stack aligned to this power of 2]:size of boundary: ' + '-mprefetchwt1[support PREFETCHWT1 built-in functions and code generation]' + '-mprfchw[support PREFETCHW instruction]' + '-mptwrite[ptwrite]' + '-mpush-args[use push instructions to save outgoing arguments]' + '-mrdpid[support RDPID built-in functions and code generation]' + '-mrdrnd[support RDRND built-in functions and code generation]' + '-mrdseed[support RDSEED instruction]' + '-mrecip=-[control generation of reciprocal estimates]::instruction:(all none div divf divd rsqrt rsqrtf rsqrtd)' # TODO comma separated and can have ! + '-mrecip[generate reciprocals instead of divss and sqrtss]' + '-mrecord-mcount[generate __mcount_loc section with all mcount or __fentry__ calls]' + '-mred-zone[use red-zone in the x86-64 code]' + '-mreg-alloc=[control the default allocation order of integer registers]:default register allocation order:' + '-mregparm=-[number of registers used to pass integer arguments]:number of integer argument registers: ' + '-mretpoline-external-thunk[retpoline external thunk]' + '-mrtd[alternate calling convention]' + '-mrtm[support RTM built-in functions and code generation]' + '-msahf[support code generation of sahf instruction in 64bit x86-64 code]' + '-mserialize[serialize]' + '-msgx[support SGX built-in functions and code generation]' + '-msha[support SHA1 and SHA256 built-in functions and code generation]' + '-mshstk[shstk]' + '-mskip-rax-setup[skip setting up RAX register when passing variable arguments]' + '-msoft-float[do not use hardware fp]' + '-msse2avx[encode SSE instructions with VEX prefix]' + '-msse2[support MMX, SSE and SSE2 built-in functions and code generation]' + '-msse3[support MMX, SSE, SSE2 and SSE3 built-in functions and code generation]' + '-msse4.1[support MMX, SSE, SSE2, SSE3, SSSE3 and SSE4.1 built-in functions and code generation]' + '-msse4.2[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' + '-msse4a[support MMX, SSE, SSE2, SSE3 and SSE4A built-in functions and code generation]' + '-msse4[support MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1 and SSE4.2 built-in functions and code generation]' + '-msseregparm[use SSE register passing conventions for SF and DF mode]' + '-msse[support MMX and SSE built-in functions and code generation]' + '-mssse3[support MMX, SSE, SSE2, SSE3 and SSSE3 built-in functions and code generation]' + '-mstack-arg-probe[enable stack probing]' + '-mstack-protector-guard=-[use given stack-protector guard]:guard:(global tls)' + '-mstackrealign[realign stack in prologue]' + '-mstringop-strategy=-[chose strategy to generate stringop using]:stringop strategy:(byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop)' + '-mstv[disable Scalar to Vector optimization pass transforming 64-bit integer computations into a vector ones]' + '-mtbm[support TBM built-in functions and code generation]' + '-mthreads[support thread-safe exception handling on MinGW]' + '-mtls-dialect=-[use given thread-local storage dialect]:TLS dialect:(gnu gnu2)' + '-mtls-direct-seg-refs[use direct references against %gs when accessing tls data]' + '-mtsxldtrk[tsxldtrk]' + #'-mtune-ctrl=-[fine grain control of tune features]:feature-list:' #for dev use only + '-mtune=-[tune code for CPU type]:CPU type:->arch' + '-muclibc[use uClibc C library]' + '-muintr[uintr]' + '-mvaes[vaes]' + '-mveclibabi=-[vector library ABI to use]:vector library ABI:(acml svml)' + '-mvect8-ret-in-mem[return 8-byte vectors in memory]' + '-mvpclmulqdq[vpclmulqdq]' + '-mvzeroupper[generate vzeroupper instruction before a transfer of control flow out of the function]' + '-mwaitpkg[waitpkg]' + '-mwbnoinvd[wbnoinvd]' + '-mwidekl[widekl]' + '-mx32[generate 32bit x86-64 code]' + '-mx87[x87]' + '-mxop[support XOP built-in functions and code generation]' + '-mxsavec[support XSAVEC instructions]' + '-mxsaveopt[support XSAVEOPT instruction]' + '-mxsaves[support XSAVES and XRSTORS instructions]' + '-mxsave[support XSAVE and XRSTOR instructions]' ) ;; hppa*) @@ -298,6 +390,10 @@ i960) ) ;; sparc) + arch=( + v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet + tsc701 v9 ultrasparc ultrasparc3 + ) args=( -mapp-regs -mno-app-regs -mfpu -mhard-float @@ -308,8 +404,8 @@ sparc) -munaligned-doubles -mfaster-structs -mno-faster-structs -mimpure-text - '-mcpu=:CPU type:(v7 cypress v8 supersparc sparclite f930 f934 hypersparc sparclite86x sparclet tsc701 v9 ultrasparc ultrasparc3)' - '-mtune=:CPU type:(cypress supersparc hypersparc f930 f934 sparclite86x tsc701 ultrasparc ultrasparc3)' + '-mcpu=:CPU type:->arch' + '-mtune=:CPU type:->arch' -mv8plus -mno-v8plus -mvis -mno-vis -mlittle-endian @@ -341,863 +437,1797 @@ h8/300) -mrelax -mh ) ;; +aarch64) + args=( + '-mmark-bti-property[add .note.gnu.property with BTI to assembly files]' + '-moutline[enable function outlining (AArch64 only)]' + '-msve-vector-bits=[specify the size in bits of an SVE vector register]:bits' + ) + ;; +amdgpu) + args=( + '-mcumode[specify CU wavefront execution mode]' + '-mtgsplit[enable threadgroup split execution mode (AMDGPU only)]' + ) + ;; +hexagon) + args=( + '-mieee-rnd-near[ieee rnd near]' + '-mmemops[enable generation of memop instructions]' + '-mnvj[enable generation of new-value jumps]' + '-mnvs[enable generation of new-value stores]' + '-mpackets[enable generation of instruction packets]' + '-mhvx[enable Hexagon Vector eXtensions]' + '-mhvx-length=[set Hexagon Vector Length]:arg' + '-mhvx=[enable Hexagon Vector eXtensions]:arg' + ) + ;; +webassembly*) + args=( + '-matomics[atomics]' + '-mbulk-memory[bulk memory]' + '-mexception-handling[exception handling]' + '-mmultivalue[multivalue]' + '-mmutable-globals[mutable globals]' + '-mnontrapping-fptoint[no ntrapping fptoint]' + '-mreference-types[reference types]' + '-msign-ext[sign ext]' + '-msimd128[simd128]' + '-mtail-call[tail call]' + '-munimplemented-simd128[unimplemented simd128]' + '-mexec-model=[execution model]:arg' + ) + ;; +riscv) + args=( + '-msave-restore[enable using library calls for save and restore]' + ) + ;; esac if [[ "$service" = clang* ]]; then - args+=( - "-flto=-[generate output files suitable for link time optimization]::style:(full thin)" - -emit-llvm - "-Qunused-arguments[don't emit warning for unused driver arguments]" - --analyze - -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info - -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info - -fprint-source-range-info -fdiagnostics-show-option -fmessage-length - "-nostdinc[Do not search standard system directories or compiler builtin directories for include files]" - "-nostdlibinc[Do not search standard system directories for include files]" - "-nobuiltininc[Do not search builtin directory for include files]" - "--help[Display this information]" - ) + args+=( + '-all_load[undocumented option]' + '-allowable_client[undocumented option]:argument' + '--analyzer-no-default-checks[analyzer does no default checks]' + '--analyzer-output[static analyzer report output format]:format:(html plist plist-multi-file plist-html sarif sarif-html text)' + '--analyze[run the static analyzer]' + '-arch[arch]:argument' + '-arch_errors_fatal[arch errors fatal]' + '-arch_only[arch only]:argument' + '-arcmt-migrate-emit-errors[emit ARC errors even if the migrator can fix them]' + '-arcmt-migrate-report-output[output path for the plist report]:file:_files' + '-a-[undocumented option]:argument' + '--autocomplete=[autocomplete]:argument' + '-bind_at_load[bind at load]' + '--bootclasspath=[bootclasspath]:arg' + '-bundle[bundle]' + '-bundle_loader[bundle loader]:argument' + '--CLASSPATH=[CLASSPATH]:arg' + '--classpath=[classpath]:arg' + '-cl-denorms-are-zero[allow denormals to be flushed to zero]' + '-cl-fast-relaxed-math[cl fast relaxed math]' + '-cl-finite-math-only[allow floating-point optimizations]' + '-cl-fp32-correctly-rounded-divide-sqrt[specify that divide and sqrt are correctly rounded]' + '-client_name[client name]:argument' + '-cl-kernel-arg-info[generate kernel argument metadata]' + '-cl-mad-enable[allow use of less precise MAD computations]' + '-cl-no-signed-zeros[allow use of no signed zeros computations]' + '-cl-no-stdinc[disables all standard includes]' + '-cl-opt-disable[disables all optimizations]' + '-cl-single-precision-constant[treat double float constant as single precision]' + '-cl-std=[openCL language standard to compile for]:arg' + '-cl-strict-aliasing[this option is added for compatibility with OpenCL 1.0]' + '-cl-uniform-work-group-size[defines that the global work-size be uniform]' + '-cl-unsafe-math-optimizations[allow unsafe floating-point optimizations]' + '-compatibility_version[compatibility version]:compatibility version' + '--config[specifies configuration file]:configuration file:_files' + '--constant-cfstrings[use constant cfstrings]' + '--coverage[coverage]' + '-coverage[coverage]' + '-cpp[cpp]' + '--cuda-compile-host-device[compile CUDA code for both host and device]' + '--cuda-device-only[compile CUDA code for device only]' + '--cuda-gpu-arch=[cUDA offloading device architecture]:arg' + '--cuda-host-only[compile CUDA code for host only]' + '*--cuda-include-ptx=[include ptx for the following gpu architecture]:argument' + '--cuda-noopt-device-debug[enable device-side debug info generation]' + '--cuda-path=[cUDA installation path]:arg' + '--cuda-path-ignore-env[ignore environment variables to detect CUDA installation]' + '-cuid=[an id for compilation unit]:argument' + '-current_version[current version]:current version' + '-cxx-isystem[add directory to the C++ SYSTEM include search path]:directory:_files -/' + '-dead_strip[dead strip]' + '-dependency-dot[file to write dot-formatted header dependencies to]:file:_files' + '-dependency-file[file to write dependency output to]:file:_files' + '--dyld-prefix=[dyld prefix]:prefix' + '--dylib_file[dyld file]:file:_files' + '-dylinker[dylinker]' + '-dylinker_install_name[dylinker install name]:name' + '-dynamic[dynamic]' + '-dynamiclib[dynamic lib]' + '-EB[big endian]' + '-EL[little endian]' + '-emit-ast[emit Clang AST files for source inputs]' + '-emit-interface-stubs[generate Interface Stub Files]' + '-emit-llvm[use the LLVM representation for assembler and object files]' + '-emit-merged-ifs[generate Interface Stub Files, emit merged text not binary]' + '--emit-static-lib[enable linker job to emit a static library]' + #'-enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang[trivial automatic variable initialization to zero is only here for benchmarks]' + '--encoding=[encoding]:arg' + '-exported_symbols_list[exported symbols list]:argument' + '--extdirs=[extdirs]:arg' + '--extra-warnings[enable extra warnings]' + '-faccess-control[access control]' + '*-F+[add directory to framework search path]:framework directory:_files -/' + '-faddrsig[emit an address-significance table]' + '-faggressive-function-elimination[aggressive function elimination]' + '-falign-commons[align commons]' + '-faligned-allocation[aligned allocation]' + '-faligned-new[enable C++17 aligned allocation functions]' + '-fall-intrinsics[all intrinsics]' + '-fallow-editor-placeholders[treat editor placeholders as valid source code]' + '-fallow-unsupported[allow unsupported]' + '-falternative-parameter-statement[enable the old style PARAMETER statement]' + '-faltivec[altivec]' + '-fansi-escape-codes[use ANSI escape codes for diagnostics]' + "-fapple-kext[use Apple's kernel extensions ABI]" + '-fapple-link-rtlib[force linking the clang builtins runtime library]' + '-fapple-pragma-pack[enable Apple GCC-compatible #pragma pack handling]' + '-fapplication-extension[restrict code to those available for App Extensions]' + '-fasm-blocks[asm blocks]' + '-fassume-sane-operator-new[assume sane operator new]' + '-fast[ast]' + '-fastcp[astcp]' + '-fastf[astf]' + '-fautolink[autolink]' + '-fautomatic[automatic]' + '-fauto-profile-accurate[auto profile accurate]' + '-fauto-profile=[enable sample-based profile guided optimizations]::arg' + '-fbackslash[change the interpretation of backslashes in string literals]' + '-fbacktrace[backtrace]' + '-fbasic-block-sections=[generate labels for each basic block]:arg' + '-fbinutils-version=[produced object files can use all ELF features supported by this version]:major.minor' + '-fblas-matmul-limit=[blas matmul limit]:arg' + '-fblocks[enable the blocks language feature]' + '-fbootclasspath=[bootclasspath]:arg' + '-fborland-extensions[accept non-standard constructs supported by the Borland compiler]' + '-fbracket-depth=[bracket depth]:arg' + '-fbuild-session-file=[use the last modification time of <file> as the build session timestamp]:file:_files' + '-fbuild-session-timestamp=[time when the current build session started]:time since Epoch in seconds' + '-fbuiltin-module-map[load the clang builtins module map file]' + '-fcaret-diagnostics[show diagnostic messages using a caret]' + '-fcf-protection=[instrument control-flow architecture protection]::arg (options\: return, branch, full, none)' + '-fcf-runtime-abi=[cf runtime abi]:arg' + '-fchar8_t[enable C++ builtin type char8_t]' + '-fcheck-array-temporaries[check array temporaries]' + '-fcheck=[check]:arg' + '-fclang-abi-compat=[attempt to match the ABI of Clang <version>]:version' + '-fclasspath=[classpath]:arg' + '-fcoarray=[coarray]:arg' + '-fcolor-diagnostics[enable colors in diagnostics]' + '-fcomment-block-commands=[treat each comma separated argument in <arg> as a documentation comment block command]:arg' + '-fcompile-resource=[compile resource]:arg' + '-fcomplete-member-pointers[require member pointer base types to be complete if they would be significant under the Microsoft ABI]' + '-fconstant-cfstrings[constant cfstrings]' + '-fconstant-string-class=[constant string class]:arg' + '-fconstexpr-backtrace-limit=[constexpr backtrace limit]:arg' + '-fconstexpr-depth=[constexpr depth]:arg' + '-fconstexpr-steps=[constexpr steps]:arg' + '-fconvergent-functions[assume functions may be convergent]' + '-fconvert=[convert]:arg' + '-fcoroutines-ts[enable support for the C++ Coroutines TS]' + '-fcoverage-compilation-dir=[the compilation directory to embed in the coverage mapping]:arg' + '-fcoverage-mapping[generate coverage mapping to enable code coverage analysis]' + '-fcoverage-prefix-map=[remap file source paths in coverage mapping]:arg' + '-fcrash-diagnostics-dir=[crash diagnostics dir]:arg' + '-fcray-pointer[cray pointer]' + '-fcreate-profile[create profile]' + '-fcs-profile-generate[generate instrumented code to collect context sensitive execution counts]' + '-fcs-profile-generate=[generate instrumented code to collect context sensitive execution counts]:directory:_files -/' + '-fc\+\+-static-destructors[c++ static destructors]' + '-fcuda-approx-transcendentals[use approximate transcendental functions]' + '-fcuda-flush-denormals-to-zero[flush denormal floating point values to zero in CUDA device mode]' + '-fcuda-rdc[cuda rdc]' + '-fcuda-short-ptr[use 32-bit pointers for accessing const/local/shared address spaces]' + '-fcxx-exceptions[enable C++ exceptions]' + '-fcxx-modules[cxx modules]' + '-fdebug-compilation-dir=[the compilation directory to embed in the debug info]:arg' + '-fdebug-default-version=[default DWARF version to use]:arg' + '-fdebug-dump-parse-tree[dump the parse tree]' + '-fdebug-dump-provenance[dump provenance]' + '-fdebug-dump-symbols[dump symbols after the semantic analysis]' + '-fdebug-info-for-profiling[emit extra debug info to make sample profile more accurate]' + '-fdebug-macro[emit macro debug information]' + '-fdebug-measure-parse-tree[measure the parse tree]' + '-fdebug-pass-arguments[debug pass arguments]' + '-fdebug-pass-structure[debug pass structure]' + '-fdebug-pre-fir-tree[dump the pre-FIR tree]' + '-fdebug-ranges-base-address[use DWARF base address selection entries in .debug_ranges]' + '-fdebug-unparse[unparse and stop]' + '-fdebug-unparse-with-symbols[unparse and stop]' + '-fdeclspec[allow __declspec as a keyword]' + '-fdefault-double-8[set the default double precision kind to an 8 byte wide type]' + '-fdefault-integer-8[set the default integer kind to an 8 byte wide type]' + '-fdefault-real-8[set the default real kind to an 8 byte wide type]' + '-fdelayed-template-parsing[parse templated function definitions at the end of the translation unit]' + '-fdenormal-fp-math=[denormal fp math]:arg' + '-fdepfile-entry=[depfile entry]:arg' + '-fdiagnostics-absolute-paths[print absolute paths in diagnostics]' + '-fdiagnostics-fixit-info[supply fixit into with diagnostic messages]' + '-fdiagnostics-format=[diagnostics format]:arg' + '-fdiagnostics-hotness-threshold=[prevent optimization remarks from being output if they do not meet threshold]:value' + '-fdiagnostics-parseable-fixits[print fixits in a machine parseable form]' + '-fdiagnostics-print-source-range-info[print source range spans in numeric form]' + '-fdiagnostics-show-category=[diagnostics show category]:arg' + '-fdiagnostics-show-hotness[enable profile hotness information in diagnostic line]' + '-fdiagnostics-show-note-include-stack[display include stacks for diagnostic notes]' + '-fdiagnostics-show-option[enable -Woption information in diagnostic line]' + '-fdiagnostics-show-template-tree[print a template comparison tree for differing templates]' + '-fdigraphs[enable alternative token representations]' + "-fdirect-access-external-data[don't use GOT indirection to reference external data symbols]" + '-fdiscard-value-names[discard value names in LLVM IR]' + '-fd-lines-as-code[d lines as code]' + '-fd-lines-as-comments[d lines as comments]' + '-fdollar-ok[dollar ok]' + '-fdouble-square-bracket-attributes[enable double square bracket attributes]' + '-fdump-fortran-optimized[dump fortran optimized]' + '-fdump-fortran-original[dump fortran original]' + '-fdump-parse-tree[dump parse tree]' + '-fdwarf-directory-asm[DWARF directory asm]' + '-fdwarf-exceptions[use DWARF style exceptions]' + '-felide-constructors[elide constructors]' + '-felide-type[elide types when printing diagnostics]' + '-fembed-bitcode=[embed LLVM bitcode (option: off, all, bitcode, marker)]:option' + '-fembed-bitcode[equivalent to -fembed-bitcode=all]' + '-fembed-bitcode-marker[equivalent to -fembed-bitcode=marker]' + '-femit-all-decls[emit all declarations]' + '-femulated-tls[use emutls functions to access thread_local variables]' + '-fenable-matrix[enable matrix data type and related builtin functions]' + '-fencoding=[encoding]:arg' + '-ferror-limit=[error limit]:arg' + '-fescaping-block-tail-calls[escaping block tail calls]' + '-fexperimental-isel[experimental isel]' + '-fexperimental-new-constant-interpreter[enable the experimental new constant interpreter]' + '-fexperimental-relative-c\+\+-abi-vtables[use the experimental C++ class ABI for classes with vtables]' + '-fexperimental-strict-floating-point[enables experimental strict floating point in LLVM]' + '-fextdirs=[extdirs]:arg' + '-fexternal-blas[external blas]' + '-ff2c[f2c]' + '-ffile-compilation-dir=[the compilation directory to embed in the debug info]:arg' + '-ffile-prefix-map=[remap file source paths in debug info and predefined preprocessor macros]:arg' + '-ffine-grained-bitfield-accesses[use separate accesses for consecutive bitfield runs with legal widths and alignments]' + '-ffinite-loops[assume all loops are finite]' + '-ffixed-form[process source files in fixed form]' + '-ffixed-line-length=[set column after which characters are ignored]:arg' + '-ffixed-point[enable fixed point types]' + '-fforce-dwarf-frame[always emit a debug frame section]' + '-fforce-emit-vtables[emits more virtual tables to improve devirtualization]' + '-fforce-enable-int128[enable support for int128_t type]' + '-ffor-scope[for scope]' + '-ffpe-trap=[fpe trap]:arg' + '-ffp-exception-behavior=[specifies the exception behavior of floating-point operations]:arg' + '-ffp-model=[controls the semantics of floating-point calculations]:arg' + '-ffree-form[process source files in free form]' + '-ffree-line-length-[free line length]:arg' + '-ffrontend-optimize[frontend optimize]' + '-fglobal-isel[enables the global instruction selector]' + '-fgnuc-version=[sets various macros to claim compatibility with the given GCC version]:version' + '-fgnu-inline-asm[gnu inline asm]' + '-fgnu-keywords[allow GNU-extension keywords regardless of language standard]' + '-fgnu-runtime[generate output compatible with the standard GNU Objective-C runtime]' + '-fgpu-allow-device-init[allow device side init function in HIP]' + '-fgpu-defer-diag[defer host/device related diagnostic messages for CUDA/HIP]' + '-fgpu-rdc[generate relocatable device code, also known as separate compilation mode]' + '-fgpu-sanitize[enable sanitizer for AMDGPU target]' + '-fheinous-gnu-extensions[heinous GNU extensions]' + '-fhip-new-launch-api,[-fno-hip-new-launch-api Use new kernel launching API for HIP]' + '-fhonor-infinites[honor infinites]' + '-fhonor-infinities[honor infinities]' + '-fhonor-nans[honor nans]' + '-fignore-exceptions[enable support for ignoring exception handling constructs]' + '-filelist[ilelist]:arg' + '-fimplicit-module-maps[implicit module maps]' + '-fimplicit-modules[implicit modules]' + '-fimplicit-none[no implicit typing allowed unless overridden by IMPLICIT statements]' + '-findirect-virtual-calls[indirect virtual calls]' + '-finit-character=[init character]:arg' + '-finit-integer=[init integer]:arg' + '-finit-local-zero[init local zero]' + '-finit-logical=[init logical]:arg' + '-finit-real=[init real]:arg' + '-finline-hint-functions[inline functions which are (explicitly or implicitly) marked inline]' + '-finstrument-function-entry-bare[instrument function entry only]' + '-finstrument-functions-after-inlining[insert the calls after inlining]' + '-finteger-4-integer-8[integer 4 integer 8]' + '-fintegrated-as[enable the integrated assembler]' + '-fintegrated-cc1[run cc1 in-process]' + '-fintrinsic-modules-path[intrinsic modules path]' + '-flarge-sizes[use INTEGER(KIND=8) for the result type in size-related intrinsics]' + '-flat_namespace[flat namespace]' + '-flegacy-pass-manager[use the legacy pass manager in LLVM]' + '-flimited-precision=[limited precision]:arg' + '-flogical-abbreviations[enable logical abbreviations]' + '-flto=-[generate output files suitable for link time optimization]::style:(full thin)' + '-flto-jobs=[controls the backend parallelism]:arg' + '-fmacro-backtrace-limit=[macro backtrace limit]:limit' + '-fmacro-prefix-map=[remap file source paths in predefined preprocessor macros]:arg' + '-fmax-array-constructor=[max array constructor]:arg' + '-fmax-identifier-length[max identifier length]' + '-fmax-stack-var-size=[max stack var size]:arg' + '-fmax-subrecord-length=[max subrecord length]:arg' + '-fmax-tokens=[max total number of preprocessed tokens for -Wmax-tokens]:number' + '-fmax-type-align=[specify the maximum alignment to enforce on pointers lacking an explicit alignment]:arg' + '-fmemory-profile=[enable heap memory profiling and dump results into <directory>]::directory:_files -/' + '-fmodule-file-deps[module file deps]' + '-fmodule-file=[specify the mapping of module name to precompiled module file]:file:_files' + '-fmodule-implementation-of[module implementation of]:name' + '-fmodule-map-file=[load this module map file]:file:_files' + '-fmodule-maps[implicitly search the file system for module map files.]' + '-fmodule-name=[specify the name of the module to build]:name' + '-fmodule-private[module private]' + '-fmodules-cache-path=[specify the module cache path]:directory:_files -/' + '-fmodules-decluse[require declaration of modules used within a module]' + '-fmodules-disable-diagnostic-validation[disable validation of the diagnostic options when loading the module]' + '-fmodules[enable the modules language feature]' + '-fmodules-ignore-macro=[ignore the definition of the given macro when building and loading modules]:macro' + '-fmodules-prune-after=[specify the interval after which a module file will be considered unused]:seconds' + '-fmodules-prune-interval=[specify the interval between attempts to prune the module cache]:seconds' + '-fmodules-search-all[search even non-imported modules to resolve references]' + '-fmodules-strict-decluse[requires all headers to be in modules]' + '-fmodules-ts[enable support for the C++ Modules TS]' + '-fmodules-user-build-path[specify the module user build path]:directory:_files -/' + '-fmodules-validate-input-files-content[validate PCM input files based on content if mtime differs]' + "-fmodules-validate-once-per-build-session[don't verify input files for the modules]" + '-fmodules-validate-system-headers[validate the system headers that a module depends on when loading the module]' + '-fms-compatibility[enable full Microsoft Visual C++ compatibility]' + '-fms-compatibility-version=[microsoft compiler version number]:arg' + '-fmsc-version=[microsoft compiler version number to report]:arg' + '-fms-memptr-rep=[ms memptr rep]:arg' + '-fms-volatile[ms volatile]' + '-fnested-functions[nested functions]' + '-fnew-alignment=[specifies the largest alignment guaranteed]:align' + '-fnext-runtime[next runtime]' + '-fno-builtin-[disable implicit builtin knowledge of a specific function]:arg' + '-fno-crash-diagnostics[disable auto-generation of preprocessed source files and a script for reproduction during a clang crash]' + '-fno-limit-debug-info[no limit debug info]' + '-fno-max-type-align[no max type align]' + '-fno_modules-validate-input-files-content[no modules validate input files content]' + '-fno_pch-validate-input-files-content[no pch validate input files content]' + '-fno-strict-modules-decluse[no strict modules decluse]' + '-fno-temp-file[directly create compilation output files]' + '-fno-working-directory[no working directory]' + '-fnoxray-link-deps[no xray link deps]' + '-fobjc-abi-version=-[set Objective-C ABI version]:version' + '-fobjc-arc-exceptions[use EH-safe code when synthesizing retains and releases in -fobjc-arc]' + '-fobjc-arc[synthesize retain and release calls for Objective-C pointers]' + '-fobjc-convert-messages-to-runtime-calls[convert messages to runtime calls]' + '-fobjc-encode-cxx-class-template-spec[fully encode C++ class template specialization]' + '-fobjc-exceptions[enable Objective-C exceptions]' + '-fobjc-infer-related-result-type[infer related result type]' + '-fobjc-legacy-dispatch[use legacy dispatch]' + '-fobjc-link-runtime[set link runtime]' + '-fobjc-nonfragile-abi[set nonfragile abi]' + '-fobjc-nonfragile-abi-version=-[set nonfragile abi version]:version' + '-fobjc-runtime=-[specify the target Objective-C runtime kind and version]:runtime' + '-fobjc-sender-dependent-dispatch[set sender dependent dispatch]' + '-fobjc-weak[enable ARC-style weak references in Objective-C]' + '-fopenmp-targets=[specify comma-separated list of triples OpenMP offloading targets to be supported]:targets' + '-fopenmp-version=[openmp version]:version' + '-foperator-arrow-depth=[operator arrow depth]:arg' + '-foperator-names[treat C++ operator name keywords as synonyms for operators]' + '-foptimization-record-file=[specify the output name of the file containing the optimization remarks]:file:_files' + '-foptimization-record-passes=[only include passes which match a specified regex]:regex' + '-force_cpusubtype_ALL[force cpusubtype all]' + '-force_flat_namespace[force flat namespace]' + '--force-link=[force link]:arg' + '-force_load[force load]:argument' + '-forder-file-instrumentation[generate instrumented code to collect order file]' + '-foutput-class-dir=[output class dir]:arg' + '-fpack-derived[pack derived]' + '-fparse-all-comments[parse all comments]' + '-fpascal-strings[recognize and construct Pascal-style string literals]' + '-fpass-plugin=[load pass plugin from a dynamic shared object file]:dsopath' + '-fpatchable-function-entry=[generate NOPs around function entry]:N,M' + '-fpch-codegen[generate code for uses of this PCH]' + '-fpch-debuginfo[generate debug info for types in an object file built from this PCH]' + '-fpch-instantiate-templates[instantiate templates already while building a PCH]' + '-fpch-validate-input-files-content[validate PCH input files based on content]' + '-fprebuilt-implicit-modules[look up implicit modules]' + '-fprebuilt-module-path=[specify the prebuilt module path]:directory:_files -/' + '-fpreserve-as-comments[preserve as comments]' + '-fproc-stat-report=[save subprocess statistics to the given file]:arg' + '-fprofile-exclude-files=[exclude files from profile]:arg' + '-fprofile-filter-files=[filter files for profile]:arg' + '-fprofile-instr-generate=[generate instrumented profile into file]::file:_files' + '-fprofile-instr-use=[use instrumentation data for profile-guided optimization]::arg' + '-fprofile-list=[filename defining the list of items to instrument]:file:_files' + '-fprofile-remapping-file=[use the remappings described in file in profile]:file:_files' + '-fprofile-sample-accurate[specifies that the sample profile is accurate]' + '-fprofile-sample-use=[profile sample use]::arg' + '-fprofile-update=[set update method of profile counters]:method' + '-fprotect-parens[protect parens]' + '-fpseudo-probe-for-profiling[emit pseudo probes for sample profiling]' + '*-framework[include framework found in search path]:framework:->framework' + '-frange-check[range check]' + '-freal-4-real-10[real 4 real 10]' + '-freal-4-real-16[real 4 real 16]' + '-freal-4-real-8[real 4 real 8]' + '-freal-8-real-10[real 8 real 10]' + '-freal-8-real-16[real 8 real 16]' + '-freal-8-real-4[real 8 real 4]' + '-frealloc-lhs[realloc lhs]' + '-frecord-command-line[record command line]' + '-frecord-marker=[record marker]:arg' + '-frecursive[recursive]' + '-fregister-global-dtors-with-atexit[use atexit to register global destructors]' + '-frelaxed-template-template-args[enable C++17 relaxed template template argument matching]' + '-frepack-arrays[repack arrays]' + '-freroll-loops[turn on loop reroller]' + '-fretain-comments-from-system-headers[retain comments from system headers]' + '-frewrite-imports[rewrite imports]' + '-frewrite-includes[rewrite includes]' + '-frewrite-map-file=[rewrite map file]:arg' + '-fropi[generate read-only position independent code (ARM only)]' + '-frtlib-add-rpath[add -rpath with architecture-specific resource directory to the linker flags]' + '-frtti-data[rtti data]' + '-frwpi[generate read-write position independent code (ARM only)]' + '-fsanitize-address-destructor-kind=[set destructor type used in ASan instrumentation]:kind' + '-fsanitize-address-field-padding=[level of field padding for AddressSanitizer]:arg' + '-fsanitize-address-globals-dead-stripping[enable linker dead stripping of globals in AddressSanitizer]' + '-fsanitize-address-poison-custom-array-cookie[enable poisoning array cookies when using custom operator new in AddressSanitizer]' + '-fsanitize-address-use-after-scope[enable use-after-scope detection in AddressSanitizer]' + '-fsanitize-address-use-odr-indicator[enable ODR indicator globals]' + '-fsanitize-blacklist=[path to blacklist file for sanitizers]:arg' + '-fsanitize-cfi-canonical-jump-tables[make the jump table addresses canonical in the symbol table]' + '-fsanitize-cfi-cross-dso[enable control flow integrity (CFI) checks for cross-DSO calls]' + '-fsanitize-cfi-icall-generalize-pointers[generalize pointers in CFI indirect call type signature checks]' + '-fsanitize-coverage-allowlist=[sanitize coverage allowlist]:arg' + '-fsanitize-coverage-blacklist=[disable sanitizer coverage instrumentation]:arg' + '-fsanitize-coverage-blocklist=[sanitize coverage blocklist]:arg' + '-fsanitize-coverage=[specify the type of coverage instrumentation for Sanitizers]:arg' + '-fsanitize-coverage-whitelist=[restrict sanitizer coverage instrumentation]:arg' + '-fsanitize-hwaddress-abi=[select the HWAddressSanitizer ABI to target]:arg' + '-fsanitize-link-c\+\+-runtime[sanitize link c++ runtime]' + '-fsanitize-link-runtime[sanitize link runtime]' + '-fsanitize-memory-track-origins=[enable origins tracking in MemorySanitizer]::arg' + '-fsanitize-memory-use-after-dtor[enable use-after-destroy detection in MemorySanitizer]' + '-fsanitize-minimal-runtime[sanitize minimal runtime]' + '-fsanitize-recover=[enable recovery for specified sanitizers]::arg' + '-fsanitize-stats[enable sanitizer statistics gathering]' + '-fsanitize-system-blacklist[path to system blacklist file for sanitizers]:file:_files' + '-fsanitize-thread-atomics[enable atomic operations instrumentation in ThreadSanitizer (default)]' + '-fsanitize-thread-func-entry-exit[enable function entry/exit instrumentation in ThreadSanitizer]' + '-fsanitize-thread-memory-access[enable memory access instrumentation in ThreadSanitizer]' + '-fsanitize-trap=[enable trapping for specified sanitizers]::arg' + '-fsanitize-undefined-strip-path-components=[strip a given number of path components when emitting check metadata]:number' + '-fsanitize-undefined-trap-on-error[equivalent to -fsanitize-trap=undefined]' + '-fsave-optimization-record=[generate an optimization record file in a specific format]::format' + '-fsecond-underscore[second underscore]' + '-fseh-exceptions[use SEH style exceptions]' + '-fsemantic-interposition[semantic interposition]' + '-fshow-column[show the column]' + '-fshow-overloads=[which overload candidates to show when overload resolution fails]:arg' + '-fshow-source-location[show source location]' + '-fsignaling-math[signaling math]' + '-fsign-zero[sign zero]' + '-fsized-deallocation[enable C++14 sized global deallocation functions]' + '-fsjlj-exceptions[use SjLj style exceptions]' + '-fslp-vectorize[enable the superword-level parallelism vectorization passes]' + '-fspell-checking-limit=[spell checking limit]:arg' + '-fspell-checking[spell checking]' + '-fsplit-dwarf-inlining[provide minimal debug info in the object]' + '-fsplit-lto-unit[enables splitting of the LTO unit]' + '-fsplit-machine-functions[enable late function splitting using profile information]' + '-fstack-arrays[stack arrays]' + '-fstack-clash-protection[enable stack clash protection]' + '-fstack-size-section[emit section containing metadata on function stack sizes]' + '-fstandalone-debug[emit full debug info for all types used by the program]' + '-fstrict-float-cast-overflow[assume that overflowing float-to-int casts are undefined]' + '-fstrict-return[strict return]' + '-fstrict-vtable-pointers[enable optimizations based on the strict vtables]' + '-fstruct-path-tbaa[struct path tbaa]' + '-fsycl[enable SYCL kernels compilation for device]' + '-fsymbol-partition=[symbol partition]:arg' + '-fsystem-module[build this module as a system module. only used with -emit-module]' + '-ftemplate-backtrace-limit=[template backtrace limit]:arg' + '-ftemplate-depth--[template depth]:arg' + '-ftemplate-depth=[template depth]:arg' + '-fterminated-vtables[terminated vtables]' + '-fthin-link-bitcode=[write minimized bitcode to <file>]:file:_files' + '-fthinlto-index=[perform ThinLTO importing using provided index]:arg' + '-fthreadsafe-statics[threadsafe statics]' + '-ftime-trace-granularity=[minimum time granularity traced by time profiler]:microseconds' + '-ftime-trace[turn on time profiler]' + '-ftrap-function=[issue call to specified function rather than a trap instruction]:function name' + '-ftrapv-handler=[specify the function to be called on overflow]:function name' + '-ftrigraphs[process trigraph sequences]' + '-ftrivial-auto-var-init=[initialize trivial automatic stack variables]:arg' + '-ftrivial-auto-var-init-stop-after=[stop initializing trivial automatic stack variables after the specified number of instances]:arg' + '-funderscoring[underscoring]' + '-funique-basic-block-section-names[use unique names for basic block sections]' + '-funique-internal-linkage-names[uniqueify Internal Linkage Symbol Names]' + '-funique-section-names[unique section names]' + '-funit-at-a-time[unit at a time]' + '-fuse-cuid=[method to generate ids for compilation units for single source offloading languages CUDA and HIP]:argument' + '-fuse-cxa-atexit[use cxa atexit]' + '-fuse-init-array[use init array]' + '-fuse-line-directives[use #line in preprocessed output]' + '-fvalidate-ast-input-files-content[compute and store the hash of input files used to build an AST]' + '-fveclib=[use the given vector functions library]:arg' + '-fvectorize[enable the loop vectorization passes]' + '-fvirtual-function-elimination[enables dead virtual function elimination optimization]' + '-fvisibility-dllexport=[the visibility for dllexport definitions]:arg' + '-fvisibility-externs-dllimport=[the visibility for dllimport external declarations]:arg' + '-fvisibility-externs-nodllstorageclass=[the visibility for external declarations without an explicit DLL dllstorageclass]:arg' + '-fvisibility-from-dllstorageclass[set the visibility of symbols in the generated code from their DLL storage class]' + '-fvisibility-global-new-delete-hidden[give global C++ operator new and delete declarations hidden visibility]' + '-fvisibility-inlines-hidden[give inline C++ member functions hidden visibility by default]' + '-fvisibility-inlines-hidden-static-local-var[visibility inlines hidden static local var]' + '-fvisibility-ms-compat[give global types and functions a specific visibility]' + '-fvisibility-nodllstorageclass=[the visibility for defintiions without an explicit DLL export class]:arg' + '-fwasm-exceptions[use WebAssembly style exceptions]' + '-fwhole-file[whole file]' + '-fwhole-program-vtables[enables whole-program vtable optimization]' + '-fwritable-strings[store string literals as writable data]' + '-fxl-pragma-pack[enable IBM XL #pragma pack handling]' + '-fxor-operator[enable .XOR. as a synonym of .NEQV.]' + '-fxray-always-emit-customevents[always emit xray customevent calls]' + '-fxray-always-emit-typedevents[always emit xray typedevents calls]' + '-fxray-always-instrument=[file defining xray always instrument]:file:_files' + '-fxray-attr-list=[file defining the list of xray attributes]:file:_files' + '-fxray-function-groups=[only instrument 1 of N groups]:arg' + '-fxray-function-index[xray function index]' + "-fxray-ignore-loops[don't instrument functions with loops unless they also meet the minimum function size]" + '-fxray-instruction-threshold=[sets the minimum function size to instrument with XRay]:arg' + '-fxray-instrumentation-bundle=[select which XRay instrumentation points to emit]:arg' + '-fxray-instrument[generate XRay instrumentation sleds on function entry and exit]' + '-fxray-link-deps[tells clang to add the link dependencies for XRay]' + '-fxray-modes=[list of modes to link in by default into XRay instrumented binaries]:arg' + '-fxray-never-instrument=[file defining the whitelist for Xray attributes]:file:_files' + '-fxray-selected-function-group=[select which group of functions to instrument]:arg' + '-fzvector[enable System z vector language extension]' + {-gcc-toolchain=,--gcc-toolchain=}'[use the gcc toolchain at the given directory]:directory:_files -/' + '-gcodeview[generate CodeView debug information]' + {-gcodeview-ghash,-gno-codeview-ghash}'[emit type record hashes is a .debug section]' + '-gcolumn-info[column info]' + '-gdwarf-aranges[DWARF aranges]' + '-gembed-source[embed source text in DWARF debug sections]' + '-gfull[emit debugging information for all symbols and types]' + {-G-,-G=-,-msmall-data-limit=,-msmall-data-threshold}'[put objects of at most size bytes into small data section]:size' + '-ggnu-pubnames[gnu pubnames]' + '-ginline-line-tables[inline line tables]' + '-gline-directives-only[emit debug line info directives only]' + '-gline-tables-only[line tables only]' + '-glldb[lldb]' + '-gmlt[emit debug line number tables only]' + '-gmodules[generate debug info with external references]' + '-gno-column-info[no column info]' + '-gno-embed-source[no embed source]' + '-gno-gnu-pubnames[no gnu pubnames]' + '-gno-inline-line-tables[no inline line tables]' + '-gno-record-command-line[no record command line]' + '--gpu-instrument-lib=[instrument device library for HIP]:argument' + '--gpu-max-threads-per-block=[default max threads per block for kernel launch bounds for HIP]' + '-grecord-command-line[record command line]' + '-gsce[sce]' + '-gused[emit debugging information for symbols that are used]' + '-gz=[DWARF debug sections compression type]::arg' + '-headerpad_max_install_names[headerpad max install names]:argument' + '-help[display this information]' + '--help-hidden[display help for hidden options]' + '--hip-device-lib=[hIP device library]:arg' + '--hip-device-lib-path=[hip device lib path]:arg' + '--hip-link[link clang-offload-bundler bundles for HIP]' + '--hip-version=[HIP version in the format of major.minor.patch]' + '-ibuiltininc[enable builtin #include directories even when -nostdinc is used before or after -ibuiltininc]' + '-iframework[add directory to SYSTEM framework search path]:directory:_files -/' + '-iframeworkwithsysroot[add directory to SYSTEM framework search path, absolute paths are relative to -isysroot]:directory:_files -/' + '-image_base[image base]:argument' + '-include-pch[include precompiled header file]:file:_files' + '-index-header-map[make the next included directory (-I or -F) an indexer header map]' + '-init[init]:arg' + '-install_name[install name]:arg' + '-integrated-as[integrated as]' + '-interface-stub-version=[interface stub version]:arg' + '-isystem-after[add directory to end of the SYSTEM include search path]:directory:_files -/' + '-ivfsoverlay[overlay the virtual filesystem described by file over the real file system]:arg' + '-iwithsysroot[add directory to SYSTEM include search path]:directory:_files -/' + '-J[this option specifies where to put .mod files for compiled modules]:arg' + '-keep_private_externs[keep private externs]' + '*-lazy_framework[lazy framework]:framework:->framework' + '*-lazy_library[lazy library]:arg' + '--ld-path=[ld path]:arg' + '--libomptarget-amdgcn-bc-path=[path to libomptarget-amdgcn bitcode library]:arg' + '--libomptarget-nvptx-bc-path=[path to libomptarget-nvptx bitcode library]:arg' + '--library-directory=[add directory to library search path]:directory:_files -/' + '-maix-struct-return[return all structs in memory]' + "-malign-branch-boundary=[specify the boundary's size to align branches]:size" + '-malign-branch=[specify types of branches to align]:arg' + '-mappletvos-version-min=[appletvos version min]:arg' + '-mappletvsimulator-version-min=[appletvsimulator version min]:arg' + '-mbackchain[link stack frames through backchain on System Z]' + '-mbig-endian[big endian]' + '-mbranches-within-32B-boundaries[align selected branches within 32-byte boundary]' + '-mbranch-protection=[enforce targets of indirect branches and function returns]:arg' + '-mcode-object-v3[legacy option to specify code object ABI V3]' + '-mcode-object-version=[specify code object ABI version]:version' + '-mconsole[console]:arg' + '-mcrc[allow use of CRC instructions]' + '-mdefault-build-attributes[default build attributes]:arg' + '-mdll[dll]:arg' + '-mdouble=[force double to be 32 bits or 64 bits]:arg' + '-mdynamic-no-pic[dynamic no pic]:arg' + '-meabi[set EABI type]:arg' + '-menable-experimental-extensions[enable use of experimental RISC-V extensions]' + '-menable-unsafe-fp-math[allow unsafe floating-point math optimizations which may decrease precision]' + '-mfix-cortex-a53-835769[workaround Cortex-A53 erratum 835769]' + '-mfloat-abi=[float abi]:arg' + '-mfpu=[fpu]:arg' + '-mglobal-merge[enable merging of globals]' + '-mharden-sls=[select straight-line speculation hardening scope]:arg' + '--mhwdiv=[hwdiv]:arg' + '-mhwdiv=[hwdiv]:arg' + '-mhwmult=[hwmult]:arg' + '-mignore-xcoff-visibility[do not emit the visibility attribute for asm]' + '--migrate[run the migrator]' + '-mimplicit-float[implicit float]' + '-mimplicit-it=[implicit it]:arg' + '-mincremental-linker-compatible[emit an object file which can be used with an incremental linker]' + '-mios-simulator-version-min=[ios simulator version min]:arg' + '-mios-version-min=[ios version min]:arg' + '-miphoneos-version-min=[iphoneos version min]:arg' + '-miphonesimulator-version-min=[iphonesimulator version min]:arg' + '-mkernel[kernel]' + '-mlinker-version=[linker version]:arg' + '-mlittle-endian[little endian]' + "-mllvm[additional arguments to forward to LLVM's option processing]:arg" + '-mlong-calls[generate branches with extended addressability]' + '-mlvi-cfi[enable only control-flow mitigations for Load Value Injection]' + '-mlvi-hardening[enable all mitigations for Load Value Injection]' + '-mmacos-version-min=[set Mac OS X deployment target]:arg' + '-mmacosx-version-min=[macosx version min]:arg' + '-mmcu=[mcu]:arg' + '-module-dependency-dir[directory to dump module dependencies to]:arg' + '-module-dir[odule dir]:dir' + '-module-file-info[provide information about a particular module file]' + '-moslib=[oslib]:arg' + '-moutline-atomics[generate local calls to out-of-line atomic operations]' + '-mpacked-stack[use packed stack layout]' + '-mpad-max-prefix-size=[specify maximum number of prefixes to use for padding]:arg' + '-mpie-copy-relocations[pie copy relocations]' + '-mprefer-vector-width=[specifies preferred vector width]:arg' + '-mqdsp6-compat[enable hexagon-qdsp6 backward compatibility]' + '-mrelax-all[relax all machine instructions]' + '-mrelax[enable linker relaxation]' + '-mretpoline[retpoline]' + '-mseses[enable speculative execution side effect suppression (SESES)]' + '-msign-return-address=[select return address signing scope]:arg' + '-msim[sim]' + '-mspeculative-load-hardening[speculative load hardening]' + '-mstack-alignment=[set the stack alignment]:arg' + '-mstack-probe-size=[set the stack probe size]:size' + '-mstack-protector-guard-offset=[use the given offset for addressing the stack-protector guard]:arg' + '-mstack-protector-guard-reg=[use the given reg for addressing the stack-protector guard]:reg' + '-msvr4-struct-return[return small structs in registers]' + '-mthread-model[the thread model to use]:arg' + '-mthumb[thumb]' + '-mtls-size=[specify bit size of immediate TLS offsets]:arg' + '-mtvos-simulator-version-min=[tvos simulator version min]:arg' + '-mtvos-version-min=[tvos version min]:arg' + '-multi_module[multi module]' + '-multiply_defined[multiply defined]:arg' + '-multiply_defined_unused[multiply defined unused]:arg' + '-municode[unicode]:arg' + '-munsafe-fp-atomics[enable unsafe floating point atomic instructions]' + '-mv55[equivalent to -mcpu=hexagonv55]' + '-mv5[equivalent to -mcpu=hexagonv5]' + '-mv60[equivalent to -mcpu=hexagonv60]' + '-mv62[equivalent to -mcpu=hexagonv62]' + '-mv65[equivalent to -mcpu=hexagonv65]' + '-mv66[equivalent to -mcpu=hexagonv66]' + '-mv67[equivalent to -mcpu=hexagonv67]' + '-mv67t[equivalent to -mcpu=hexagonv67t]' + '-mv68[equivalent to -mcpu=hexagonv68]' + '-mvx[vx]' + '-mwarn-nonportable-cfstrings[warn nonportable cfstrings]' + '-mwatchos-simulator-version-min=[watchos simulator version min]:arg' + '-mwatchos-version-min=[watchos version min]:arg' + '-mwatchsimulator-version-min=[watchsimulator version min]:arg' + '-mwavefrontsize64[specify wavefront size 64 mode]' + '-mwindows[windows]:arg' + '-mzvector[zvector]' + '-nobuiltininc[do not search builtin directory for include files]' + '-nocpp[no cpp]' + '-nocudainc[do not add include paths for CUDA/HIP and do not include the default CUDA/HIP wrapper headers]' + '*--no-cuda-include-ptx=[do not include ptx for the following gpu architecture]:argument' + '-nocudalib[do not link device library for CUDA/HIP device compilation]' + '--no-cuda-noopt-device-debug[disable device-side debug info generation]' + "--no-cuda-version-check[don't error out if the detected version of the CUDA install is too low for the requested CUDA gpu architecture]" + '-no_dead_strip_inits_and_terms[no dead strip inits and terms]' + '-nofixprebinding[no fixprebinding]' + '-nogpuinc[no gpuinc]' + '-nogpulib[no gpulib]' + '--no-integrated-cpp[no integrated cpp]' + '-no-integrated-cpp[no integrated cpp]' + '-nolibc[no libc]' + '-nomultidefs[no multidefs]' + '--no-offload-arch=[no offload arch]:arg' + '-no-pie[no pie]' + '-nopie[no pie]' + '-noprebind[no prebind]' + '-noprofilelib[no profilelib]' + '-no-pthread[no pthread]' + '-noseglinkedit[no seglinkedit]' + '--no-standard-libraries[no standard libraries]' + '-nostdinc\+\+[disable standard #include directories for the C++ standard library]' + '-nostdlibinc[do not search standard system directories for include files]' + '-nostdlib\+\+[no stdlib++]' + '--no-system-header-prefix=[no system header prefix]:prefix' + '--no-undefined[no undefined]' + '-objcmt-atomic-property[make migration to atomic properties]' + '-objcmt-migrate-all[enable migration to modern ObjC]' + '-objcmt-migrate-annotation[enable migration to property and method annotations]' + '-objcmt-migrate-designated-init[enable migration to infer NS_DESIGNATED_INITIALIZER for initializer methods]' + '-objcmt-migrate-instancetype[enable migration to infer instancetype for method result type]' + '-objcmt-migrate-literals[enable migration to modern ObjC literals]' + '-objcmt-migrate-ns-macros[enable migration to NS_ENUM/NS_OPTIONS macros]' + '-objcmt-migrate-property-dot-syntax[enable migration of setter/getter messages to property-dot syntax]' + '-objcmt-migrate-property[enable migration to modern ObjC property]' + '-objcmt-migrate-protocol-conformance[enable migration to add protocol conformance on classes]' + '-objcmt-migrate-readonly-property[enable migration to modern ObjC readonly property]' + '-objcmt-migrate-readwrite-property[enable migration to modern ObjC readwrite property]' + '-objcmt-migrate-subscripting[enable migration to modern ObjC subscripting]' + "-objcmt-ns-nonatomic-iosonly[enable migration to use NS_NONATOMIC_IOSONLY macro for setting property's atomic attribute]" + '-objcmt-returns-innerpointer-property[enable migration to annotate property with NS_RETURNS_INNER_POINTER]' + '-objcmt-whitelist-dir-path=[objcmt whitelist dir path]:arg' + '-objcmt-white-list-dir-path=[only modify files with a filename contained in the provided directory path]:arg' + '-ObjC[treat source files as Objective-C]' + '-ObjC\+\+[treat source files as Objective-C++]' + '-object[object]' + '--offload-arch=[offload arch]:arg' + '--output-class-directory=[output class directory]:arg' + '-pagezero_size[pagezero size]:arg' + '-pg[enable mcount instrumentation]' + {-p,--profile}'[enable function profiling for prof]' + '-prebind_all_twolevel_modules[prebind all twolevel modules]' + '-prebind[prebind]' + '--precompile[only precompile the input]' + '-preload[preload]' + '--print-diagnostic-categories[print diagnostic categories]' + '-print-effective-triple[print effective triple]' + '--print-effective-triple[print the effective target triple]' + '--print-file-name=[print the full library path of <file>]:file:_files' + '-print-ivar-layout[enable Objective-C Ivar layout bitmap print trace]' + '--print-libgcc-file-name[print the library path for the currently used compiler runtime library]' + '--print-multi-directory[print multi directory]' + '--print-multi-lib[print multi lib]' + '--print-prog-name=[print the full program path of <name>]:name' + '-print-resource-dir[print resource dir]' + '--print-resource-dir[print the resource directory pathname]' + '--print-search-dirs[print the paths used for finding libraries and programs]' + '--print-supported-cpus[print supported cpus]' + '-print-supported-cpus[print supported cpus]' + '-print-targets[print targets]' + '--print-targets[print the registered targets]' + '-print-target-triple[print target triple]' + '--print-target-triple[print the normalized target triple]' + '-private_bundle[private bundle]' + '--profile-blocks[undocumented option]' + '-pthreads[pthreads]' + '-pthread[support POSIX threads in generated code]' + '--ptxas-path=[path to ptxas (used for compiling CUDA code)]:arg' + "-Qunused-arguments[don't emit warning for unused driver arguments]" + '-read_only_relocs[read only relocs]:arg' + '-relocatable-pch[relocatable pch]' + '--relocatable-pch[whether to build a relocatable precompiled header]' + '-R[enable the specified remark]:remark' + '--resource=[resource]:arg' + '-rewrite-legacy-objc[rewrite Legacy Objective-C source to C++]' + '-rewrite-objc[rewrite Objective-C source to C++]' + '--rocm-device-lib-path=[rOCm device library path]:arg' + '--rocm-path=[rOCm installation path]:arg' + '-Rpass-analysis=[report transformation analysis from optimization passes]:regex' + '-Rpass-missed=[report missed transformations by optimization passes]:arg' + '-Rpass=[report transformations performed by optimization passes]:arg' + '-rpath[rpath]:arg' + '-r[product a relocatable object as output]' + '--rtlib=[compiler runtime library to use]:arg' + '-rtlib=[rtlib]:arg' + '--save-stats=[save llvm statistics]:arg' + '-sectalign[sectalign]:arg' + '-sectcreate[sectcreate]:arg' + '-sectobjectsymbols[sectobjectsymbols]:arg' + '-sectorder[sectorder]:arg' + '-seg1addr[seg1addr]:arg' + '-segaddr[segaddr]:arg' + '-seg_addr_table_filename[seg addr table filename]:arg' + '-seg_addr_table[seg addr table]:arg' + '-segcreate[segcreate]:arg' + '-seglinkedit[seglinkedit]' + '-segprot[segprot]:arg' + '-segs_read_only_addr[segs read only addr]:arg' + '-segs_read_[segs read]:arg' + '-segs_read_write_addr[segs read write addr]:arg' + '--serialize-diagnostics[serialize compiler diagnostics to a file]:arg' + '-serialize-diagnostics[serialize diagnostics]:arg' + '-shared-libasan[dynamically link the sanitizer runtime]' + '-shared-libsan[shared libsan]' + '--shared[shared]' + '--signed-char[signed char]' + '-single_module[single module]' + '--specs=[specs]:arg' + '-static-libgfortran[static libgfortran]' + '-static-libsan[statically link the sanitizer runtime]' + '-static-libstdc\+\+[static libstdc++]' + '-static-openmp[use the static host OpenMP runtime while linking.]' + '-static-pie[static pie]' + '--static[static]' + '-std-default=[std default]:arg' + '--stdlib=[c++ standard library to use]:arg' + '-stdlib\+\+-isystem[use directory as the C++ standard library include path]:directory:_files -/' + '-stdlib=[stdlib]:arg' + '-sub_library[sub library]:arg' + '-sub_umbrella[sub umbrella]:arg' + '-sycl-std=[SYCL language standard to compile for]:standard' + '--system-header-prefix=[treat all #include paths starting with <prefix> as including a system header]:prefix' + '-target[generate code for the given target]:arg' + '--target=[target]:arg' + '-Tbss[set starting address of BSS to <addr>]:addr' + '-Tdata[set starting address of DATA to <addr>]:addr' + '--traditional[traditional]' + '-traditional[traditional]' + '-Ttext[set starting address of TEXT to <addr>]:addr' + '-t[undocumented option]' + '-twolevel_namespace_hints[twolevel namespace hints]' + '-twolevel_namespace[twolevel namespace]' + '-umbrella[umbrella]:arg' + '-undefined[undefined]:arg' + '-unexported_symbols_list[unexported symbols list]:arg' + '--unsigned-char[unsigned char]' + '--unwindlib=[unwind library to use]:arg' + '-unwindlib=[unwindlib]:arg' + '--verify-debug-info[verify the binary representation of debug output]' + '-verify-pch[load and verify that a pre-compiled header file is not stale]' + '--warn-=-[enable the specified warning]:warning:->warning' + '*-weak_framework[weak framework]:framework:->framework' + '*-weak_library[weak library]:arg' + '-weak-l[weak l]:arg' + '-weak_reference_mismatches[weak reference mismatches]:arg' + '-whatsloaded[whatsloaded]' + '-whyload[whyload]' + '-working-directory=[resolve file paths relative to the specified directory]:arg' + '-Xanalyzer[pass <arg> to the static analyzer]:arg' + '-Xarch_device[pass arg to CUDA/HIP device compilation]:argument' + '-Xarch_host[pass arg to CUDA/HIP host compilation]:argument' + '-Xclang[pass <arg> to the clang compiler]:arg' + '-Xcuda-fatbinary[pass arg to fatbinary invocation]:argument' + '-Xcuda-ptxas[pass arg to the ptxas assemler]:argument' + '-Xflang[pass <arg> to the flang compiler]:arg' + '-Xopenmp-target[pass arg to the the target offloading toolchain]:argument' + '-y[the action to perform on the input]:arg' + '-Z-[undocumented option]:argument' + ) else - args+=( - '-flto=-[Enable link-time optimization]::jobs:' - '*--help=-[Display this information]:class:->help' - ) + args+=( + '--dump=[dump information]:argument' + '-flto=-[enable link-time optimization]::jobs:' + '*--help=-[display this information]:class:->help' + ) fi local -a sanitizers - sanitizers=( - address alignment bool bounds enum float-cast-overflow float-divide-by-zero - integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign - nullability-return object-size pointer-overflow return unsigned-integer-overflow - returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr - ) +sanitizers=( + address alignment bool bounds enum float-cast-overflow float-divide-by-zero + integer-divide-by-zero memory nonnull-attribute null nullability-arg + nullability-assign nullability-return object-size pointer-overflow return + unsigned-integer-overflow returns-nonnull-attribute shift signed-integer-overflow + unreachable vla-bound vptr +) local -a languages languages=( - c c-header cpp-output - c++ c++-header c++-cpp-output - objective-c objective-c-header objective-c-cpp-output - objective-c++ objective-c++-header objective-c++-cpp-output - assembler assembler-with-cpp - ada - f77 f77-cpp-input f95 f95-cpp-input - go - java - brig - none -) - -# generic options (from --help) -args+=( - '-###[print commands to run this compilation]' - '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"' - '-x[Specify the language of the following input files]:input file language:('"$languages"')' - '+e-:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' - '-d-:dump:->dump' - '-g-::debugging information type or level:(0 1 2 3 gdb coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 xcoff xcoff+)' - '-O-::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))' - '*-M-::output dependencies:((M\:only\ user\ header\ files MD\:output\ to\ file G\:treat\ missing\ header\ files\ as\ generated))' - '*-A-:define assertion:' - '*-D-:define macro:' - '*-U-:undefine macro:' - '-C[do not discard comments during preprocess]' - '-CC[do not discard comments, including macro expansion]' - '-P[inhibit generation of linkemakers during preprocess]' - '-H[print name of each header file used]' - '-E[Preprocess only; do not compile, assemble or link]' - '-S[Compile only; do not assemble or link]' - '-c[Compile and assemble, but do not link]' - '*-Wp,-:preprocessor option:' - '*-Wl,-:linker option:' - '*-Xpreprocessor:preprocessor option:' - '*-Xlinker:linker option:' - '*-Xassembler:assembler option:' - '*-u:pretend symbol to be undefined:' - '*-Wa,-:assembler option:' - '*-l:library:->library' - '*-L-:library search path:_files -/' - '*-I-:header file search path:_files -/' - '-B-[Add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/' - '-b:target machine:' - '-V:specify compiler version:' - '--version[Display compiler version information]' - '-print-file-name=-[Display the full path to library <library>]:library:->library' - '-print-prog-name=-[Display the full path to compiler component <program>]:program:' - '*-specs=-[Override built-in specs with the contents of <file>]:file:_files' - '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)' - '*-include:include file:_files -g \*.h\(-.\)' - '*-imacros:macro input file:_files -g \*.h\(-.\)' - '*-idirafter:second include path directory:_files -/' - '*-iprefix:prefix:_files' - '*-iwithprefix:second include path directory:_files -/' - '*-iwithprefixbefore:main include path directory:_files -/' - '*-isystem:second include path directory (system):_files -/' - '--sysroot=-[Use <directory> as the root directory for headers and libraries]:directory:_files -/' - '-pass-exit-codes[Exit with highest error code from a phase]' - '--target-help[Display target specific command line options]' - '-dumpspecs[Display all of the built in spec strings]' - '-dumpversion[Display the version of the compiler]' - '-dumpmachine[Display the compiler'\''s target processor]' - '-print-search-dirs[Display the directories in the compiler'\''s search path]' - '-print-libgcc-file-name[Display the name of the compiler'\''s companion library]' - '-print-multiarch[Display the target'\''s normalized GNU triplet, used as a component in the library path]' - '-print-multi-directory[Display the root directory for versions of libgcc]' - '-print-multi-lib[Display the mapping between command line options and multiple library search directories]' - '-print-multi-os-directory[Display the relative path to OS libraries]' - '-print-sysroot[Display the target libraries directory]' - '-print-sysroot-headers-suffix[Display the sysroot suffix used to find headers]' - '-save-stats=-[Save code generation statistics]:location:(cwd obj)' - '-save-temps[Do not delete intermediate files]' - '-no-canonical-prefixes[Do not canonicalize paths when building relative prefixes to other gcc components]' - '-pipe[Use pipes rather than intermediate files]' - '-pie[Create a position independent executable]' - '-shared[Create a shared library]' - '-time[Time the execution of each subprocess]' + c c-header cpp-output c++ c++-header c++-cpp-output objective-c objective-c-header + objective-c-cpp-output objective-c++ objective-c++-header objective-c++-cpp-output + assembler assembler-with-cpp ada f77 f77-cpp-input f95 f95-cpp-input go java + brig none ) # warnings (from --help=warnings), note some -W options are listed by --help=common instead -args+=( -# --help=warnings,^joined - '-W[This switch is deprecated; use -Wextra instead]' - '-Wabi-tag[Warn if a subobject has an abi_tag attribute that the complete object type does not have]' - '-Wabi[Warn about things that will change when compiling with an ABI-compliant compiler]' - '-Waddress[Warn about suspicious uses of memory addresses]' - '-Waggregate-return[Warn about returning structures, unions or arrays]' - '-Waggressive-loop-optimizations[Warn if a loop with constant number of iterations triggers undefined behavior]' - '-Waliasing[Warn about possible aliasing of dummy arguments]' - '-Walign-commons[Warn about alignment of COMMON blocks]' - '-Wall[Enable most warning messages]' - '-Walloc-zero[Warn for calls to allocation functions that specify zero bytes]' - '-Walloca[Warn on any use of alloca]' - '-Wampersand[Warn about missing ampersand in continued character constants]' - '-Wargument-mismatch[Warn about type and rank mismatches between arguments and parameters]' - '-Warray-bounds[Warn if an array is accessed out of bounds]' - '-Warray-temporaries[Warn about creation of array temporaries]' - '-Wassign-intercept[Warn whenever an Objective-C assignment is being intercepted by the garbage collector]' - '-Wattributes[Warn about inappropriate attribute usage]' - '-Wbad-function-cast[Warn about casting functions to incompatible types]' - '-Wbool-compare[Warn about boolean expression compared with an integer value different from true/false]' - '-Wbool-operation[Warn about certain operations on boolean expressions]' - '-Wbuiltin-declaration-mismatch[Warn when a built-in function is declared with the wrong signature]' - '-Wbuiltin-macro-redefined[Warn when a built-in preprocessor macro is undefined or redefined]' - '-Wc++-compat[Warn about C constructs that are not in the common subset of C and C++]' - '-Wc++0x-compat[Deprecated in favor of -Wc++11-compat]' - '-Wc++1z-compat[Warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]' - '-Wc++11-compat[Warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]' - '-Wc++14-compat[Warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]' - '-Wc-binding-type[Warn if the type of a variable might be not interoperable with C]' - '-Wc90-c99-compat[Warn about features not present in ISO C90, but present in ISO C99]' - '-Wc99-c11-compat[Warn about features not present in ISO C99, but present in ISO C11]' - '-Wcast-align[Warn about pointer casts which increase alignment]' - '-Wcast-qual[Warn about casts which discard qualifiers]' - '-Wchar-subscripts[Warn about subscripts whose type is "char"]' - '-Wcharacter-truncation[Warn about truncated character expressions]' - '-Wchkp[Warn about memory access errors found by Pointer Bounds Checker]' - '-Wclobbered[Warn about variables that might be changed by "longjmp" or "vfork"]' - '-Wcomment[Warn about possibly nested block comments, and C++ comments spanning more than one physical line]' - '-Wcomments[Synonym for -Wcomment]' - '-Wcompare-reals[Warn about equality comparisons involving REAL or COMPLEX expressions]' - '-Wconditionally-supported[Warn for conditionally-supported constructs]' - '-Wconversion-extra[Warn about most implicit conversions]' - '-Wconversion-null[Warn for converting NULL from/to a non-pointer type]' - '-Wconversion[Warn for implicit type conversions that may change a value]' - '-Wcoverage-mismatch[Warn in case profiles in -fprofile-use do not match]' - '-Wcpp[Warn when a #warning directive is encountered]' - '-Wctor-dtor-privacy[Warn when all constructors and destructors are private]' - '-Wdangling-else[Warn about dangling else]' - '-Wdate-time[Warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]' - '-Wdeclaration-after-statement[Warn when a declaration is found after a statement]' - '-Wdelete-incomplete[Warn when deleting a pointer to incomplete type]' - '-Wdelete-non-virtual-dtor[Warn about deleting polymorphic objects with non- virtual destructors]' - '-Wdeprecated-declarations[Warn about uses of __attribute__((deprecated)) declarations]' - '-Wdeprecated[Warn if a deprecated compiler feature, class, method, or field is used]' - '-Wdesignated-init[Warn about positional initialization of structs requiring designated initializers]' - '-Wdisabled-optimization[Warn when an optimization pass is disabled]' - '-Wdiscarded-array-qualifiers[Warn if qualifiers on arrays which are pointer targets are discarded]' - '-Wdiscarded-qualifiers[Warn if type qualifiers on pointers are discarded]' - '-Wdiv-by-zero[Warn about compile-time integer division by zero]' - '-Wdouble-promotion[Warn about implicit conversions from "float" to "double"]' - '-Weffc\+\+[Warn about violations of Effective C++ style rules]' - '-Wduplicate-decl-specifier[Warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]' - '-Wduplicated-branches[Warn about duplicated branches in if-else statements]' - '-Wduplicated-cond[Warn about duplicated conditions in an if-else-if chain]' - '-Weffc++[Warn about violations of Effective C++ style rules]' - '-Wempty-body[Warn about an empty body in an if or else statement]' - '-Wendif-labels[Warn about stray tokens after #else and #endif]' - '-Wenum-compare[Warn about comparison of different enum types]' -#this still exists but makes completing -Werror= less convenient - #'-Werror-implicit-function-declaration[This switch is deprecated; use -Werror=implicit-fun - '-Wexpansion-to-defined[Warn if "defined" is used outside #if]' - '-Wextra[Print extra (possibly unwanted) warnings]' - '-Wfloat-conversion[Warn for implicit type conversions that cause loss of floating point precision]' - '-Wfloat-equal[Warn if testing floating point numbers for equality]' - '-Wformat-contains-nul[Warn about format strings that contain NUL bytes]' - '-Wformat-extra-args[Warn if passing too many arguments to a function for its format string]' - '-Wformat-nonliteral[Warn about format strings that are not literals]' - '-Wformat-overflow[Warn about function calls with format strings that write past the end of the destination region]' - '-Wformat-security[Warn about possible security problems with format functions]' - '-Wformat-signedness[Warn about sign differences with format functions]' - '-Wformat-truncation[Warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1. Same as -Wformat-truncation=]' - '-Wformat-y2k[Warn about strftime formats yielding 2-digit years]' - '-Wformat-zero-length[Warn about zero-length formats]' - '-Wformat[Warn about printf/scanf/strftime/strfmon format string anomalies]' - '-Wframe-address[Warn when __builtin_frame_address or __builtin_return_address is used unsafely]' - '-Wfree-nonheap-object[Warn when attempting to free a non-heap object]' - '-Wfunction-elimination[Warn about function call elimination]' - '-Whsa[Warn when a function cannot be expanded to HSAIL]' - '-Wignored-attributes[Warn whenever attributes are ignored]' - '-Wignored-qualifiers[Warn whenever type qualifiers are ignored]' - '-Wimplicit-function-declaration[Warn about implicit function declarations]' - '-Wimplicit-int[Warn when a declaration does not specify a type]' - '-Wimplicit-interface[Warn about calls with implicit interface]' - '-Wimplicit-procedure[Warn about called procedures not explicitly declared]' - '-Wimplicit[Warn about implicit declarations]' - '-Wincompatible-pointer-types[Warn when there is a conversion between pointers that have incompatible types]' - '-Winherited-variadic-ctor[Warn about C++11 inheriting constructors when the base has a variadic constructor]' - '-Winit-self[Warn about variables which are initialized to themselves]' - '-Winline[Warn when an inlined function cannot be inlined]' - '-Wint-conversion[Warn about incompatible integer to pointer and pointer to integer conversions]' - '-Wint-in-bool-context[Warn for suspicious integer expressions in boolean context]' - '-Wint-to-pointer-cast[Warn when there is a cast to a pointer from an integer of a different size]' - '-Winteger-division[Warn about constant integer divisions with truncated results]' - '-Wintrinsic-shadow[Warn if a user-procedure has the same name as an intrinsic]' - '-Wintrinsics-std[Warn on intrinsics not part of the selected standard]' - '-Winvalid-memory-model[Warn when an atomic memory model parameter is known to be outside the valid range]' - '-Winvalid-offsetof[Warn about invalid uses of the "offsetof" macro]' - '-Winvalid-pch[Warn about PCH files that are found but not used]' - '-Wjump-misses-init[Warn when a jump misses a variable initialization]' - '-Wline-truncation[Warn about truncated source lines]' - '-Wliteral-suffix[Warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]' - '-Wlogical-not-parentheses[Warn when logical not is used on the left hand side operand of a comparison]' - '-Wlogical-op[Warn when a logical operator is suspiciously always evaluating to true or false]' - '-Wlong-long[Do not warn about using "long long" when -pedantic]' - '-Wlto-type-mismatch[During link time optimization warn about mismatched types of global declarations]' - '-Wmain[Warn about suspicious declarations of "main"]' - '-Wmaybe-uninitialized[Warn about maybe uninitialized automatic variables]' - '-Wmemset-elt-size[Warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]' - '-Wmemset-transposed-args[Warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]' - '-Wmisleading-indentation[Warn when the indentation of the code does not reflect the block structure]' - '-Wmissing-braces[Warn about possibly missing braces around initializers]' - '-Wmissing-declarations[Warn about global functions without previous declarations]' - '-Wmissing-field-initializers[Warn about missing fields in struct initializers]' - '-Wmissing-include-dirs[Warn about user-specified include directories that do not exist]' - '-Wmissing-parameter-type[Warn about function parameters declared without a type specifier in K&R-style functions]' - '-Wmissing-prototypes[Warn about global functions without prototypes]' - '-Wmudflap[Warn about constructs not instrumented by -fmudflap]' - '-Wmultichar[Warn about use of multi-character character constants]' - '-Wmultiple-inheritance[Warn on direct multiple inheritance]' - '-Wnamespaces[Warn on namespace definition]' - '-Wnarrowing[Warn about narrowing conversions within { } that are ill-formed in C++11]' - '-Wnested-externs[Warn about "extern" declarations not at file scope]' - '-Wnoexcept-type[Warn if C++1z noexcept function type will change the mangled name of a symbol]' - '-Wnoexcept[Warn when a noexcept expression evaluates to false even though the expression can''t actually throw]' - '-Wnon-template-friend[Warn when non-templatized friend functions are declared within a template]' - '-Wnon-virtual-dtor[Warn about non-virtual destructors]' - '-Wnonnull-compare[Warn if comparing pointer parameter with nonnull attribute with NULL]' - '-Wnonnull[Warn about NULL being passed to argument slots marked as requiring non-NULL]' - '-Wnull-dereference[Warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]' - '-Wodr[Warn about some C++ One Definition Rule violations during link time optimization]' - '-Wold-style-cast[Warn if a C-style cast is used in a program]' - '-Wold-style-declaration[Warn for obsolescent usage in a declaration]' - '-Wold-style-definition[Warn if an old-style parameter definition is used]' - '-Wopenmp-simd[Warn if a simd directive is overridden by the vectorizer cost model]' - '-Woverflow[Warn about overflow in arithmetic expressions]' - '-Woverlength-strings[Warn if a string is longer than the maximum portable length specified by the standard]' - '-Woverloaded-virtual[Warn about overloaded virtual function names]' - '-Woverride-init-side-effects[Warn about overriding initializers with side effects]' - '-Woverride-init[Warn about overriding initializers without side effects]' - '-Wpacked-bitfield-compat[Warn about packed bit-fields whose offset changed in GCC 4.4]' - '-Wpacked[Warn when the packed attribute has no effect on struct layout]' - '-Wpadded[Warn when padding is required to align structure members]' - '-Wparentheses[Warn about possibly missing parentheses]' - '-Wpedantic[Issue warnings needed for strict compliance to the standard]' - '-Wplacement-new[Warn for placement new expressions with undefined behavior. Same as -Wplacement-new=]' - '-Wpmf-conversions[Warn when converting the type of pointers to member functions]' - '-Wpointer-arith[Warn about function pointer arithmetic]' - '-Wpointer-compare[Warn when a pointer is compared with a zero character constant]' - '-Wpointer-sign[Warn when a pointer differs in signedness in an assignment]' - '-Wpointer-to-int-cast[Warn when a pointer is cast to an integer of a different size]' - '-Wpoison-system-directories[Warn for -I and -L options using system directories if cross compiling]' - '-Wpragmas[Warn about misuses of pragmas]' - '-Wproperty-assign-default[Warn if a property for an Objective-C object has no assign semantics specified]' - '-Wprotocol[Warn if inherited methods are unimplemented]' - '-Wreal-q-constant[Warn about real-literal-constants with '\'q\'' exponent-letter]' - '-Wrealloc-lhs-all[Warn when a left-hand-side variable is reallocated]' - '-Wrealloc-lhs[Warn when a left-hand-side array variable is reallocated]' - '-Wredundant-decls[Warn about multiple declarations of the same object]' - '-Wregister[Warn about uses of register storage specifier]' - '-Wreorder[Warn when the compiler reorders code]' - '-Wrestrict[Warn when an argument passed to a restrict- qualified parameter aliases with another argument]' - '-Wreturn-local-addr[Warn about returning a pointer/reference to a local or temporary variable]' - '-Wreturn-type[Warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]' - '-Wscalar-storage-order[Warn on suspicious constructs involving reverse scalar storage order]' - '-Wselector[Warn if a selector has multiple methods]' - '-Wsequence-point[Warn about possible violations of sequence point rules]' - '-Wshadow-ivar[Warn if a local declaration hides an instance variable]' - '-Wshadow[Warn when one variable shadows another. Same as -Wshadow=global]' - '-Wshift-count-negative[Warn if shift count is negative]' - '-Wshift-count-overflow[Warn if shift count >= width of type]' - '-Wshift-negative-value[Warn if left shifting a negative value]' - '-Wshift-overflow[Warn if left shift of a signed value overflows. Same as -Wshift-overflow=]' - '-Wsign-compare[Warn about signed-unsigned comparisons]' - '-Wsign-conversion[Warn for implicit type conversions between signed and unsigned integers]' - '-Wsign-promo[Warn when overload promotes from unsigned to signed]' - '-Wsized-deallocation[Warn about missing sized deallocation functions]' - '-Wsizeof-array-argument[Warn when sizeof is applied on a parameter declared as an array]' - '-Wsizeof-pointer-memaccess[Warn about suspicious length parameters to certain string functions if the argument uses sizeof]' - '-Wstack-protector[Warn when not issuing stack smashing protection for some reason]' - '-Wstrict-aliasing[Warn about code which might break strict aliasing rules]' - '-Wstrict-null-sentinel[Warn about uncasted NULL used as sentinel]' - '-Wstrict-overflow[Warn about optimizations that assume that signed overflow is undefined]' - '-Wstrict-prototypes[Warn about unprototyped function declarations]' - '-Wstrict-selector-match[Warn if type signatures of candidate methods do not match exactly]' - '-Wstringop-overflow[Warn about buffer overflow in string manipulation functions like memcpy and strcpy. Same as -Wstringop-overflow=]' - '-Wsubobject-linkage[Warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]' +warnings+=( + '-Wabi-tag[warn if a subobject has an abi_tag attribute that the complete object type does not have]' + '-Wabi[warn about things that will change when compiling with an ABI-compliant compiler]::' + '-Waddress[warn about suspicious uses of memory addresses]' + '-Waggregate-return[warn about returning structures, unions or arrays]' + '-Waggressive-loop-optimizations[warn if a loop with constant number of iterations triggers undefined behavior]' + '-Waliasing[warn about possible aliasing of dummy arguments]' + '-Walign-commons[warn about alignment of COMMON blocks]' + '-Waligned-new=[warn even if '\'new\'' uses a class member allocation function]:none|global|all: ' + '-Wall[enable most warning messages]' + '-Walloca-larger-than=[warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: ' + '-Walloca[warn on any use of alloca]' + '-Walloc-size-larger-than=[warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: ' + '-Walloc-zero[warn for calls to allocation functions that specify zero bytes]' + '-Wampersand[warn about missing ampersand in continued character constants]' + '-Wargument-mismatch[warn about type and rank mismatches between arguments and parameters]' + '-Warray-bounds[warn if an array is accessed out of bounds]' + '-Warray-bounds=[warn if an array is accessed out of bounds]:level:(1 2)' + '-Warray-temporaries[warn about creation of array temporaries]' + '-Wassign-intercept[warn whenever an Objective-C assignment is being intercepted by the garbage collector]' + '-Wattributes[warn about inappropriate attribute usage]' + '-Wbad-function-cast[warn about casting functions to incompatible types]' + '-Wbool-compare[warn about boolean expression compared with an integer value different from true/false]' + '-Wbool-operation[warn about certain operations on boolean expressions]' + '-Wbuiltin-declaration-mismatch[warn when a built-in function is declared with the wrong signature]' + '-Wbuiltin-macro-redefined[warn when a built-in preprocessor macro is undefined or redefined]' + '-Wc++0x-compat[deprecated in favor of -Wc++11-compat]' + '-Wc++11-compat[warn about C++ constructs whose meaning differs between ISO C++ 1998 and ISO C++ 2011]' + '-Wc++14-compat[warn about C++ constructs whose meaning differs between ISO C++ 2011 and ISO C++ 2014]' + '-Wc++1z-compat[warn about C++ constructs whose meaning differs between ISO C++ 2014 and (forthcoming) ISO C++ 201z(7?)]' + '-Wc90-c99-compat[warn about features not present in ISO C90, but present in ISO C99]' + '-Wc99-c11-compat[warn about features not present in ISO C99, but present in ISO C11]' + '-Wcast-align[warn about pointer casts which increase alignment]' + '-Wcast-qual[warn about casts which discard qualifiers]' + '-Wc-binding-type[warn if the type of a variable might be not interoperable with C]' + '-Wc++-compat[warn about C constructs that are not in the common subset of C and C++]' + '-Wcharacter-truncation[warn about truncated character expressions]' + '-Wchar-subscripts[warn about subscripts whose type is "char"]' + '-Wchkp[warn about memory access errors found by Pointer Bounds Checker]' + '-Wclobbered[warn about variables that might be changed by "longjmp" or "vfork"]' + '-Wcomments[synonym for -Wcomment]' + '-Wcomment[warn about possibly nested block comments, and C++ comments spanning more than one physical line]' + '-Wcompare-reals[warn about equality comparisons involving REAL or COMPLEX expressions]' + '-Wconditionally-supported[warn for conditionally-supported constructs]' + '-Wconversion-extra[warn about most implicit conversions]' + '-Wconversion-null[warn for converting NULL from/to a non-pointer type]' + '-Wconversion[warn for implicit type conversions that may change a value]' + '-Wcoverage-mismatch[warn in case profiles in -fprofile-use do not match]' + '-Wcpp[warn when a #warning directive is encountered]' + '-Wctor-dtor-privacy[warn when all constructors and destructors are private]' + '-Wdangling-else[warn about dangling else]' + '-Wdate-time[warn about __TIME__, __DATE__ and __TIMESTAMP__ usage]' + '-Wdeclaration-after-statement[warn when a declaration is found after a statement]' + '-Wdelete-incomplete[warn when deleting a pointer to incomplete type]' + '-Wdelete-non-virtual-dtor[warn about deleting polymorphic objects with non- virtual destructors]' + '-Wdeprecated-declarations[warn about uses of __attribute__((deprecated)) declarations]' + '-Wdeprecated[warn if a deprecated compiler feature, class, method, or field is used]' + '-Wdesignated-init[warn about positional initialization of structs requiring designated initializers]' + '-Wdisabled-optimization[warn when an optimization pass is disabled]' + '-Wdiscarded-array-qualifiers[warn if qualifiers on arrays which are pointer targets are discarded]' + '-Wdiscarded-qualifiers[warn if type qualifiers on pointers are discarded]' + '-Wdiv-by-zero[warn about compile-time integer division by zero]' + '-Wdouble-promotion[warn about implicit conversions from "float" to "double"]' + '-Wduplicated-branches[warn about duplicated branches in if-else statements]' + '-Wduplicated-cond[warn about duplicated conditions in an if-else-if chain]' + '-Wduplicate-decl-specifier[warn when a declaration has duplicate const, volatile, restrict or _Atomic specifier]' + '-Weffc\+\+[warn about violations of Effective C++ style rules]' + '-Wempty-body[warn about an empty body in an if or else statement]' + '-Wendif-labels[warn about stray tokens after #else and #endif]' + '-Wenum-compare[warn about comparison of different enum types]' + # '-Werror-implicit-function-declaration[this switch is deprecated; use -Werror=implicit-fun]' # this still exists but makes completing -Werror= less convenient + '-Wexpansion-to-defined[warn if "defined" is used outside #if]' + '-Wextra[print extra (possibly unwanted) warnings]' + '-Wfloat-conversion[warn for implicit type conversions that cause loss of floating point precision]' + '-Wfloat-equal[warn if testing floating point numbers for equality]' + '-Wformat-contains-nul[warn about format strings that contain NUL bytes]' + '-Wformat-extra-args[warn if passing too many arguments to a function for its format string]' + '-Wformat-nonliteral[warn about format strings that are not literals]' + '-Wformat-overflow[warn about function calls with format strings that write past the end of the destination region]' + '-Wformat-overflow=[warn about function calls with format strings that write past the end of the destination region]:level:(1 2)' + '-Wformat-security[warn about possible security problems with format functions]' + '-Wformat-signedness[warn about sign differences with format functions]' + '-Wformat-truncation[warn about calls to snprintf and similar functions that truncate output. Same as -Wformat- truncation=1. Same as -Wformat-truncation=]' + '-Wformat-truncation=[warn about calls to snprintf and similar functions that truncate output]:level:(1 2)' + '-Wformat=[warn about printf/scanf/strftime/strfmon format string anomalies]::level:(1 2)' + '-Wformat-y2k[warn about strftime formats yielding 2-digit years]' + '-Wformat-zero-length[warn about zero-length formats]' + '-Wframe-address[warn when __builtin_frame_address or __builtin_return_address is used unsafely]' + '-Wframe-larger-than=[warn if a function'\''s stack frame requires more than <number> bytes]:bytes: ' + '-Wfree-nonheap-object[warn when attempting to free a non-heap object]' + '-Wfunction-elimination[warn about function call elimination]' + '-Whsa[warn when a function cannot be expanded to HSAIL]' + '-Wignored-attributes[warn whenever attributes are ignored]' + '-Wignored-qualifiers[warn whenever type qualifiers are ignored]' + '-Wimplicit-fallthrough=[warn when a switch case falls through]:level:(1 2 3 4 5)' + '-Wimplicit-function-declaration[warn about implicit function declarations]' + '-Wimplicit-interface[warn about calls with implicit interface]' + '-Wimplicit-int[warn when a declaration does not specify a type]' + '-Wimplicit-procedure[warn about called procedures not explicitly declared]' + '-Wimplicit[warn about implicit declarations]' + '-Wimport[warn about imports]' + '-Wincompatible-pointer-types[warn when there is a conversion between pointers that have incompatible types]' + '-Winherited-variadic-ctor[warn about C++11 inheriting constructors when the base has a variadic constructor]' + '-Winit-self[warn about variables which are initialized to themselves]' + '-Winline[warn when an inlined function cannot be inlined]' + '-Wint-conversion[warn about incompatible integer to pointer and pointer to integer conversions]' + '-Winteger-division[warn about constant integer divisions with truncated results]' + '-Wint-in-bool-context[warn for suspicious integer expressions in boolean context]' + '-Wintrinsic-shadow[warn if a user-procedure has the same name as an intrinsic]' + '-Wintrinsics-std[warn on intrinsics not part of the selected standard]' + '-Wint-to-pointer-cast[warn when there is a cast to a pointer from an integer of a different size]' + '-Winvalid-memory-model[warn when an atomic memory model parameter is known to be outside the valid range]' + '-Winvalid-offsetof[warn about invalid uses of the "offsetof" macro]' + '-Winvalid-pch[warn about PCH files that are found but not used]' + '-Wjump-misses-init[warn when a jump misses a variable initialization]' + '-Wlarger-than=[warn if an object is larger than <number> bytes]:bytes: ' + '-Wline-truncation[warn about truncated source lines]' + '-Wliteral-suffix[warn when a string or character literal is followed by a ud-suffix which does not begin with an underscore]' + '-Wlogical-not-parentheses[warn when logical not is used on the left hand side operand of a comparison]' + '-Wlogical-op[warn when a logical operator is suspiciously always evaluating to true or false]' + '-Wlong-long[do not warn about using "long long" when -pedantic]' + '-Wlto-type-mismatch[during link time optimization warn about mismatched types of global declarations]' + '-Wmain[warn about suspicious declarations of "main"]' + '-Wmaybe-uninitialized[warn about maybe uninitialized automatic variables]' + '-Wmemset-elt-size[warn about suspicious calls to memset where the third argument contains the number of elements not multiplied by the element size]' + '-Wmemset-transposed-args[warn about suspicious calls to memset where the third argument is constant literal zero and the second is not]' + '-Wmisleading-indentation[warn when the indentation of the code does not reflect the block structure]' + '-Wmissing-braces[warn about possibly missing braces around initializers]' + '-Wmissing-declarations[warn about global functions without previous declarations]' + '-Wmissing-field-initializers[warn about missing fields in struct initializers]' + '-Wmissing-include-dirs[warn about user-specified include directories that do not exist]' + '-Wmissing-parameter-type[warn about function parameters declared without a type specifier in K&R-style functions]' + '-Wmissing-prototypes[warn about global functions without prototypes]' + '-Wmudflap[warn about constructs not instrumented by -fmudflap]' + '-Wmultichar[warn about use of multi-character character constants]' + '-Wmultiple-inheritance[warn on direct multiple inheritance]' + '-Wnamespaces[warn on namespace definition]' + '-Wnarrowing[warn about narrowing conversions within { } that are ill-formed in C++11]' + '-Wnested-externs[warn about "extern" declarations not at file scope]' + '-Wnoexcept-type[warn if C++1z noexcept function type will change the mangled name of a symbol]' + '-Wnoexcept[warn when a noexcept expression evaluates to false even though the expression can''t actually throw]' + '-Wnonnull-compare[warn if comparing pointer parameter with nonnull attribute with NULL]' + '-Wnonnull[warn about NULL being passed to argument slots marked as requiring non-NULL]' + '-Wnonportable-cfstrings[warn on CFStrings containing nonportable characters]' + '-Wnon-template-friend[warn when non-templatized friend functions are declared within a template]' + '-Wnon-virtual-dtor[warn about non-virtual destructors]' + '-Wnormalized=-[warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): ' + '-Wnull-dereference[warn if dereferencing a NULL pointer may lead to erroneous or undefined behavior]' + '-Wodr[warn about some C++ One Definition Rule violations during link time optimization]' + '-Wold-style-cast[warn if a C-style cast is used in a program]' + '-Wold-style-declaration[warn for obsolescent usage in a declaration]' + '-Wold-style-definition[warn if an old-style parameter definition is used]' + '-Wopenmp-simd[warn if a simd directive is overridden by the vectorizer cost model]' + '-Woverflow[warn about overflow in arithmetic expressions]' + '-Woverlength-strings[warn if a string is longer than the maximum portable length specified by the standard]' + '-Woverloaded-virtual[warn about overloaded virtual function names]' + '-Woverride-init-side-effects[warn about overriding initializers with side effects]' + '-Woverride-init[warn about overriding initializers without side effects]' + '-Wpacked-bitfield-compat[warn about packed bit-fields whose offset changed in GCC 4.4]' + '-Wpacked[warn when the packed attribute has no effect on struct layout]' + '-Wpadded[warn when padding is required to align structure members]' + '-Wparentheses[warn about possibly missing parentheses]' + '-Wpedantic[issue warnings needed for strict compliance to the standard]' + '-Wplacement-new=[warn for placement new expressions with undefined behavior]::level:(1 2)' + '-Wpmf-conversions[warn when converting the type of pointers to member functions]' + '-Wpointer-arith[warn about function pointer arithmetic]' + '-Wpointer-compare[warn when a pointer is compared with a zero character constant]' + '-Wpointer-sign[warn when a pointer differs in signedness in an assignment]' + '-Wpointer-to-int-cast[warn when a pointer is cast to an integer of a different size]' + '-Wpoison-system-directories[warn for -I and -L options using system directories if cross compiling]' + '-Wpragmas[warn about misuses of pragmas]' + '-Wproperty-assign-default[warn if a property for an Objective-C object has no assign semantics specified]' + '-Wprotocol[warn if inherited methods are unimplemented]' + '-Wpsabi[warn about psabi]' + '-Wrealloc-lhs-all[warn when a left-hand-side variable is reallocated]' + '-Wrealloc-lhs[warn when a left-hand-side array variable is reallocated]' + '-Wreal-q-constant[warn about real-literal-constants with '\'q\'' exponent-letter]' + '-Wredundant-decls[warn about multiple declarations of the same object]' + '-Wregister[warn about uses of register storage specifier]' + '-Wreorder[warn when the compiler reorders code]' + '-Wrestrict[warn when an argument passed to a restrict- qualified parameter aliases with another argument]' + '-Wreturn-local-addr[warn about returning a pointer/reference to a local or temporary variable]' + '-Wreturn-type[warn whenever a function'\''s return type defaults to "int" (C), or about inconsistent return types (C++)]' + '-Wscalar-storage-order[warn on suspicious constructs involving reverse scalar storage order]' + '-Wselector[warn if a selector has multiple methods]' + '-Wsequence-point[warn about possible violations of sequence point rules]' + '-Wshadow-ivar[warn if a local declaration hides an instance variable]' + '-Wshadow[warn when one variable shadows another. Same as -Wshadow=global]' + '-Wshift-count-negative[warn if shift count is negative]' + '-Wshift-count-overflow[warn if shift count >= width of type]' + '-Wshift-negative-value[warn if left shifting a negative value]' + '-Wshift-overflow[warn if left shift of a signed value overflows. Same as -Wshift-overflow=]' + '-Wshift-overflow=[warn if left shift of a signed value overflows]:level:(1 2)' + '-Wsign-compare[warn about signed-unsigned comparisons]' + '-Wsign-conversion[warn for implicit type conversions between signed and unsigned integers]' + '-Wsign-promo[warn when overload promotes from unsigned to signed]' + '-Wsized-deallocation[warn about missing sized deallocation functions]' + '-Wsizeof-array-argument[warn when sizeof is applied on a parameter declared as an array]' + '-Wsizeof-pointer-memaccess[warn about suspicious length parameters to certain string functions if the argument uses sizeof]' + '-Wstack-protector[warn when not issuing stack smashing protection for some reason]' + '-Wstack-usage=[warn if stack usage might be larger than specified amount]:bytes: ' + '-Wstrict-aliasing[warn about code which might break strict aliasing rules]' + '-Wstrict-aliasing=-[warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)' + '-Wstrict-null-sentinel[warn about uncasted NULL used as sentinel]' + '-Wstrict-overflow[warn about optimizations that assume that signed overflow is undefined]' + '-Wstrict-overflow=-[warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)' + '-Wstrict-prototypes[warn about unprototyped function declarations]' + '-Wstrict-selector-match[warn if type signatures of candidate methods do not match exactly]' + '-Wstringop-overflow=[under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)' + '-Wstringop-overflow[warn about buffer overflow in string manipulation functions like memcpy and strcpy. Same as -Wstringop-overflow=]' + '-Wsubobject-linkage[warn if a class type has a base or a field whose type uses the anonymous namespace or depends on a type with no linkage]' '*-Wsuggest-attribute=-[warn about functions that might be candidates for attributes]:attribute:(pure const noreturn format)' - '-Wsuggest-final-methods[Warn about C++ virtual methods where adding final keyword would improve code quality]' - '-Wsuggest-final-types[Warn about C++ polymorphic types where adding final keyword would improve code quality]' - '-Wsuggest-override[Suggest that the override keyword be used when the declaration of a virtual function overrides another]' - '-Wsurprising[Warn about "suspicious" constructs]' - '-Wswitch-bool[Warn about switches with boolean controlling expression]' - '-Wswitch-default[Warn about enumerated switches missing a "default-" statement]' - '-Wswitch-enum[Warn about all enumerated switches missing a specific case]' - '-Wswitch-unreachable[Warn about statements between switch'\''s controlling expression and the first case]' - '-Wswitch[Warn about enumerated switches, with no default, missing a case]' - '-Wsync-nand[Warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]' - '-Wsynth[Deprecated. This switch has no effect]' - '-Wsystem-headers[Do not suppress warnings from system headers]' - '-Wtabs[Permit nonconforming uses of the tab character]' - '-Wtarget-lifetime[Warn if the pointer in a pointer assignment might outlive its target]' - '-Wtautological-compare[Warn if a comparison always evaluates to true or false]' - '-Wtemplates[Warn on primary template declaration]' - '-Wterminate[Warn if a throw expression will always result in a call to terminate()]' - '-Wtraditional-conversion[Warn of prototypes causing type conversions different from what would happen in the absence of prototype]' - '-Wtraditional[Warn about features not present in traditional C]' - '-Wtrampolines[Warn whenever a trampoline is generated]' - '-Wtrigraphs[Warn if trigraphs are encountered that might affect the meaning of the program]' - '-Wtype-limits[Warn if a comparison is always true or always false due to the limited range of the data type]' - '-Wundeclared-selector[Warn about @selector()s without previously declared methods]' - '-Wundef[Warn if an undefined macro is used in an #if directive]' - '-Wundefined-do-loop[Warn about an invalid DO loop]' - '-Wunderflow[Warn about underflow of numerical constant expressions]' - '-Wuninitialized[Warn about uninitialized automatic variables]' - '-Wunknown-pragmas[Warn about unrecognized pragmas]' - '-Wunsafe-loop-optimizations[Warn if the loop cannot be optimized due to nontrivial assumptions]' - '-Wunsuffixed-float-constants[Warn about unsuffixed float constants]' - '-Wunused-but-set-parameter[Warn when a function parameter is only set, otherwise unused]' - '-Wunused-but-set-variable[Warn when a variable is only set, otherwise unused]' - '-Wunused-const-variable[Warn when a const variable is unused. Same as -Wunused-const-variable=]' - '-Wunused-dummy-argument[Warn about unused dummy arguments]' - '-Wunused-function[Warn when a function is unused]' - '-Wunused-label[Warn when a label is unused]' - '-Wunused-local-typedefs[Warn when typedefs locally defined in a function are not used]' - '-Wunused-macros[Warn about macros defined in the main file that are not used]' - '-Wunused-parameter[Warn when a function parameter is unused]' - '-Wunused-result[Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]' - '-Wunused-value[Warn when an expression value is unused]' - '-Wunused-variable[Warn when a variable is unused]' - '-Wunused[Enable all -Wunused- warnings]' - '-Wuse-without-only[Warn about USE statements that have no ONLY qualifier]' - '-Wuseless-cast[Warn about useless casts]' - '-Wvarargs[Warn about questionable usage of the macros used to retrieve variable arguments]' - '-Wvariadic-macros[Warn about using variadic macros]' - '-Wvector-operation-performance[Warn when a vector operation is compiled outside the SIMD]' - '-Wvirtual-inheritance[Warn on direct virtual inheritance]' - '-Wvirtual-move-assign[Warn if a virtual base has a non-trivial move assignment operator]' - '-Wvla[Warn if a variable length array is used]' - '-Wvolatile-register-var[Warn when a register variable is declared volatile]' - '-Wwrite-strings[In C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is]' - '-Wzero-as-null-pointer-constant[Warn when a literal '\''0'\'' is used as null pointer]' - '-Wzerotrip[Warn about zero-trip DO loops]' - '-frequire-return-statement[Functions which return values must end with return statements]' -# --help=warnings,joined - '-Wabi=[Warn about things that change between the current -fabi-version and the specified version]:: ' - '-Waligned-new=[Warn even if '\'new\'' uses a class member allocation function]:none|global|all: ' - '-Walloc-size-larger-than=[Warn for calls to allocation functions that attempt to allocate objects larger than the specified number of bytes]:bytes: ' - '-Walloca-larger-than=[Warn on unbounded uses of alloca, and on bounded uses of alloca whose bound can be larger than <number> bytes]:bytes: ' - '-Warray-bounds=[Warn if an array is accessed out of bounds]:level:(1 2)' - '-Wformat-overflow=[Warn about function calls with format strings that write past the end of the destination region]:level:(1 2)' - '-Wformat-truncation=[Warn about calls to snprintf and similar functions that truncate output]:level:(1 2)' - '-Wformat=[Warn about printf/scanf/strftime/strfmon format string anomalies]:level:(1 2)' - '-Wframe-larger-than=[Warn if a function'\''s stack frame requires more than <number> bytes]:bytes: ' - '-Wimplicit-fallthrough=[Warn when a switch case falls through]:level:(1 2 3 4 5)' - '-Wlarger-than=[Warn if an object is larger than <number> bytes]:bytes: ' - '-Wnormalized=-[Warn about non-normalised Unicode strings]:normalization:((id\:allow\ some\ non-nfc\ characters\ that\ are\ valid\ identifiers nfc\:only\ allow\ NFC nfkc\:only\ allow\ NFKC none\:allow\ any\ normalization)): ' - '-Wplacement-new=[Warn for placement new expressions with undefined behavior]:level:(1 2)' - '-Wshift-overflow=[Warn if left shift of a signed value overflows]:level:(1 2)' - '-Wstack-usage=[Warn if stack usage might be larger than specified amount]:bytes: ' - '-Wstrict-aliasing=-[Warn about code which might break strict aliasing rules]:level of checking (higher is more accurate):(1 2 3)' - '-Wstrict-overflow=-[Warn about optimizations that assume that signed overflow is undefined]:level of checking (higher finds more cases):(1 2 3 4 5)' - '-Wstringop-overflow=[Under the control of Object Size type, warn about buffer overflow in string manipulation functions like memcpy and strcpy]:level:(1 2 3 4)' - '-Wunused-const-variable=[Warn when a const variable is unused]:level:(1 2)' - '-Wvla-larger-than=[Warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' -# -W options from --help=common,^warnings - '-Werror=-[Treat specified warning as error (or all if none specified)]::warning:->werror' - '-Wfatal-errors[Exit on the first error occurred]' + '-Wsuggest-final-methods[warn about C++ virtual methods where adding final keyword would improve code quality]' + '-Wsuggest-final-types[warn about C++ polymorphic types where adding final keyword would improve code quality]' + '-Wsuggest-override[suggest that the override keyword be used when the declaration of a virtual function overrides another]' + '-Wsurprising[warn about "suspicious" constructs]' + '-Wswitch-bool[warn about switches with boolean controlling expression]' + '-Wswitch-default[warn about enumerated switches missing a "default-" statement]' + '-Wswitch-enum[warn about all enumerated switches missing a specific case]' + '-Wswitch-unreachable[warn about statements between switch'\''s controlling expression and the first case]' + '-Wswitch[warn about enumerated switches, with no default, missing a case]' + '-Wsync-nand[warn when __sync_fetch_and_nand and __sync_nand_and_fetch built-in functions are used]' + '-Wsynth[deprecated. This switch has no effect]' + '-Wsystem-headers[do not suppress warnings from system headers]' + '-Wtabs[permit nonconforming uses of the tab character]' + '-Wtarget-lifetime[warn if the pointer in a pointer assignment might outlive its target]' + '-Wtautological-compare[warn if a comparison always evaluates to true or false]' + '-Wtemplates[warn on primary template declaration]' + '-Wterminate[warn if a throw expression will always result in a call to terminate()]' + '-W[this switch is deprecated; use -Wextra instead]' + '-Wtraditional-conversion[warn of prototypes causing type conversions different from what would happen in the absence of prototype]' + '-Wtraditional[warn about features not present in traditional C]' + '-Wtrampolines[warn whenever a trampoline is generated]' + '-Wtrigraphs[warn if trigraphs are encountered that might affect the meaning of the program]' + '-Wtype-limits[warn if a comparison is always true or always false due to the limited range of the data type]' + '-Wundeclared-selector[warn about @selector()s without previously declared methods]' + '-Wundefined-do-loop[warn about an invalid DO loop]' + '-Wundef[warn if an undefined macro is used in an #if directive]' + '-Wunderflow[warn about underflow of numerical constant expressions]' + '-Wuninitialized[warn about uninitialized automatic variables]' + '-Wunknown-pragmas[warn about unrecognized pragmas]' + '-Wunsafe-loop-optimizations[warn if the loop cannot be optimized due to nontrivial assumptions]' + '-Wunsuffixed-float-constants[warn about unsuffixed float constants]' + '-Wunused-but-set-parameter[warn when a function parameter is only set, otherwise unused]' + '-Wunused-but-set-variable[warn when a variable is only set, otherwise unused]' + '-Wunused-const-variable[warn when a const variable is unused. Same as -Wunused-const-variable=]' + '-Wunused-const-variable=[warn when a const variable is unused]:level:(1 2)' + '-Wunused-dummy-argument[warn about unused dummy arguments]' + '-Wunused[enable all -Wunused- warnings]' + '-Wunused-function[warn when a function is unused]' + '-Wunused-label[warn when a label is unused]' + '-Wunused-local-typedefs[warn when typedefs locally defined in a function are not used]' + '-Wunused-macros[warn about macros defined in the main file that are not used]' + '-Wunused-parameter[warn when a function parameter is unused]' + '-Wunused-result[warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value]' + '-Wunused-value[warn when an expression value is unused]' + '-Wunused-variable[warn when a variable is unused]' + '-Wuseless-cast[warn about useless casts]' + '-Wuse-without-only[warn about USE statements that have no ONLY qualifier]' + '-Wvarargs[warn about questionable usage of the macros used to retrieve variable arguments]' + '-Wvariadic-macros[warn about using variadic macros]' + '-Wvector-operation-performance[warn when a vector operation is compiled outside the SIMD]' + '-Wvirtual-inheritance[warn on direct virtual inheritance]' + '-Wvirtual-move-assign[warn if a virtual base has a non-trivial move assignment operator]' + '-Wvla-larger-than=[warn on unbounded uses of variable-length arrays, and on bounded uses of variable-length arrays whose bound can be larger than <number> bytes]:bytes: ' + '-Wvla[warn if a variable length array is used]' + '-Wvolatile-register-var[warn when a register variable is declared volatile]' + '-Wwrite-strings[in C++, nonzero means warn about deprecated conversion from string literals to '\''char *'\''. In C, similar warning, except that the conversion is]' + '-Wzero-as-null-pointer-constant[warn when a literal '\''0'\'' is used as null pointer]' + '-Wzerotrip[warn about zero-trip DO loops]' ) + # clang specific warnings if [[ "$service" = clang* ]]; then - args+=( - '-Wunreachable-code[Warn on code that will not be executed]' - '-Wunreachable-code-aggressive[Controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]' - '-Wunreachable-code-break[Warn when break will never be executed]' - '-Wunreachable-code-loop-increment[Warn when loop will be executed only once]' - '-Wunreachable-code-return[Warn when return will not be executed]' + warnings+=( + '-Wlarge-by-value-copy=[warn on large by value copy]:argument' + '-Wunreachable-code-aggressive[controls -Wunreachable-code, -Wunreachable-code-break, -Wunreachable-code-return]' + '-Wunreachable-code-break[warn when break will never be executed]' + '-Wunreachable-code-loop-increment[warn when loop will be executed only once]' + '-Wunreachable-code-return[warn when return will not be executed]' + '-Wunreachable-code[warn on code that will not be executed]' ) else - args+=( - '-Wunreachable-code[Does nothing. Preserved for backward compatibility]' + warnings+=( + '-Wunreachable-code[does nothing. Preserved for backward compatibility]' ) fi -# optimizers (from --help=optimizers), except for -O -args+=( -# --help=optimizers,^joined - '-faggressive-loop-optimizations[Aggressively optimize loops using language constraints]' - '-falign-functions[Align the start of functions]' - '-falign-jumps[Align labels which are only reached by jumping]' - '-falign-labels[Align all labels]' - '-falign-loops[Align the start of loops]' - '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' - '-fasynchronous-unwind-tables[Generate unwind tables that are exact at each instruction boundary]' - '-fauto-inc-dec[Generate auto-inc/dec instructions]' - '-fbranch-count-reg[Replace add, compare, branch with branch on count register]' - '-fbranch-probabilities[Use profiling information for branch probabilities]' - '-fbranch-target-load-optimize2[Perform branch target load optimization after prologue / epilogue threading]' - '-fbranch-target-load-optimize[Perform branch target load optimization before prologue / epilogue threading]' - '-fbtr-bb-exclusive[Restrict target load migration not to re-use registers in any basic block]' - '-fcaller-saves[Save registers around function calls]' - '-fcode-hoisting[Enable code hoisting]' - '-fcombine-stack-adjustments[Looks for opportunities to reduce stack adjustments and stack references]' - '-fcommon[Do not put uninitialized globals in the common section]' - '-fcompare-elim[Perform comparison elimination after register allocation has finished]' - '-fconserve-stack[Do not perform optimizations increasing noticeably stack usage]' - '-fcprop-registers[Perform a register copy-propagation optimization pass]' - '-fcrossjumping[Perform cross-jumping optimization]' - '-fcse-follow-jumps[When running CSE, follow jumps to their targets]' - '-fcx-fortran-rules[Complex multiplication and division follow Fortran rules]' - '-fcx-limited-range[Omit range reduction step when performing complex division]' - '-fdata-sections[Place data items into their own section]' - '-fdce[Use the RTL dead code elimination pass]' - '-fdefer-pop[Defer popping functions args from stack until later]' - '-fdelayed-branch[Attempt to fill delay slots of branch instructions]' - '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]' - '-fdelete-null-pointer-checks[Delete useless null pointer checks]' - '-fdevirtualize-speculatively[Perform speculative devirtualization]' - '-fdevirtualize[Try to convert virtual calls to direct ones]' - '-fdse[Use the RTL dead store elimination pass]' - '-fearly-inlining[Perform early inlining]' - '-fexceptions[Enable exception handling]' - '-fexpensive-optimizations[Perform a number of minor, expensive optimizations]' - '-ffinite-math-only[Assume no NaNs or infinities are generated]' - '-ffloat-store[Don'\''t allocate floats and doubles in extended- precision registers]' - '-fforward-propagate[Perform a forward propagation pass on RTL]' - '-ffp-int-builtin-inexact[Allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]' - '-ffunction-cse[Allow function addresses to be held in registers]' - '-fgcse-after-reload[Perform global common subexpression elimination after register allocation has finished]' - '-fgcse-las[Perform redundant load after store elimination in global common subexpression elimination]' - '-fgcse-lm[Perform enhanced load motion during global common subexpression elimination]' - '-fgcse-sm[Perform store motion after global common subexpression elimination]' - '-fgcse[Perform global common subexpression elimination]' - '-fgraphite-identity[Enable Graphite Identity transformation]' - '-fgraphite[Enable in and out of Graphite representation]' - '-fguess-branch-probability[Enable guessing of branch probabilities]' - '-fhoist-adjacent-loads[Enable hoisting adjacent loads to encourage generating conditional move instructions]' - '-fif-conversion2[Perform conversion of conditional jumps to conditional execution]' - '-fif-conversion[Perform conversion of conditional jumps to branchless equivalents]' - '-findirect-inlining[Perform indirect inlining]' - '-finline-atomics[Inline __atomic operations when a lock free instruction sequence is available]' - '-finline-functions-called-once[Integrate functions only required by their single caller]' - '-finline-functions[Integrate functions not declared "inline" into their callers when profitable]' - '-finline-small-functions[Integrate functions into their callers when code size is known not to grow]' - '-finline[Enable inlining of function declared "inline", disabling disables all inlining]' - '-fipa-bit-cp[Perform interprocedural bitwise constant propagation]' - '-fipa-cp-clone[Perform cloning to make Interprocedural constant propagation stronger]' - '-fipa-cp[Perform interprocedural constant propagation]' - '-fipa-icf-functions[Perform Identical Code Folding for functions]' - '-fipa-icf-variables[Perform Identical Code Folding for variables]' - '-fipa-icf[Perform Identical Code Folding for functions and read-only variables]' - '-fipa-profile[Perform interprocedural profile propagation]' - '-fipa-pta[Perform interprocedural points-to analysis]' - '-fipa-pure-const[Discover pure and const functions]' - '-fipa-ra[Use caller save register across calls if possible]' - '-fipa-reference[Discover readonly and non addressable static variables]' - '-fipa-sra[Perform interprocedural reduction of aggregates]' - '-fipa-vrp[Perform IPA Value Range Propagation]' - '-fira-hoist-pressure[Use IRA based register pressure calculation in RTL hoist optimizations]' - '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]' - '-fira-share-save-slots[Share slots for saving different hard registers]' - '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]' - '-fisolate-erroneous-paths-attribute[Detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]' - '-fisolate-erroneous-paths-dereference[Detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main]' - '-fivopts[Optimize induction variables on trees]' - '-fjump-tables[Use jump tables for sufficiently large switch statements]' - '-flifetime-dse[Tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]' - '-flive-range-shrinkage[Relief of register pressure through live range shrinkage]' - '-floop-nest-optimize[Enable the loop nest optimizer]' - '-floop-parallelize-all[Mark all loops as parallel]' - '-flra-remat[Do CFG-sensitive rematerialization in LRA]' - '-fmath-errno[Set errno after built-in math functions]' - '-fmerge-all-constants[Attempt to merge identical constants and constant variables]' - '-fmerge-constants[Attempt to merge identical constants across compilation units]' - '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]' - '-fmodulo-sched[Perform SMS based modulo scheduling before the first scheduling pass]' - '-fmove-loop-invariants[Move loop invariant computations out of loops]' - '-fno-threadsafe-statics[Do not generate thread-safe code for initializing local statics]' - '-fnon-call-exceptions[Support synchronous non-call exceptions]' - '-fnothrow-opt[Treat a throw() exception specification as noexcept to improve code size]' - '-fomit-frame-pointer[When possible do not generate stack frames]' - '-fopt-info[Enable all optimization info dumps on stderr]' - '-foptimize-sibling-calls[Optimize sibling and tail recursive calls]' - '-foptimize-strlen[Enable string length optimizations on trees]' - '-fpack-struct[Pack structure members together without holes]' - '-fpartial-inlining[Perform partial inlining]' - '-fpeel-loops[Perform loop peeling]' - '-fpeephole2[Enable an RTL peephole pass before sched2]' - '-fpeephole[Enable machine specific peephole optimizations]' - '-fplt[Use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]' - '-fpredictive-commoning[Run predictive commoning optimization]' - '-fprefetch-loop-arrays[Generate prefetch instructions, if available, for arrays in loops]' - '-fprintf-return-value[Treat known sprintf return values as constants]' - '-freciprocal-math[Same as -fassociative-math for expressions which include division]' - '-freg-struct-return[Return small aggregates in registers]' - '-frename-registers[Perform a register renaming optimization pass]' - '-freorder-blocks-and-partition[Reorder basic blocks and partition into hot and cold sections]' - '-freorder-blocks[Reorder basic blocks to improve code placement]' - '-freorder-functions[Reorder functions to improve code placement]' - '-frerun-cse-after-loop[Add a common subexpression elimination pass after loop optimizations]' - '-freschedule-modulo-scheduled-loops[Enable/Disable the traditional scheduling in loops that already passed modulo scheduling]' - '-frounding-math[Disable optimizations that assume default FP rounding behavior]' - '-frtti[Generate run time type descriptor information]' - '-fsched-critical-path-heuristic[Enable the critical path heuristic in the scheduler]' - '-fsched-dep-count-heuristic[Enable the dependent count heuristic in the scheduler]' - '-fsched-group-heuristic[Enable the group heuristic in the scheduler]' - '-fsched-interblock[Enable scheduling across basic blocks]' - '-fsched-last-insn-heuristic[Enable the last instruction heuristic in the scheduler]' - '-fsched-pressure[Enable register pressure sensitive insn scheduling]' - '-fsched-rank-heuristic[Enable the rank heuristic in the scheduler]' - '-fsched-spec-insn-heuristic[Enable the speculative instruction heuristic in the scheduler]' - '-fsched-spec-load-dangerous[Allow speculative motion of more loads]' - '-fsched-spec-load[Allow speculative motion of some loads]' - '-fsched-spec[Allow speculative motion of non-loads]' - '-fsched-stalled-insns-dep[Set dependence distance checking in premature scheduling of queued insns]' - '-fsched-stalled-insns[Allow premature scheduling of queued insns]' - '-fsched2-use-superblocks[If scheduling post reload, do superblock scheduling]' - '-fschedule-fusion[Perform a target dependent instruction fusion optimization pass]' - '-fschedule-insns2[Reschedule instructions after register allocation]' - '-fschedule-insns[Reschedule instructions before register allocation]' - '-fsection-anchors[Access data in the same section from shared anchor points]' - '-fsel-sched-pipelining-outer-loops[Perform software pipelining of outer loops during selective scheduling]' - '-fsel-sched-pipelining[Perform software pipelining of inner loops during selective scheduling]' - '-fsel-sched-reschedule-pipelined[Reschedule pipelined regions without pipelining]' - '-fselective-scheduling2[Run selective scheduling after reload]' - '-fselective-scheduling[Schedule instructions using selective scheduling algorithm]' - '-fshort-enums[Use the narrowest integer type possible for enumeration types]' - '-fshort-wchar[Force the underlying type for "wchar_t" to be "unsigned short"]' - '-fshrink-wrap-separate[Shrink-wrap parts of the prologue and epilogue separately]' - '-fshrink-wrap[Emit function prologues only before parts of the function that need it, rather than at the top of the function]' - '-fsignaling-nans[Disable optimizations observable by IEEE signaling NaNs]' - '-fsigned-zeros[Disable floating point optimizations that ignore the IEEE signedness of zero]' - '-fsingle-precision-constant[Convert floating point constants to single precision constants]' - '-fsplit-ivs-in-unroller[Split lifetimes of induction variables when loops are unrolled]' - '-fsplit-loops[Perform loop splitting]' - '-fsplit-paths[Split paths leading to loop backedges]' - '-fsplit-wide-types[Split wide types into independent registers]' - '-fssa-backprop[Enable backward propagation of use properties at the SSA level]' - '-fssa-phiopt[Optimize conditional patterns using SSA PHI nodes]' - '-fstack-protector-all[Use a stack protection method for every function]' - '-fstack-protector-explicit[Use stack protection method only for functions with the stack_protect attribute]' - '-fstack-protector-strong[Use a smart stack protection method for certain functions]' - '-fstack-protector[Use propolice as a stack protection method]' - '-fstdarg-opt[Optimize amount of stdarg registers saved to stack at start of function]' - '-fstore-merging[Merge adjacent stores]' - '-fstrict-aliasing[Assume strict aliasing rules apply]' - '-fstrict-enums[Assume that values of enumeration type are always within the minimum range of that type]' - '-fstrict-overflow[Treat signed overflow as undefined]' - '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]' - '-fthread-jumps[Perform jump threading optimizations]' - '-ftracer[Perform superblock formation via tail duplication]' - '-ftrapping-math[Assume floating-point operations can trap]' - '-ftrapv[Trap for signed overflow in addition, subtraction and multiplication]' - '-ftree-bit-ccp[Enable SSA-BIT-CCP optimization on trees]' - '-ftree-builtin-call-dce[Enable conditional dead code elimination for builtin calls]' - '-ftree-ccp[Enable SSA-CCP optimization on trees]' - '-ftree-ch[Enable loop header copying on trees]' - '-ftree-coalesce-vars[Enable SSA coalescing of user variables]' - '-ftree-copy-prop[Enable copy propagation on trees]' - '-ftree-cselim[Transform condition stores into unconditional ones]' - '-ftree-dce[Enable SSA dead code elimination optimization on trees]' - '-ftree-dominator-opts[Enable dominator optimizations]' - '-ftree-dse[Enable dead store elimination]' - '-ftree-forwprop[Enable forward propagation on trees]' - '-ftree-fre[Enable Full Redundancy Elimination (FRE) on trees]' - '-ftree-loop-distribute-patterns[Enable loop distribution for patterns transformed into a library call]' - '-ftree-loop-distribution[Enable loop distribution on trees]' - '-ftree-loop-if-convert[Convert conditional jumps in innermost loops to branchless equivalents]' - '-ftree-loop-im[Enable loop invariant motion on trees]' - '-ftree-loop-ivcanon[Create canonical induction variables in loops]' - '-ftree-loop-optimize[Enable loop optimizations on tree level]' - '-ftree-loop-vectorize[Enable loop vectorization on trees]' - '-ftree-lrs[Perform live range splitting during the SSA- >normal pass]' - '-ftree-partial-pre[In SSA-PRE optimization on trees, enable partial- partial redundancy elimination]' - '-ftree-phiprop[Enable hoisting loads from conditional pointers]' - '-ftree-pre[Enable SSA-PRE optimization on trees]' - '-ftree-pta[Perform function-local points-to analysis on trees]' - '-ftree-reassoc[Enable reassociation on tree level]' - '-ftree-scev-cprop[Enable copy propagation of scalar-evolution information]' - '-ftree-sink[Enable SSA code sinking on trees]' - '-ftree-slp-vectorize[Enable basic block vectorization (SLP) on trees]' - '-ftree-slsr[Perform straight-line strength reduction]' - '-ftree-sra[Perform scalar replacement of aggregates]' - '-ftree-switch-conversion[Perform conversions of switch initializations]' - '-ftree-tail-merge[Enable tail merging on trees]' - '-ftree-ter[Replace temporary expressions in the SSA->normal pass]' - '-ftree-vectorize[Enable vectorization on trees]' - '-ftree-vrp[Perform Value Range Propagation on trees]' - '-funconstrained-commons[Assume common declarations may be overridden with ones with a larger trailing array]' - '-funroll-all-loops[Perform loop unrolling for all loops]' - '-funroll-loops[Perform loop unrolling when iteration count is known]' - '-funsafe-loop-optimizations[Allow loop optimizations to assume that the loops behave in normal way]' - '-funsafe-math-optimizations[Allow math optimizations that may violate IEEE or ISO standards]' - '-funswitch-loops[Perform loop unswitching]' - '-funwind-tables[Just generate unwind tables for exception handling]' - '-fvar-tracking-assignments-toggle[Toggle -fvar-tracking-assignments]' - '-fvar-tracking-assignments[Perform variable tracking by annotating assignments]' - '-fvar-tracking-uninit[Perform variable tracking and also tag variables that are uninitialized]' - '-fvar-tracking[Perform variable tracking]' - '-fvariable-expansion-in-unroller[Apply variable expansion when loops are unrolled]' - '-fvpt[Use expression value profiles in optimizations]' - '-fweb[Construct webs and split unrelated uses of single variable]' - '-fwhole-program[Perform whole program optimizations]' - '-fwrapv[Assume signed arithmetic overflow wraps around]' -# --help=optimizers,joined - '-ffp-contract=[Perform floating-point expression contraction]:style:(off on fast)' - '-fira-algorithm=[Set the used IRA algorithm]:algorithm:(cb priority)' - '-fira-region=[Set regions for IRA]:region:(one all mixed)' - '-fpack-struct=[Set initial maximum structure member alignment]:alignment (power of 2): ' - '-freorder-blocks-algorithm=[Set the used basic block reordering algorithm]:algorithm:(simple stc)' - '-fsched-stalled-insns-dep=[Set dependence distance checking in premature scheduling of queued insns]:insns:' - '-fsched-stalled-insns=[Set number of queued insns that can be prematurely scheduled]:insns:' - '-fsimd-cost-model=[Specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)' - '-fstack-reuse=[Set stack reuse level for local variables]:level:(all named_vars none)' - '-ftree-parallelize-loops=[Enable automatic parallelization of loops]' - '-fvect-cost-model=[Specifies the cost model for vectorization]:model:(unlimited dynamic cheap)' - -) -# More linker options, from gcc man pages args+=( - '-nostartfiles[Do not use the standard system startup files when linking]' - '-nodefaultlibs[Do not use the standard system libraries when linking]' - '-nostdlib[Do not use standard system startup files or libraries when linking]' - '-rdynamic[Pass the flag -export-dynamic to the ELF linker, on targets that support it]' - '-s[Remove all symbol table and relocation information from the executable]' - '-static[On systems that support dynamic linking, this prevents linking with the shared libraries]' - '-shared-libgcc[Force shared libgcc]' - '-static-libgcc[Force static libgcc]' - '-symbolic[Bind references to global symbols when building a shared object]' - '-T:linker script:_files' + {'*-A-','*--assert='}'[make an assertion]:define assertion:' + '--all-warnings[display all warnings]' + {-ansi,--ansi}'[same as -std=c89 or -std=c++98]' + '-aux-info[emit declaration information into <file>]:file:_files' + {'-B-','--prefix='}'[add <prefix> to the compiler'\''s search paths]:executable prefix:_files -/' + '-b[specify target machine to compile to]:target machine:' + {-CC,--comments-in-macros}'[do not discard comments, including macro expansion]' + {-C,--comments}'[do not discard comments during preprocess]' + {-c,--compile}'[compile and assemble, but do not link]' + {'*-D-','*--define-macro='}'[define a macro]:define macro:' + '-d-[dump the state of the preprocessor]:dump:->dump' + '--dependencies[generate Makefile dependencies]' + '-dumpbase[set the file basename to be used for dumps]:file:_files' + '-dumpdir[set the directory name to be used for dumps]:file:_files -/' + '-dumpmachine[display the compiler'\''s target processor]' + '-dumpspecs[display all of the built in spec strings]' + '-dumpversion[display the version of the compiler]' + '+e-[control how virtual function definitions are used]:virtual function definitions in classes:((0\:only\ interface 1\:generate\ code))' + {-e,--entry}'[specify program entry point is entry]:entry' + {-E,--preprocess}'[preprocess only; do not compile, assemble or link]' + '-fabi-version=-[use specified C++ ABI version]:ABI version [0]:(0 1 2 3 4 5 6 7 8 9 10 11 12 13)' + '-fada-spec-parent=[dump Ada specs as child units of given parent]' + '-faggressive-loop-optimizations[aggressively optimize loops using language constraints]' + '-falign-functions[align the start of functions]' + '-falign-jumps[align labels which are only reached by jumping]' + '-falign-labels[align all labels]' + '-falign-loops[align the start of loops]' + '-fallow-parameterless-variadic-functions[allow variadic functions without named parameter]' + '-fasm[recognize the asm keyword]' + '-fassociative-math[allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' + '-fasynchronous-unwind-tables[generate unwind tables that are exact at each instruction boundary]' + '-fauto-inc-dec[generate auto-inc/dec instructions]' + '-fbounds-check[generate code to check bounds before indexing arrays]' + '-fbranch-count-reg[replace add, compare, branch with branch on count register]' + '-fbranch-probabilities[use profiling information for branch probabilities]' + '-fbranch-target-load-optimize2[perform branch target load optimization after prologue / epilogue threading]' + '-fbranch-target-load-optimize[perform branch target load optimization before prologue / epilogue threading]' + '-fbtr-bb-exclusive[restrict target load migration not to re-use registers in any basic block]' + '-fbuilding-libgcc[specify building libgcc]' + '-fbuiltin[recognize builtin functions]' + '-fcaller-saves[save registers around function calls]' + '-fcall-saved--[mark <register> as being preserved across functions]:register' + '-fcall-used--[mark <register> as being corrupted by function calls]:register' + '-fcanonical-system-headers[where shorter use canonicalized paths to system headers]' + '-fcheck-data-deps[compare the results of several data dependence analyzers]' + '-fcheck-pointer-bounds[add pointer bounds checker instrumentation]' + '-fchkp-check-incomplete-type[generate pointer bounds check for variables with incomplete type]' + '-fchkp-check-read[generate checks for all read accesses to memory]' + '-fchkp-check-write[generate checks for all write accesses to memory]' + '-fchkp-first-field-has-own-bounds[forces checker to use narrowed bounds for address of the first field]' + '-fchkp-instrument-calls[generate bounds passing for calls]' + '-fchkp-instrument-marked-only[instrument only functions marked with bnd_instrument attribute]' + '-fchkp-narrow-bounds[control how checker handle pointers to object fields]' + '-fchkp-narrow-to-innermost-array[forces checker to use bounds of the innermost arrays in case of nested static array access]' + '-fchkp-optimize[allow checker optimizations]' + '-fchkp-store-bounds[generate bounds stores for pointer writes]' + '-fchkp-treat-zero-dynamic-size-as-infinite[with this option zero size obtained dynamically for objects with incomplete type will be treated as infinite]' + '-fchkp-use-fast-string-functions[allow to use *_nobnd versions of string functions]' + '-fchkp-use-nochk-string-functions[allow to use *_nochk versions of string functions]' + '-fchkp-use-static-bounds[use statically initialized variable for vars bounds instead of generating them each time it is required]' + '-fchkp-use-static-const-bounds[use statically initialized variable for constant bounds]' + '-fchkp-use-wrappers[transform instrumented builtin calls into calls to wrappers]' + '-fchkp-zero-input-bounds-for-main[use zero bounds for all incoming arguments in main function]' + '-fcilkplus[enable Cilk Plus]' + '-fcode-hoisting[enable code hoisting]' + '-fcombine-stack-adjustments[looks for opportunities to reduce stack adjustments and stack references]' + '-fcommon[do not put uninitialized globals in the common section]' + '-fcompare-debug=-[compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' # TODO: complete gcc options here + '-fcompare-debug-second[run only the second compilation of -fcompare-debug]' + '-fcompare-elim[perform comparison elimination after register allocation has finished]' + '-fcond-mismatch[allow the arguments of the ? operator to have different types]' + '-fconserve-stack[do not perform optimizations increasing noticeably stack usage]' + '-fcprop-registers[perform a register copy-propagation optimization pass]' + '-fcrossjumping[perform cross-jumping optimization]' + '-fcse-follow-jumps[when running CSE, follow jumps to their targets]' + '-fcx-fortran-rules[complex multiplication and division follow Fortran rules]' + '-fcx-limited-range[omit range reduction step when performing complex division]' + '-fdata-sections[place data items into their own section]' + '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' # TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c + '-fdbg-cnt-list[list all available debugging counters with their limits and counts]' + '-fdce[use the RTL dead code elimination pass]' + '-fdebug-cpp[emit debug annotations during preprocessing]' + '-fdebug-prefix-map=-[map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir' + '-fdebug-types-section[output .debug_types section when using DWARF v4 debuginfo]' + '-fdefer-pop[defer popping functions args from stack until later]' + '-fdelayed-branch[attempt to fill delay slots of branch instructions]' + '-fdelete-dead-exceptions[delete dead instructions that may throw exceptions]' + '-fdelete-null-pointer-checks[delete useless null pointer checks]' + '-fdevirtualize-speculatively[perform speculative devirtualization]' + '-fdevirtualize[try to convert virtual calls to direct ones]' + '-fdiagnostics-color=-[colorize diagnostics]::color:(never always auto)' + '-fdiagnostics-generate-patch[print fix-it hints to stderr in unified diff format]' + '-fdiagnostics-parseable-fixits[print fixit hints in machine-readable form]' + '-fdiagnostics-show-caret[show the source line with a caret indicating the column]' + '-fdiagnostics-show-location=-[how often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)' + '-fdiagnostics-show-option[amend appropriate diagnostic messages with the command line option that controls them]' + '-fdirectives-only[preprocess directives only]' + '-fdollars-in-identifiers[permit $ as an identifier character]' + '-fdse[use the RTL dead store elimination pass]' + '-fdump-ada-spec-slim[write all declarations as Ada code for the given file only]' + '-fdump-ada-spec[write all declarations as Ada code transitively]' + '-fdump-final-insns=-[dump to filename the insns at the end of translation]:filename:_files' + '-fdump-go-spec=-[write all declarations to file as Go code]:filename:_files' + '-fdump-noaddr[suppress output of addresses in debugging dumps]' + '-fdump-passes[dump optimization passes]' + '-fdump-unnumbered-links[suppress output of previous and next insn numbers in debugging dumps]' + '-fdump-unnumbered[suppress output of instruction numbers, line number notes and addresses in debugging dumps]' + '-fdwarf2-cfi-asm[enable CFI tables via GAS assembler directives]' + '-fearly-inlining[perform early inlining]' + '-feliminate-dwarf2-dups[perform DWARF2 duplicate elimination]' + '-feliminate-unused-debug-symbols[perform unused type elimination in debug info]' + '-feliminate-unused-debug-types[perform unused type elimination in debug info]' + '-femit-class-debug-always[do not suppress C++ class debug information]' + '-femit-struct-debug-baseonly[aggressive reduced debug info for structs]' + '-femit-struct-debug-detailed=-[detailed reduced debug info for structs]:spec list [all]' + '-femit-struct-debug-reduced[conservative reduced debug info for structs]' + '-fexceptions[enable exception handling]' + '-fexcess-precision=-[specify handling of excess floating-point precision]:precision handling:(fast standard)' + '-fexec-charset=-[convert all strings and character constants to character set]:character set [UTF-8]' + '-fexpensive-optimizations[perform a number of minor, expensive optimizations]' + '-fextended-identifiers[permit universal character names in identifiers]' + '-ffast-math[sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]' + '-ffat-lto-objects[output lto objects containing both the intermediate language and binary output]' + '-ffinite-math-only[assume no NaNs or infinities are generated]' + '-ffixed--[mark <register> as being unavailable to the compiler]:register' + '-ffloat-store[don'\''t allocate floats and doubles in extended- precision registers]' + '-fforward-propagate[perform a forward propagation pass on RTL]' + '-ffp-contract=-[perform floating-point expression contraction]:style [fast]:(on off fast)' + '-ffp-int-builtin-inexact[allow built-in functions ceil, floor, round, trunc to raise "inexact" exceptions]' + '-ffreestanding[do not assume that standard C libraries and main exist]' + '-ffunction-cse[allow function addresses to be held in registers]' + '-ffunction-sections[place each function into its own section]' + '-fgcse-after-reload[perform global common subexpression elimination after register allocation has finished]' + '-fgcse-las[perform redundant load after store elimination in global common subexpression elimination]' + '-fgcse-lm[perform enhanced load motion during global common subexpression elimination]' + '-fgcse[perform global common subexpression elimination]' + '-fgcse-sm[perform store motion after global common subexpression elimination]' + '-fgnu89-inline[use traditional GNU semantics for inline functions]' + '-fgnu-tm[enable support for GNU transactional memory]' + '-fgraphite[enable in and out of Graphite representation]' + '-fgraphite-identity[enable Graphite Identity transformation]' + '-fguess-branch-probability[enable guessing of branch probabilities]' + '-fhoist-adjacent-loads[enable hoisting adjacent loads to encourage generating conditional move instructions]' + '-fhosted[assume normal C execution environment]' + '-fif-conversion2[perform conversion of conditional jumps to conditional execution]' + '-fif-conversion[perform conversion of conditional jumps to branchless equivalents]' + '-findirect-inlining[perform indirect inlining]' + '-finhibit-size-directive[do not generate .size directives]' + '-finline-atomics[inline __atomic operations when a lock free instruction sequence is available]' + '-finline[enable inlining of function declared "inline", disabling disables all inlining]' + '-finline-functions-called-once[integrate functions only required by their single caller]' + '-finline-functions[integrate functions not declared "inline" into their callers when profitable]' + '-finline-limit=-[limit the size of inlined functions to <number>]:number: ' + '-finline-small-functions[integrate functions into their callers when code size is known not to grow]' + '-finput-charset=[specify the default character set for source files]:character set' + '-finstrument-functions-exclude-file-list=-[do not instrument functions listed in files]:comma-separated file list:->commafiles' + '-finstrument-functions-exclude-function-list=-[do not instrument listed functions]:comma-separated list of syms: ' + '-finstrument-functions[instrument function entry and exit with profiling calls]' + '-fipa-bit-cp[perform interprocedural bitwise constant propagation]' + '-fipa-cp-clone[perform cloning to make Interprocedural constant propagation stronger]' + '-fipa-cp[perform interprocedural constant propagation]' + '-fipa-icf-functions[perform Identical Code Folding for functions]' + '-fipa-icf[perform Identical Code Folding for functions and read-only variables]' + '-fipa-icf-variables[perform Identical Code Folding for variables]' + '-fipa-profile[perform interprocedural profile propagation]' + '-fipa-pta[perform interprocedural points-to analysis]' + '-fipa-pure-const[discover pure and const functions]' + '-fipa-ra[use caller save register across calls if possible]' + '-fipa-reference[discover readonly and non addressable static variables]' + '-fipa-sra[perform interprocedural reduction of aggregates]' + '-fipa-vrp[perform IPA Value Range Propagation]' + '-fira-algorithm=[set the used IRA algorithm]:algorithm:(cb priority)' + '-fira-hoist-pressure[use IRA based register pressure calculation in RTL hoist optimizations]' + '-fira-loop-pressure[use IRA based register pressure calculation in RTL loop optimizations]' + '-fira-region=-[set regions for IRA]:region:(all mixed one)' + '-fira-region=[set regions for IRA]:region:(one all mixed)' + '-fira-share-save-slots[share slots for saving different hard registers]' + '-fira-share-spill-slots[share stack slots for spilled pseudo-registers]' + '-fira-verbose=-[control IRA'\''s level of diagnostic messages]:verbosity: ' + '-fisolate-erroneous-paths-attribute[detect paths that trigger erroneous or undefined behavior due to a null value being used in a way forbidden by a returns_nonnull or]' + '-fisolate-erroneous-paths-dereference[detect paths that trigger erroneous or undefined behavior due to dereferencing a null pointer. Isolate those paths from the main]' + '-fivopts[optimize induction variables on trees]' + '-fjump-tables[use jump tables for sufficiently large switch statements]' + '-fkeep-inline-functions[generate code for functions even if they are fully inlined]' + '-fkeep-static-consts[emit static const variables even if they are not used]' + '-flax-vector-conversions[allow implicit conversions between vectors with differing numbers of subparts and/or differing element types]' + '-fleading-underscore[give external symbols a leading underscore]' + '-flifetime-dse[tell DSE that the storage for a C++ object is dead when the constructor starts and when the destructor finishes]' + '-flive-range-shrinkage[relief of register pressure through live range shrinkage]' + '-floop-nest-optimize[enable the loop nest optimizer]' + '-floop-parallelize-all[mark all loops as parallel]' + '-flra-remat[do CFG-sensitive rematerialization in LRA]' + '-flto-compression-level=-[use specified zlib compression level for IL]:compression level: ' + '-flto-odr-type-merging[merge C++ types using One Definition Rule]' + '-flto-partition=-[partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)' + '-flto-report[report various link-time optimization statistics]' + '-fmath-errno[set errno after built-in math functions]' + '-fmax-errors=-[maximum number of errors to report]:errors: ' + '-fmem-report[report on permanent memory allocation]' + '-fmem-report-wpa[report on permanent memory allocation in WPA only]' + '-fmerge-all-constants[attempt to merge identical constants and constant variables]' + '-fmerge-constants[attempt to merge identical constants across compilation units]' + '-fmerge-debug-strings[attempt to merge identical debug strings across compilation units]' + '-fmessage-length=-[limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: ' + '-fmodulo-sched-allow-regmoves[perform SMS based modulo scheduling with register moves allowed]' + '-fmodulo-sched[perform SMS based modulo scheduling before the first scheduling pass]' + '-fmove-loop-invariants[move loop invariant computations out of loops]' + "-fms-extensions[don't warn about uses of Microsoft extensions]" + '-fmudflapir[this switch lacks documentation]' + '-fmudflap[this switch lacks documentation]' + '-fmudflapth[this switch lacks documentation]' + '-fnon-call-exceptions[support synchronous non-call exceptions]' + '-fno-stack-limit[do not limit the size of the stack]' + '-fno-threadsafe-statics[do not generate thread-safe code for initializing local statics]' + '-fnothrow-opt[treat a throw() exception specification as noexcept to improve code size]' + '-fomit-frame-pointer[when possible do not generate stack frames]' + '-fopenacc[enable OpenACC]' + '-fopenmp[enable OpenMP (implies -frecursive in Fortran)]' + "-fopenmp-simd[enable OpenMP's SIMD directives]" + '-foptimize-sibling-calls[optimize sibling and tail recursive calls]' + '-foptimize-strlen[enable string length optimizations on trees]' + '-fopt-info[enable all optimization info dumps on stderr]' + '-fopt-info-type=-[dump compiler optimization details]:filename:_files' + '-fpack-struct[pack structure members together without holes]' + '-fpack-struct=[set initial maximum structure member alignment]:alignment (power of 2): ' + '-fpartial-inlining[perform partial inlining]' + '-fpcc-struct-return[return small aggregates in memory, not registers]' + '-fpch-deps[this switch lacks documentation]' + '-fpch-preprocess[look for and use PCH files even when preprocessing]' + '-fpeel-loops[perform loop peeling]' + '-fpeephole2[enable an RTL peephole pass before sched2]' + '-fpeephole[enable machine specific peephole optimizations]' + '-fPIC[generate position-independent code if possible (large mode)]' + '-fpic[generate position-independent code if possible (small mode)]' + '-fPIE[generate position-independent code for executables if possible (large mode)]' + '-fpie[generate position-independent code for executables if possible (small mode)]' + '-fplan9-extensions[enable Plan 9 language extensions]' + '-fplt[use PLT for PIC calls (-fno-plt- load the address from GOT at call site)]' + '-fplugin-arg--[specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO + '-fplugin=-[specify a plugin to load]:plugin: ' # TODO: complete plugins? + '-fpost-ipa-mem-report[report on memory allocation before interprocedural optimization]' + '-fpredictive-commoning[run predictive commoning optimization]' + '-fprefetch-loop-arrays[generate prefetch instructions, if available, for arrays in loops]' + '-fpre-ipa-mem-report[report on memory allocation before interprocedural optimization]' + '-fpreprocessed[treat the input file as already preprocessed]' + '-fprintf-return-value[treat known sprintf return values as constants]' + '-fprofile-arcs[insert arc-based program profiling code]' + '-fprofile-correction[enable correction of flow inconsistent profile data input]' + '-fprofile-dir=-[set the top-level directory for storing the profile data]:profile directory:_files -/' + '-fprofile[enable basic program profiling code]' + '-fprofile-generate[enable common options for generating profile info for profile feedback directed optimizations]' + '-fprofile-report[report on consistency of profile]' + '-fprofile-use[enable common options for performing profile feedback directed optimizations]' + '-fprofile-values[insert code to profile values of expressions]' + '-frandom-seed=-[use <string> as random seed]:seed: ' + '-freciprocal-math[same as -fassociative-math for expressions which include division]' + '-frecord-gcc-switches[record gcc command line switches in the object file]' + '-free[turn on Redundant Extensions Elimination pass]' + '-freg-struct-return[return small aggregates in registers]' + '-frename-registers[perform a register renaming optimization pass]' + '-freorder-blocks-algorithm=[set the used basic block reordering algorithm]:algorithm:(simple stc)' + '-freorder-blocks-and-partition[reorder basic blocks and partition into hot and cold sections]' + '-freorder-blocks[reorder basic blocks to improve code placement]' + '-freorder-functions[reorder functions to improve code placement]' + '-frequire-return-statement[functions which return values must end with return statements]' + '-frerun-cse-after-loop[add a common subexpression elimination pass after loop optimizations]' + '-freschedule-modulo-scheduled-loops[enable/disable the traditional scheduling in loops that already passed modulo scheduling]' + '-frounding-math[disable optimizations that assume default FP rounding behavior]' + '-frtti[generate run time type descriptor information]' + "-fsanitize=-[enable AddressSanitizer, a memory error detector]:style:($sanitizers)" + '-fsched2-use-superblocks[if scheduling post reload, do superblock scheduling]' + '-fsched-critical-path-heuristic[enable the critical path heuristic in the scheduler]' + '-fsched-dep-count-heuristic[enable the dependent count heuristic in the scheduler]' + '-fsched-group-heuristic[enable the group heuristic in the scheduler]' + '-fsched-interblock[enable scheduling across basic blocks]' + '-fsched-last-insn-heuristic[enable the last instruction heuristic in the scheduler]' + '-fsched-pressure[enable register pressure sensitive insn scheduling]' + '-fsched-rank-heuristic[enable the rank heuristic in the scheduler]' + '-fsched-spec[allow speculative motion of non-loads]' + '-fsched-spec-insn-heuristic[enable the speculative instruction heuristic in the scheduler]' + '-fsched-spec-load[allow speculative motion of some loads]' + '-fsched-spec-load-dangerous[allow speculative motion of more loads]' + '-fsched-stalled-insns[allow premature scheduling of queued insns]' + '-fsched-stalled-insns-dep[set dependence distance checking in premature scheduling of queued insns]' + '-fsched-stalled-insns-dep=[set dependence distance checking in premature scheduling of queued insns]:insns:' + '-fsched-stalled-insns-dep=-[set dependence distance checking in premature scheduling of queued insns]:instructions: ' + '-fsched-stalled-insns=[set number of queued insns that can be prematurely scheduled]:insns:' + '-fsched-stalled-insns=-[set number of queued insns that can be prematurely scheduled]:instructions: ' + '-fschedule-fusion[perform a target dependent instruction fusion optimization pass]' + '-fschedule-insns2[reschedule instructions after register allocation]' + '-fschedule-insns[reschedule instructions before register allocation]' + '-fsched-verbose=-[set the verbosity level of the scheduler]:verbosity: ' + '-fsection-anchors[access data in the same section from shared anchor points]' + '-fselective-scheduling2[run selective scheduling after reload]' + '-fselective-scheduling[schedule instructions using selective scheduling algorithm]' + '-fsel-sched-pipelining-outer-loops[perform software pipelining of outer loops during selective scheduling]' + '-fsel-sched-pipelining[perform software pipelining of inner loops during selective scheduling]' + '-fsel-sched-reschedule-pipelined[reschedule pipelined regions without pipelining]' + '-fshort-double[use the same size for double as for float]' + '-fshort-enums[use the narrowest integer type possible for enumeration types]' + '-fshort-wchar[force the underlying type for "wchar_t" to be "unsigned short"]' + '-fshow-column[show column numbers in diagnostics, when available]' + '-fshrink-wrap[emit function prologues only before parts of the function that need it, rather than at the top of the function]' + '-fshrink-wrap-separate[shrink-wrap parts of the prologue and epilogue separately]' + '-fsignaling-nans[disable optimizations observable by IEEE signaling NaNs]' + '-fsigned-bitfields[when signed or unsigned is not given make the bitfield signed]' + '-fsigned-char[make char signed by default]' + '-fsigned-zeros[disable floating point optimizations that ignore the IEEE signedness of zero]' + '-fsimd-cost-model=[specifies the vectorization cost model for code marked with a simd directive]:model:(unlimited dynamic cheap)' + '-fsingle-precision-constant[convert floating point constants to single precision constants]' + '-fsplit-ivs-in-unroller[split lifetimes of induction variables when loops are unrolled]' + '-fsplit-loops[perform loop splitting]' + '-fsplit-paths[split paths leading to loop backedges]' + '-fsplit-stack[generate discontiguous stack frames]' + '-fsplit-wide-types[split wide types into independent registers]' + '-fssa-backprop[enable backward propagation of use properties at the SSA level]' + '-fssa-phiopt[optimize conditional patterns using SSA PHI nodes]' + '-fstack-check=-[insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)' + '-fstack-limit-register=-[trap if the stack goes past <register>]:register: ' + '-fstack-limit-symbol=-[trap if the stack goes past symbol <name>]:name: ' + '-fstack-protector-all[use a stack protection method for every function]' + '-fstack-protector-explicit[use stack protection method only for functions with the stack_protect attribute]' + '-fstack-protector-strong[use a smart stack protection method for certain functions]' + '-fstack-protector[use propolice as a stack protection method]' + '-fstack-reuse=[set stack reuse level for local variables]:level:(all named_vars none)' + '-fstack-reuse=-[set stack reuse level for local variables]:reuse-level:(all named_vars none)' + '-fstack-usage[output stack usage information on a per-function basis]' + '-fstdarg-opt[optimize amount of stdarg registers saved to stack at start of function]' + '-fstore-merging[merge adjacent stores]' + '-fstrict-aliasing[assume strict aliasing rules apply]' + '-fstrict-enums[assume that values of enumeration type are always within the minimum range of that type]' + '-fstrict-overflow[treat signed overflow as undefined]' + '-fstrict-volatile-bitfields[force bitfield accesses to match their type width]' + '-fsync-libcalls[implement __atomic operations via libcalls to legacy __sync functions]' + '-fsyntax-only[check for syntax errors, then stop]' + '-ftabstop=[distance between tab stops for column reporting]:number' + '-ftest-coverage[create data files needed by "gcov"]' + '-fthread-jumps[perform jump threading optimizations]' + '-ftime-report[report the time taken by each compiler pass]' + '-ftls-model=-[set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)' + '-ftracer[perform superblock formation via tail duplication]' + '-ftrack-macro-expansion=[track locations of tokens coming from macro expansion and display them in error messages]::argument' + '-ftrapping-math[assume floating-point operations can trap]' + '-ftrapv[trap for signed overflow in addition, subtraction and multiplication]' + '-ftree-bit-ccp[enable SSA-BIT-CCP optimization on trees]' + '-ftree-builtin-call-dce[enable conditional dead code elimination for builtin calls]' + '-ftree-ccp[enable SSA-CCP optimization on trees]' + '-ftree-ch[enable loop header copying on trees]' + '-ftree-coalesce-vars[enable SSA coalescing of user variables]' + '-ftree-copy-prop[enable copy propagation on trees]' + '-ftree-cselim[transform condition stores into unconditional ones]' + '-ftree-dce[enable SSA dead code elimination optimization on trees]' + '-ftree-dominator-opts[enable dominator optimizations]' + '-ftree-dse[enable dead store elimination]' + '-ftree-forwprop[enable forward propagation on trees]' + '-ftree-fre[enable Full Redundancy Elimination (FRE) on trees]' + '-ftree-loop-distribute-patterns[enable loop distribution for patterns transformed into a library call]' + '-ftree-loop-distribution[enable loop distribution on trees]' + '-ftree-loop-if-convert[convert conditional jumps in innermost loops to branchless equivalents]' + '-ftree-loop-im[enable loop invariant motion on trees]' + '-ftree-loop-ivcanon[create canonical induction variables in loops]' + '-ftree-loop-linear[enable loop interchange transforms. Same as -floop-interchange]' + '-ftree-loop-optimize[enable loop optimizations on tree level]' + '-ftree-loop-vectorize[enable loop vectorization on trees]' + '-ftree-lrs[perform live range splitting during the SSA- >normal pass]' + '-ftree-parallelize-loops=[enable automatic parallelization of loops]' + '-ftree-parallelize-loops=-[enable automatic parallelization of loops]:threads: ' + '-ftree-partial-pre[in SSA-PRE optimization on trees, enable partial- partial redundancy elimination]' + '-ftree-phiprop[enable hoisting loads from conditional pointers]' + '-ftree-pre[enable SSA-PRE optimization on trees]' + '-ftree-pta[perform function-local points-to analysis on trees]' + '-ftree-reassoc[enable reassociation on tree level]' + '-ftree-scev-cprop[enable copy propagation of scalar-evolution information]' + '-ftree-sink[enable SSA code sinking on trees]' + '-ftree-slp-vectorize[enable basic block vectorization (SLP) on trees]' + '-ftree-slsr[perform straight-line strength reduction]' + '-ftree-sra[perform scalar replacement of aggregates]' + '-ftree-switch-conversion[perform conversions of switch initializations]' + '-ftree-tail-merge[enable tail merging on trees]' + '-ftree-ter[replace temporary expressions in the SSA->normal pass]' + '-ftree-vectorize[enable vectorization on trees]' + '-ftree-vrp[perform Value Range Propagation on trees]' + '-funconstrained-commons[assume common declarations may be overridden with ones with a larger trailing array]' + '-funroll-all-loops[perform loop unrolling for all loops]' + '-funroll-loops[perform loop unrolling when iteration count is known]' + '-funsafe-loop-optimizations[allow loop optimizations to assume that the loops behave in normal way]' + '-funsafe-math-optimizations[allow math optimizations that may violate IEEE or ISO standards]' + '-funsigned-bitfields[when signed or unsigned is not given make the bitfield unsigned]' + '-funsigned-char[make char unsigned by default]' + '-funswitch-loops[perform loop unswitching]' + '-funwind-tables[just generate unwind tables for exception handling]' + '-fuse-ld=-[use the specified linker instead of the default linker]:linker:(bfd gold)' + '-fuse-linker-plugin[use linker plugin during link-time optimization]' + '-fvariable-expansion-in-unroller[apply variable expansion when loops are unrolled]' + '-fvar-tracking-assignments[perform variable tracking by annotating assignments]' + '-fvar-tracking-assignments-toggle[toggle -fvar-tracking-assignments]' + '-fvar-tracking[perform variable tracking]' + '-fvar-tracking-uninit[perform variable tracking and also tag variables that are uninitialized]' + '-fvect-cost-model=[specifies the cost model for vectorization]:model:(unlimited dynamic cheap)' + '-fverbose-asm[add extra commentary to assembler output]' + '-fvisibility=-[set the default symbol visibility]:visibility:(default internal hidden protected)' + '-fvpt[use expression value profiles in optimizations]' + '-fweb[construct webs and split unrelated uses of single variable]' + '-fwhole-program[perform whole program optimizations]' + '-fwide-exec-charset=[convert all wide strings and character constants to character set]:character set' + '-fworking-directory[generate a #line directive pointing at the current working directory]' + '-fwrapv[assume signed arithmetic overflow wraps around]' + '-fzero-initialized-in-bss[put zero initialized data in the bss section]' + {-g-,--debug=}'[generate debug information]::debugging information type or level:(0 1 2 3 gdb gdb0 gdb1 gdb2 gdb3 coff stabs stabs+ dwarf dwarf+ dwarf-2 dwarf-3 dwarf-4 dwarf-5 dwarf32 dwarf64 xcoff xcoff+)' + '-gno-pubnames[don'\''t generate DWARF pubnames and pubtypes sections]' + '-gno-record-gcc-switches[don'\''t record gcc command line switches in DWARF DW_AT_producer]' + '-gno-split-dwarf[don'\''t generate debug information in separate .dwo files]' + '-gno-strict-dwarf[emit DWARF additions beyond selected version]' + '-gpubnames[generate DWARF pubnames and pubtypes sections]' + '-grecord-gcc-switches[record gcc command line switches in DWARF DW_AT_producer]' + '-gsplit-dwarf[generate debug information in separate .dwo files]' + '-gstrict-dwarf[don'\''t emit DWARF additions beyond selected version]' + '-gtoggle[toggle debug information generation]' + '-gvms[generate debug information in VMS format]' + '--help[display this information]' + {-H,--trace-includes}'[print name of each header file used]' + {'*-idirafter','*--include-directory-after='}'[add directory after include search path]:second include path directory:_files -/' + {'*-I-','*--include-directory='}'[add directory to include search path]:header file search path:_files -/' + {'*-imacros','*--imacros='}'[include macros from file before parsing]:macro input file:_files -g \*.h\(-.\)' + '-imultiarch[set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage + '-imultilib=[set dir to be the multilib include subdirectory]:dir:_files -/' + '--include-barrier[restrict all prior -I flags to double-quoted inclusion and remove current directory from include path]' + {'*-include=','*--include='}'[include file before parsing]:include file:_files -g \*.h\(-.\)' + '-iplugindir=-[set <dir> to be the default plugin directory]:directory:_files -/' + {'*-iprefix','*--include-prefix='}'[set the -iwithprefix prefix]:prefix:_files' + '-iquote=[add dir to the end of the quote include path]:dir:_files -/' + '-isysroot=[set dir to be the system root directory]:dir:_files -/' + '*-isystem[add directory to system include search path]:second include path directory (system):_files -/' + {'*-iwithprefixbefore','*--include-with-prefix-before='}'[set directory to include search path with prefix]:main include path directory:_files -/' + {'*-iwithprefix','*--include-with-prefix=','*--include-with-prefix-after='}'[set directory to system include search path with prefix]:second include path directory:_files -/' + '*-L-[add directory to library search path]:library search path:_files -/' + '-lang-asm[set lang asm]' + '*-l+[include library found in search path]:library:->library' + '-MF[write dependency output to the given file]:file:_files' + '-MJ[write a compilation database entry per input]' + '-MQ[add a make-quoted target]:target' + '*-M-[set flags for generating Makefile dependencies]::output dependencies:->dependencies' + '-MT[add an unquoted target]:target' + '-no-canonical-prefixes[do not canonicalize paths when building relative prefixes to other gcc components]' + '-nodefaultlibs[do not use the standard system libraries when linking]' + '-nostartfiles[do not use the standard system startup files when linking]' + {-nostdinc,--no-standard-includes}'[do not search standard system directories or compiler builtin directories for include files]' + '-nostdlib[do not use standard system startup files or libraries when linking]' + {-O-,--optimize=-}'[control the optimization]::optimization level:((0 1 2 3 g\:optimize\ for\ debugging\ experience s\:optimize\ for\ space fast\:optimize\ for\ speed\ disregarding\ exact\ standards\ compliance))' + {-o,--output=}'[write output to file]:output file:_files -g "^*.(c|h|cc|C|cxx|cpp|hpp)(-.)"' + '--output-pch=[output pch]' + '--param[set parameter <param> to value. See manpage for a complete list of parameters]:name=value' + '-pass-exit-codes[exit with highest error code from a phase]' + {-pedantic-errors,--pedantic-errors}'[like -pedantic but issue them as errors]' + {-pedantic,--pedantic}'[issue all mandatory diagnostics in the C standard]' + '(-pg)-p[enable function profiling for prof]' + '-pie[create a position independent executable]' + {-pipe,--pipe}'[use pipes rather than intermediate files]' + {-P,--no-line-commands}'[inhibit generation of linkemakers during preprocess]' + '(-p)-pg[enable function profiling for gprof]' + '-###[print commands to run this compilation]' + '-print-file-name=-[display the full path to library <library>]:library:->library' + '-print-libgcc-file-name[display the name of the compiler'\''s companion library]' + '--print-missing-file-dependencies[print missing file dependencies]' + '-print-multiarch[display the target'\''s normalized GNU triplet, used as a component in the library path]' + '-print-multi-directory[display the root directory for versions of libgcc]' + '-print-multi-lib[display the mapping between command line options and multiple library search directories]' + '-print-multi-os-directory[display the relative path to OS libraries]' + '-print-prog-name=-[display the full path to compiler component <program>]:program:' + '-print-search-dirs[display the directories in the compiler'\''s search path]' + '-print-sysroot[display the target libraries directory]' + '-print-sysroot-headers-suffix[display the sysroot suffix used to find headers]' + {-Qn,-fno-ident}'[do not emit metadata containing compiler name and version]' + '-quiet[do not display functions compiled or elapsed time]' + {-Qy,-fident}'[emit metadata containing compiler name and version]' + '-rdynamic[pass the flag -export-dynamic to the ELF linker, on targets that support it]' + '-remap[remap file names when including files]' + {-S,--assemble}'[compile only; do not assemble or link]' + '-save-stats=-[save code generation statistics]:location:(cwd obj)' + '-save-temps[do not delete intermediate files]' + '-shared[create a shared library]' + '-shared-libgcc[force shared libgcc]' + '*-specs=-[override built-in specs with the contents of <file>]:file:_files' + '-s[remove all symbol table and relocation information from the executable]' + '-static-libgcc[force static libgcc]' + '-static[on systems that support dynamic linking, this prevents linking with the shared libraries]' + {'-std=-','--std='}'[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)' + '-symbolic[bind references to global symbols when building a shared object]' + '--sysroot=-[use <directory> as the root directory for headers and libraries]:directory:_files -/' + '--target-help[display target specific command line options]' + '-time[time the execution of each subprocess]' + {-traditional-cpp,--traditional-cpp}'[use traditional preprocessor]' + {-trigraphs,--trigraphs}'[process trigraph sequences]' + '-T[specify linker script]:linker script:_files' + '-undef[do not predefine system specific and gcc specific macros]' + '*-u[pretend symbol to be undefined]:symbol:' + '--user-dependencies[print user dependencies]' + {'*-U-','*--undefine-macro='}'[undefine a macro]:undefine macro:' + '-version[display the compiler'\''s version]' + '--version[display version information]' + '-V[specify compiler version]:compiler version:' + {-v,--verbose}'[enable verbose output]' + '*-Wa,-[pass arguments to the assembler]:assembler option:' + '--warn--[enable the specified warning]:warning:->warning' + '*-Werror=-[treat specified warning as error (or all if none specified)]::warning:->warning' + '-Wfatal-errors[exit on the first error occurred]' + '*-Wl,-[pass arguments to the linker]:linker option:' + {-w,--no-warnings}'[suppress warnings]' + '*-Wp,-[pass arguments to the preprocessor]:preprocessor option:' + '--write-dependencies[write a depfile containing user and system dependencies]' + '--write-user-dependencies[write a depfile containing user dependencies]' + '*-Xassembler[pass argument to the assembler]:assembler option:' + '*-Xlinker[pass argument to the linker]:linker option:' + '*-Xpreprocessor[pass argument to the preprocessor]:preprocessor option:' + '-x[specify the language of the following input files]:input file language:('"$languages"')' ) -# other common options, gcc --help=warnings --help=optimizers --help=common|sed 1,/language-independent/d -args+=( -# | grep -v :: - '--help[Display this information]' - '--no-warnings[Same as -w]' - '--optimize[Same as -O]' - '--output[Same as -o]' - '--param[Set parameter <param> to value. See manpage for a complete list of parameters]:name=value' - '--verbose[Same as -v]' - '--version[Display version information]' - '-aux-info[Emit declaration information into <file>]:file:_files' - '-dumpbase[Set the file basename to be used for dumps]:file:_files' - '-dumpdir[Set the directory name to be used for dumps]:file:_files -/' - '-fPIC[Generate position-independent code if possible (large mode)]' - '-fPIE[Generate position-independent code for executables if possible (large mode)]' - '-fassociative-math[Allow optimization for floating-point arithmetic which may change the result of the operation due to rounding]' - '-fauto-inc-dec[Generate auto-inc/dec instructions]' - '-fbounds-check[Generate code to check bounds before indexing arrays]' - '-fcall-saved--[Mark <register> as being preserved across functions]:register' - '-fcall-used--[Mark <register> as being corrupted by function calls]:register' - '-fcheck-data-deps[Compare the results of several data dependence analyzers]' - '-fcompare-debug-second[Run only the second compilation of -fcompare-debug]' - '-fcompare-debug=-[Compile with and without e.g. -gtoggle, and compare the final-insns dump]:opts:' #TODO: complete gcc options here - '-fdbg-cnt-list[List all available debugging counters with their limits and counts]' - '-fdbg-cnt=-[,<counter>-<limit>,...) Set the debug counter limit]:counter\:limit,...: ' #TODO: gcc -fdbg-cnt-list -x c /dev/null -o /dev/null -c - '-fdebug-types-section[Output .debug_types section when using DWARF v4 debuginfo]' - '-fdelete-dead-exceptions[Delete dead instructions that may throw exceptions]' - '-fdiagnostics-color=-[Colorize diagnostics]::color:(never always auto)' - '-fdiagnostics-generate-patch[Print fix-it hints to stderr in unified diff format]' - '-fdiagnostics-parseable-fixits[Print fixit hints in machine-readable form]' - '-fdiagnostics-show-caret[Show the source line with a caret indicating the column]' - '-fdiagnostics-show-location=-[How often to emit source location at the beginning of line-wrapped diagnostics]:source location:(once every-line)' - '-fdiagnostics-show-option[Amend appropriate diagnostic messages with the command line option that controls them]' - #not meant for end users - #'-fdisable--pass=-[disables an optimization pass]:range1+range2: ' - #'-fdisable-[disables an optimization pass]' - #'-fenable--pass=-[enables an optimization pass]:range1+range2: ' - #'-fenable-[enables an optimization pass]' - #'-fdump-<type>[Dump various compiler internals to a file]' - '-fdump-final-insns=-[Dump to filename the insns at the end of translation]:filename:_files' - '-fdump-go-spec=-[Write all declarations to file as Go code]:filename:_files' - '-fdump-noaddr[Suppress output of addresses in debugging dumps]' - '-fdump-passes[Dump optimization passes]' - '-fdump-unnumbered-links[Suppress output of previous and next insn numbers in debugging dumps]' - '-fdump-unnumbered[Suppress output of instruction numbers, line number notes and addresses in debugging dumps]' - '-fdwarf2-cfi-asm[Enable CFI tables via GAS assembler directives]' - '-feliminate-dwarf2-dups[Perform DWARF2 duplicate elimination]' - '-feliminate-unused-debug-symbols[Perform unused type elimination in debug info]' - '-feliminate-unused-debug-types[Perform unused type elimination in debug info]' - '-femit-class-debug-always[Do not suppress C++ class debug information]' - '-fexcess-precision=-[Specify handling of excess floating-point precision]:precision handling:(fast standard)' - '-ffast-math[Sets -fno-math-errno, -funsafe-math-optimizations, -ffinite-math-only, -fno-rounding-math, -fno-signaling-nans and -fcx-limited-range]' - '-ffat-lto-objects[Output lto objects containing both the intermediate language and binary output]' - '-ffixed--[Mark <register> as being unavailable to the compiler]:register' - '-ffunction-cse[Allow function addresses to be held in registers]' - '-ffunction-sections[Place each function into its own section]' - '-fgnu-tm[Enable support for GNU transactional memory]' - '-fgraphite[Enable in and out of Graphite representation]' - '-fident[Process #ident directives]' - '-findirect-inlining[Perform indirect inlining]' - '-finhibit-size-directive[Do not generate .size directives]' - '-finline-limit=-[Limit the size of inlined functions to <number>]:number: ' - '-finstrument-functions[Instrument function entry and exit with profiling calls]' - '-fira-loop-pressure[Use IRA based register pressure calculation in RTL loop optimizations]' - '-fira-share-save-slots[Share slots for saving different hard registers]' - '-fira-share-spill-slots[Share stack slots for spilled pseudo-registers]' - '-fira-verbose=-[Control IRA'\''s level of diagnostic messages]:verbosity: ' - '-fkeep-inline-functions[Generate code for functions even if they are fully inlined]' - '-fkeep-static-consts[Emit static const variables even if they are not used]' - '-fleading-underscore[Give external symbols a leading underscore]' - '-flto-compression-level=-[Use specified zlib compression level for IL]:compression level: ' - '-flto-odr-type-merging[Merge C++ types using One Definition Rule]' - '-flto-partition=-[Partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)' - '-flto-report[Report various link-time optimization statistics]' - '-fmax-errors=-[Maximum number of errors to report]:errors: ' - '-fmem-report-wpa[Report on permanent memory allocation in WPA only]' - '-fmem-report[Report on permanent memory allocation]' - '-fmerge-debug-strings[Attempt to merge identical debug strings across compilation units]' - '-fmessage-length=-[Limit diagnostics to <number> characters per line. 0 suppresses line-wrapping]:length: ' - '-fmodulo-sched-allow-regmoves[Perform SMS based modulo scheduling with register moves allowed]' - '-fopt-info-type=-[Dump compiler optimization details]:filename:_files' - '-fopt-info[Dump compiler optimization details]' - '-fpartial-inlining[Perform partial inlining]' - '-fpcc-struct-return[Return small aggregates in memory, not registers]' - '-fpic[Generate position-independent code if possible (small mode)]' - '-fpie[Generate position-independent code for executables if possible (small mode)]' - '-fplugin-arg--[Specify argument <key>=<value> for plugin <name>]:-fplugin-arg-name-key=value: ' #TODO - '-fpost-ipa-mem-report[Report on memory allocation before interprocedural optimization]' - '-fpre-ipa-mem-report[Report on memory allocation before interprocedural optimization]' - '-fprofile-arcs[Insert arc-based program profiling code]' - '-fprofile-correction[Enable correction of flow inconsistent profile data input]' - '-fprofile-generate[Enable common options for generating profile info for profile feedback directed optimizations]' - '-fprofile-report[Report on consistency of profile]' - '-fprofile-use[Enable common options for performing profile feedback directed optimizations]' - '-fprofile-values[Insert code to profile values of expressions]' - '-fprofile[Enable basic program profiling code]' - '-frandom-seed=-[Use <string> as random seed]:seed: ' - '-freciprocal-math[Same as -fassociative-math for expressions which include division]' - '-frecord-gcc-switches[Record gcc command line switches in the object file]' - '-free[Turn on Redundant Extensions Elimination pass]' - "-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:($sanitizers)" - '-fsched-stalled-insns-dep=-[Set dependence distance checking in premature scheduling of queued insns]:instructions: ' - '-fsched-stalled-insns=-[Set number of queued insns that can be prematurely scheduled]:instructions: ' - '-fsched-verbose=-[Set the verbosity level of the scheduler]:verbosity: ' - '-fshow-column[Show column numbers in diagnostics, when available]' - '-fsplit-stack[Generate discontiguous stack frames]' - '-fstack-check=-[Insert stack checking code into the program. -fstack-check=specific if to argument given]:type:(none generic specific)' - '-fstack-limit-register=-[Trap if the stack goes past <register>]:register: ' - '-fstack-limit-symbol=-[Trap if the stack goes past symbol <name>]:name: ' - '-fno-stack-limit' - '-fstack-protector-all[Use a stack protection method for every function]' - '-fstack-protector[Use propolice as a stack protection method]' - '-fstack-usage[Output stack usage information on a per-function basis]' - '-fstrict-overflow[Treat signed overflow as undefined]' - '-fstrict-volatile-bitfields[Force bitfield accesses to match their type width]' - '-fsync-libcalls[Implement __atomic operations via libcalls to legacy __sync functions]' - '-fsyntax-only[Check for syntax errors, then stop]' - '-ftest-coverage[Create data files needed by "gcov"]' - '-ftime-report[Report the time taken by each compiler pass]' - '-ftls-model=-[Set the default thread-local storage code generation model]:TLS model:(global-dynamic local-dynamic initial-exec local-exec)' - '-ftracer[Perform superblock formation via tail duplication]' - '-ftree-loop-linear[Enable loop interchange transforms. Same as -floop-interchange]' - '-fuse-ld=-[Use the specified linker instead of the default linker]:linker:(bfd gold)' - '-fuse-linker-plugin[Use linker plugin during link-time optimization]' - '-fverbose-asm[Add extra commentary to assembler output]' - '-fvisibility=-[Set the default symbol visibility]:visibility:(default internal hidden protected)' - '-fzero-initialized-in-bss[Put zero initialized data in the bss section]' - '-gno-pubnames[Don'\''t generate DWARF pubnames and pubtypes sections]' - '-gno-record-gcc-switches[Don'\''t record gcc command line switches in DWARF DW_AT_producer]' - '-gno-split-dwarf[Don'\''t generate debug information in separate .dwo files]' - '-gno-strict-dwarf[Emit DWARF additions beyond selected version]' - '-gpubnames[Generate DWARF pubnames and pubtypes sections]' - '-grecord-gcc-switches[Record gcc command line switches in DWARF DW_AT_producer]' - '-gsplit-dwarf[Generate debug information in separate .dwo files]' - '-gstrict-dwarf[Don'\''t emit DWARF additions beyond selected version]' - '-gtoggle[Toggle debug information generation]' - '-gvms[Generate debug information in VMS format]' - '-imultiarch[Set <dir> to be the multiarch include subdirectory]:directory:_files -/' #XXX not in manpage - '-iplugindir=-[Set <dir> to be the default plugin directory]:directory:_files -/' - '(-pg)-p[Enable function profiling for prof]' - '(-p)-pg[Enable function profiling for gprof]' - '-pedantic-errors[Like -pedantic but issue them as errors]' - '-pedantic[Issue all mandatory diagnostics in the C standard]' - '-quiet[Do not display functions compiled or elapsed time]' - '-v[Enable verbose output]' - '-version[Display the compiler'\''s version]' - '-w[Suppress warnings]' -# | grep :: - '-fabi-version=-[Use version <n> of the C++ ABI (default: 2)]:ABI version:(1 2 3 4 5 6)' - '-fdebug-prefix-map=-[Map one directory name to another in debug information]:/old/dir=/new/dir:->dirtodir' - '-ffp-contract=-[Perform floating- point expression contraction (default: fast)]:style:(on off fast)' - '-finstrument-functions-exclude-file-list=-[Do not instrument functions listed in files]:comma-separated file list:->commafiles' - '-finstrument-functions-exclude-function-list=-[Do not instrument listed functions]:comma-separated list of syms: ' - '-fira-algorithm=-[Set the used IRA algorithm]:algorithm:(priority CB)' - '-fira-region=-[Set regions for IRA]:region:(all mixed one)' - '-fplugin=-[Specify a plugin to load]:plugin: ' # TODO: complete plugins? - '-fprofile-dir=-[Set the top-level directory for storing the profile data]:profile directory:_files -/' - '-fstack-reuse=-[Set stack reuse level for local variables]:reuse-level:(all named_vars none)' - '-ftree-parallelize-loops=-[Enable automatic parallelization of loops]:threads: ' -) +# not meant for end users +#'-fdisable--pass=-[disables an optimization pass]:range1+range2: ' +#'-fdisable-[disables an optimization pass]' +#'-fenable--pass=-[enables an optimization pass]:range1+range2: ' +#'-fenable-[enables an optimization pass]' +#'-fdump-<type>[dump various compiler internals to a file]' + +args+=($warnings) # How to mostly autogenerate the above stuff: # joinhelplines() { sed '$!N;s/^\( -.*\)\n \s*\([^-]\)/\1 \2/;P;D' } # gcc-x86() { gcc --help=target,\^undocumented | joinhelplines | joinhelplines } # compdef _gnu_generic gcc-x86 # printf '%s\n' ${(onq-)_args_cache_gcc_x86} + +# TODO: -fno-<TAB> and -mno-<TAB> match lots of non-existent options. _arguments -C -M 'L:|-{fWm}no-=-{fWm} r:|[_-]=* r:|=*' \ "$args[@]" \ "$args2[@]" && ret=0 - case "$state" in dump) - _values -s '' 'dump information' \ - 'M[only macro definitions]' \ - 'N[macro names]' \ - 'D[macro definitions and normal output]' \ - 'y[debugging information during parsing]' \ - 'r[after RTL generation]' \ - 'x[only generate RTL]' \ - 'j[after jump optimization]' \ - 's[after CSE]' \ - 'L[after loop optimization]' \ - 't[after second CSE pass]' \ - 'f[after flow analysis]' \ - 'c[after instruction combination]' \ - 'S[after first instruction scheduling pass]' \ - 'l[after local register allocation]' \ - 'g[after global register allocation]' \ - 'R[after second instruction scheduling pass]' \ - 'J[after last jump optimization]' \ - 'd[after delayed branch scheduling]' \ - 'k[after conversion from registers to stack]' \ - 'a[all dumps]' \ - 'm[print memory usage statistics]' \ - 'p[annotate assembler output]' && ret=0 + local -a dump_values=( + 'A[verbose assembly output]' + 'D[macro definitions and normal output]' + 'I[include directives and normal output]' + 'J[after last jump optimization]' + 'L[after loop optimization]' + 'M[only macro definitions]' + 'N[macro names]' + 'R[after second instruction scheduling pass]' + 'S[after first instruction scheduling pass]' + 'a[all dumps]' + 'c[after instruction combination]' + 'd[after delayed branch scheduling]' + 'f[after flow analysis]' + 'g[after global register allocation]' + 'j[after jump optimization]' + 'k[after conversion from registers to stack]' + 'l[after local register allocation]' + 'm[print memory usage statistics]' + 'p[annotate assembler output]' + 'r[after RTL generation]' + 's[after CSE]' + 't[after second CSE pass]' + 'x[only generate RTL]' + 'y[debugging information during parsing]' + ) + _values -s '' 'dump information' $dump_values && ret=0 + ;; +dependencies) + local -a dependencies=( + 'D:generate make dependencies and compile' + 'G:treat missing header files as generated' + 'M:only user header files' + 'MD:output to file' + 'P:generate phony targets for all headers' + 'V:use NMake/Jom format for the depfile' + ) + _describe dependencies dependencies && ret=0 ;; library) + # TODO: improve defaults for library_path (e.g., use output of clang -Wl,-v) + local -a library_path=( /usr/lib /usr/local/lib ) + case $OSTYPE in + (darwin*) + library_path+=( $(xcrun --show-sdk-path)/usr/lib ) + ;; + (linux-gnu) + local tmp + tmp=$(_call_program library-paths $words[1] -print-multiarch) + if [[ $tmp != '' && -d /usr/lib/$tmp ]]; then + library_path+=( /usr/lib/$tmp ) + elif [[ -d /usr/lib64 ]]; then + library_path+=( /usr/lib64 ) + fi + ;; + esac + # Add directories from -L options + for ((i = 2; i < $#words; i++)); do + if [[ "$words[i]" = -L ]]; then + library_path+=("$words[++i]") + elif [[ "$words[i]" = -L* ]]; then + library_path+=("${words[i]##-L}") + fi + done _wanted libraries expl library \ - compadd - ${^=LD_LIBRARY_PATH:-/usr/lib /usr/local/lib}/lib*.(a|so*)(:t:fr:s/lib//) && ret=0 + compadd - $library_path/lib*.(a|so*|dylib)(:t:fr:s/lib//) && ret=0 ;; rundir) compset -P '*:' @@ -1219,7 +2249,39 @@ commafiles) compset -P '*,' _files && ret=0 ;; +framework) + local -a framework_path=() + case $OSTYPE in + darwin*) + framework_path=( $(xcrun --show-sdk-path)/System/Library/Frameworks ) ;; + esac + # Add directories from -F options + for ((i = 2; i < $#words; i++)); do + if [[ "$words[i]" = -F ]]; then + framework_path+=("$words[++i]") + elif [[ "$words[i]" = -F* ]]; then + framework_path+=("${words[i]##-F}") + fi + done + _wanted frameworks expl framework \ + compadd -- $framework_path/*.framework(:t:r) && ret=0 + ;; +warning) + local -a warning_names + for warning in $warnings; do + if [[ "$warning" = (#b)-W([^=\[]##)[^\[]#\[(*)\]* ]]; then + warning_names+=("$match[1]:$match[2]") + fi + done + _describe warning warning_names && ret=0 + ;; +arch) + _wanted cputypes expl "CPU type" compadd -a arch && ret=0 + ;; +archgeneric) + arch+=(generic) + _wanted cputypes expl "CPU type" compadd -a arch && ret=0 + ;; esac return ret - diff --git a/Completion/Unix/Command/_gcore b/Completion/Unix/Command/_gcore index 07a65cd9a..a31a81267 100644 --- a/Completion/Unix/Command/_gcore +++ b/Completion/Unix/Command/_gcore @@ -49,10 +49,20 @@ case $OSTYPE in '::executable:' \ ':pid:_pids' ;; + darwin*) + _arguments -s -A '-*' \ + '-s[suspend the process while the core file is captured]' \ + '-v[report progress on the dump as it proceeds]' \ + '-b+[specify maximum size of core file]:size (MiB): ' \ + '(-c)-o+[write core file to specified file]:file:_files' \ + '(-o)-c+[specify format of core file name]:format (%%N\:program name, %%U\:uid, %%P\:pid, %%T\:time stamp)' \ + '1:pid:_pids' + ;; *) # GNU GDB gcore - _arguments \ - '-o[set core file base name]:file base name:_files' \ - ':pid:_pids' + _arguments -s -A '-*' \ + '-a[dump all memory mappings]' \ + '-o+[set core file base name]:file base name:_files' \ + '*:pid:_pids' ;; esac diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb index 18f797633..6bdd55946 100644 --- a/Completion/Unix/Command/_gdb +++ b/Completion/Unix/Command/_gdb @@ -40,9 +40,9 @@ else (-b) _baudrates && return 0 ;; esac - w=( "${(@)words[2,-1]}" ) + w=( "${(@)words[2,CURRENT-1]}" ) while [[ "$w[1]" = -* ]]; do - [[ "$w[1]" = -[decsxb] ]] && shift 1 w + [[ "$w[1]" = -(cd|se|tty|[decsxb]) ]] && shift 1 w shift 1 w done diff --git a/Completion/Unix/Command/_gem b/Completion/Unix/Command/_gem index b35a5c358..7d81619bb 100644 --- a/Completion/Unix/Command/_gem +++ b/Completion/Unix/Command/_gem @@ -46,7 +46,7 @@ if [[ $state = command ]]; then 'gem_dependencies:gem dependencies file guide' 'platforms:show information about platforms' ) - _describe -t topics 'help topics' helptopics -- && ret=0 + _describe -t topics 'help topic' helptopics -- && ret=0 ;& subcommands) cmds=( ${${${(M)${(f)"$(_call_program commands gem help commands)"}:# [^ ]*}## #}/ ##/:} ) @@ -56,6 +56,11 @@ if [[ $state = command ]]; then check|cleanup|contents|dependency|list|open|pristine|rdoc|uninstall|unpack|update) args+=( '(--all --skip)*:installed gem:->gems-local' ) ;| + install) + (( ${(M)#line:#[^-]*} > 1 )) && args+=( + '(*)--[specify build options]:*:build option:_default' + ) + ;| fetch|install|lock|owner|search|yank) args+=( '*:gem:->gems-remote' ) ;| @@ -196,7 +201,7 @@ if [[ $state = command ]]; then ) ;; environment) - args+=( '1:information:(packageversion gemdir gempath version remotesources platform)' ) + args+=( '1:information:(gemdir gempath version remotesources platform)' ) ;; fetch) def=( both \! local \! remote \! ) @@ -299,6 +304,9 @@ if [[ $state = command ]]; then '*:file:_files' ) ;; + yank) + args+=( '--otp=[specify code for multifactor authentication]:code' ) + ;; esac _arguments -C ${args:-'*: :_default'} \ '(-)'{-h,--help}'[display usage information]' \ diff --git a/Completion/Unix/Command/_getfacl b/Completion/Unix/Command/_getfacl index 15be06a1c..27b5ee1c8 100644 --- a/Completion/Unix/Command/_getfacl +++ b/Completion/Unix/Command/_getfacl @@ -22,6 +22,7 @@ _arguments -s -S \ '(-P --physical)'{-P,--physical}"[physical walk, don't follow symbolic links]" \ '(-t --tabular)'{-t,--tabular}'[use tabular output format]' \ '(-n --numeric)'{-n,--numeric}'[print numeric user/group identifiers]' \ + '--one-file-system[skip files on different filesystems]' \ '(-p --absolute-names)'{-p,--absolute-names}"[don't strip leading '/' in pathnames]" \ '(- *)'{-v,--version}'[display version information]' \ '(- *)'{-h,--help}'[display help information]' \ diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 675460dad..cecb80ac3 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -68,7 +68,10 @@ _git-add () { '--refresh[do not add files, but refresh their stat() info in index]' \ '--ignore-errors[continue adding if an error occurs]' \ $ignore_missing \ - '--chmod[override the executable bit of the listed files]:override:(-x +x)' \ + '--sparse[allow updating entries outside of sparse-checkout cone]' \ + '--chmod=[override the executable bit of the listed files]:override:(-x +x)' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '*:: :->file' && return case $state in @@ -76,8 +79,8 @@ _git-add () { declare -a ignored_files_alternatives if [[ -n ${opt_args[(I)-f|--force]} ]]; then ignored_files_alternatives=( - 'ignored-modified-files:ignored modified files:__git_ignore_line_inside_arguments __git_modified_files --ignored' - 'ignored-other-files:ignored other files:__git_ignore_line_inside_arguments __git_other_files --ignored') + 'ignored-modified-files:ignored modified file:__git_ignore_line_inside_arguments __git_modified_files --ignored' + 'ignored-other-files:ignored other file:__git_ignore_line_inside_arguments __git_other_files --ignored') fi _alternative \ @@ -97,11 +100,8 @@ _git-am () { # NOTE: --rebasing and --resolvemsg are only for internal use between git # rebase and git am. - # TODO: --patch-format is undocumented. - # TODO: --rerere-autoupdate and --no-rerere-autoupdate are - # undocumented (and not implemented here). _arguments -s -S $endopt \ - '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ + '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '(-k --keep)'{-k,--keep}'[pass -k to git mailinfo]' \ @@ -111,13 +111,14 @@ _git-am () { '(--keep-cr )--no-keep-cr[do not pass --keep-cr to git mailsplit]' \ '(-c --scissors --no-scissors)'{-c,--scissors}'[strip everything before a scissors line]' \ '(-c --scissors --no-scissors)--no-scissors[ignore scissors lines]' \ + '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \ '(-q --quiet)'{-q,--quiet}'[only print error messages]' \ '(-u --utf8 --no-utf8)'{-u,--utf8}'[pass -u to git mailinfo]' \ '(-u --utf8 --no-utf8)--no-utf8[pass -n to git mailinfo]' \ '(-3 --3way)'{-3,--3way}'[use 3-way merge if patch does not apply cleanly]' \ $apply_options \ '--quit[abort the patching operation but keep HEAD where it is]' \ - '--show-current-patch[show the patch being applied]' \ + '--show-current-patch=-[show the message being applied]::show [raw]:(diff raw)' \ '(-i --interactive)'{-i,--interactive}'[apply patches interactively]' \ '--committer-date-is-author-date[use author date as committer date]' \ '--ignore-date[use committer date as author date]' \ @@ -160,6 +161,7 @@ _git-archive () { '(- :)'{-l,--list}'[list available archive formats]' \ '(-v --verbose)'{-v,--verbose}'[report progress to stderr]' \ '--prefix=-[prepend the given path prefix to each filename]:path prefix:_directories -r ""' \ + '--add-file=[add untracked file to archive]:file:_files' \ '(-o --output)'{-o+,--output=}'[write archive to specified file]:archive:_files' \ '--worktree-attributes[look for attributes in .gitattributes in working directory too]' \ $backend_args \ @@ -179,8 +181,6 @@ _git-archive () { (( $+functions[_git-bisect] )) || _git-bisect () { - # TODO: next subcommand is undocumented. Git-bisect.sh mentions that the - # subcommand might be removed from the UI level. local curcontext=$curcontext state line ret=1 declare -A opt_args local good bad @@ -226,6 +226,7 @@ _git-bisect () { --term-{good,old}'=[specify alternate term for good revisions]:term' \ --term-{bad,new}'=[specify alternate term for bad revisions]:term' \ '--no-checkout[set BISECT_HEAD reference instead of doing checkout at each iteration]' \ + '--first-parent[follow only the first parent commit upon seeing a merge commit]' \ ':bad revision:__git_commits' \ '*: :->revision-or-path' && ret=0 case $state in @@ -323,14 +324,14 @@ _git-branch () { "($c $m -a)"{-r,--remotes}'[list or delete only remote-tracking branches]' \ "($c $m $d : -r --remotes)-a[list both remote-tracking branches and local branches]" \ "($c $m $d : -v -vv --verbose)"{-v,-vv,--verbose}'[show SHA1 and commit subject line for each head]' \ - "($c $m $d :)--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length" \ + "($c $m $d :)--abbrev=[use specified digits to display object names]:digits" \ "($c $m $d :)--no-abbrev[don't abbreviate sha1s]" \ "(- :)--show-current[show current branch name]" \ "($l $m $d)--create-reflog[create the branch's reflog]" \ "($l $m $d -f --force)"{-f,--force}'[force the creation of a new branch]' \ "($l $m $d -t --track)"{-t,--track}'[setup configuration so that pull merges from the start point]' \ "($l $m $d)--no-track[override the branch.autosetupmerge configuration variable]" \ - "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote-branches:__git_remote_branch_names' \ + "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)"{-u+,--set-upstream-to=}'[set up configuration so that pull merges]:remote branch:__git_remote_branch_names' \ "($l $m $d -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ "($l $m $d)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \ "($l $m $d)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \ @@ -380,6 +381,11 @@ _git-bundle () { (create) if (( CURRENT == 2 )); then _arguments \ + '(-q --quiet)'{-q,--quiet}"[don't show progress]" \ + '--progress[show progress meter]' \ + '--all-progress[show progress meter during object writing phase]' \ + '--all-progress-implied[similar to --all-progress when progress meter is shown]' \ + '--version=[specify bundle format version]:version:(2 3)' \ ':bundle:_files' && ret=0 else local revision_options @@ -393,13 +399,20 @@ _git-bundle () { ;; (verify) _arguments \ + '(-q --quiet)'{-q,--quiet}"[don't show bundle details]" \ ':bundle:_files' && ret=0 ;; - (list-heads|unbundle) + (list-heads) _arguments \ ':bundle:_files' \ '*: :__git_references' && ret=0 - ;; + ;; + (unbundle) + _arguments \ + '--progress[show progress meter]' \ + ':bundle:_files' \ + '*: :__git_references' && ret=0 + ;; esac ;; esac @@ -466,6 +479,8 @@ _git-checkout () { '--no-overlay[remove files from index or working tree that are not in the tree-ish]' \ '(-q --quiet --progress)--no-progress[suppress progress reporting]' \ '--progress[force progress reporting]' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(-)--[start file arguments]' \ '*:: :->branch-or-tree-ish-or-file' && ret=0 @@ -527,11 +542,11 @@ _git-cherry-pick () { '(-m --mainline)'{-m+,--mainline=}'[specify mainline when cherry-picking a merge commit]:parent number' \ '--rerere-autoupdate[update index with reused conflict resolution if possible]' \ '(-n --no-commit --ff)'{-n,--no-commit}'[do not make the actual commit]' \ - '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ + '(-s --signoff --ff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \ '(-e --edit -x -n --no-commit -s --signoff)--ff[fast forward, if possible]' \ '*: : __git_commit_ranges -O expl:git_commit_opts' } @@ -548,7 +563,7 @@ _git-clean () { _arguments -C -S -s $endopt \ '-d[also remove untracked directories]' \ - '(-f --force)'{-f,--force}'[required when clean.requireForce is true (default)]' \ + \*{-f,--force}'[required by default; twice, removes untracked nested repositories]' \ '(-i --interactive)'{-i,--interactive}'[show what would be done and clean files interactively]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would and what would not be removed]' \ '(-q --quiet)'{-q,--quiet}"[don't print names of files removed]" \ @@ -618,6 +633,7 @@ _git-clone () { '(-q --quiet)'{-q,--quiet}'[operate quietly]' \ '(-v --verbose)'{-v,--verbose}'[always display the progressbar]' \ '--progress[output progress even if stderr is not a terminal]' \ + "--reject-shallow[don't clone shallow repository]" \ '(-n --no-checkout)'{-n,--no-checkout}'[do not checkout HEAD after clone is complete]' \ '(-o --origin)--bare[make a bare GIT repository]' \ '(--bare)--mirror[clone refs into refs/* instead of refs/remotes/origin/*]' \ @@ -634,13 +650,14 @@ _git-clone () { "--no-tags[don't clone any tags and make later fetches not follow them]" \ '--shallow-submodules[any cloned submodules will be shallow]' \ '--recursive[initialize all contained submodules]' \ - '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \ + '(--recursive --recurse-submodules)'{--recursive,--recurse-submodules}'=-[initialize submodules in the clone]::file:__git_files' \ '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ \*--server-option='[send specified string to the server when using protocol version 2]:option' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ '--remote-submodules[any cloned submodules will use their remote-tracking branch]' \ + '--sparse[initialize the sparse-checkout file to start with only the top-level files]' \ ': :->repository' \ ': :_directories' && ret=0 @@ -684,7 +701,7 @@ _git-commit () { # TODO: --interactive isn't explicitly listed in the documentation. _arguments -S -s $endopt \ '(-a --all --interactive -o --only -i --include *)'{-a,--all}'[stage all modified and deleted paths]' \ - '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ + '--fixup=[construct a commit message for use with rebase --autosquash]:commit to be amended:_git_fixup' \ '--squash=[construct a commit message for use with rebase --autosquash]:commit to be amended:__git_recent_commits' \ $reset_author_opt \ '( --porcelain --dry-run)--short[dry run with short output format]' \ @@ -696,7 +713,8 @@ _git-commit () { {-p,--patch}'[use the interactive patch selection interface to chose which changes to commit]' \ '(--reset-author)--author[override the author name used in the commit]:author name' \ '--date=[override the author date used in the commit]:date' \ - '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ + '*--trailer=[add custom trailer(s)]:trailer' \ + '(-s --signoff)'{-s,--signoff}'[add Signed-off-by trailer at the end of the commit message]' \ '(-n --no-verify)'{-n,--no-verify}'[bypass pre-commit and commit-msg hooks]' \ '--allow-empty[allow recording an empty commit]' \ '--allow-empty-message[allow recording a commit with an empty message]' \ @@ -709,6 +727,8 @@ _git-commit () { '(-u --untracked-files)'{-u-,--untracked-files=-}'[show files in untracked directories]::mode:((no\:"show no untracked files" normal\:"show untracked files and directories" all\:"show individual files in untracked directories"))' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(-q --quiet -v --verbose)'{-v,--verbose}'[show unified diff of all file changes]' \ '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress commit summary message]' \ '--dry-run[only show list of paths that are to be committed or not, and any untracked]' \ @@ -723,7 +743,7 @@ _git-commit () { {-C+,--reuse-message=}'[use existing commit object with same log message]: :__git_commits' \ {-c+,--reedit-message=}'[use existing commit object and edit log message]: :__git_commits' \ {-F+,--file=}'[read commit message from given file]: :_files' \ - {-m+,--message=}'[use the given message as the commit message]:message' \ + \*{-m+,--message=}'[use the given message as the commit message]:message' \ {-t+,--template=}'[use file as a template commit message]:template:_files' } @@ -735,7 +755,7 @@ _git-describe () { '--all[use any ref found in "$GIT_DIR/refs/"]' \ '--tags[use any ref found in "$GIT_DIR/refs/tags"]' \ '(--tags)--contains[find the tag after the commit instead of before]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ '( --exact-match)--candidates=[consider up to given number of candidates]: :__git_guard_number "number of candidates"' \ '(--candidates )--exact-match[only output exact matches, same as --candidates=0]' \ '--debug[display information about the searching strategy]' \ @@ -806,11 +826,14 @@ _git-diff () { # Example: git diff branch1..branch2 <tab> __git_tree_files ${PREFIX:-.} $(__git_committish_range_last $line[1]) && ret=0 elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then + local files_alt='files::__git_tree_files ${PREFIX:-.} HEAD' + [[ $line[1] = (HEAD|@) ]] && + files_alt='files::__git_changed_files' # Example: git diff branch1 <tab> _alternative \ 'commits::__git_commits' \ 'blobs-and-trees-in-treeish::__git_blobs_and_trees_in_treeish' \ - 'files::__git_tree_files ${PREFIX:-.} HEAD' && ret=0 + $files_alt && ret=0 elif __git_is_blob $line[1]; then _alternative \ 'files::__git_cached_files' \ @@ -831,6 +854,10 @@ _git-diff () { __git_is_treeish $line[2]; then # Example: git diff branch1 branch2 <tab> __git_tree_files ${PREFIX:-.} $line[2] && ret=0 + elif [[ $line[1] = (HEAD|@) ]]; then + # Example: git diff @ file1 <tab> + # Example: git diff HEAD -- <tab> + __git_ignore_line __git_changed_files && ret=0 elif __git_is_committish $line[1] || __git_is_treeish $line[1]; then # Example: git diff branch file1 <tab> # Example: git diff branch -- f<tab> @@ -862,16 +889,17 @@ _git-fetch () { _arguments -C -S -s $endopt \ $fetch_options \ - '--shallow-since=[deepen history of shallow repository based on time]:time' \ - '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \ - '--deepen[deepen history of shallow clone]:number of commits' \ - '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ + '--atomic[use atomic transaction to update references]' \ '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ + '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ + '--prefetch[modify the refspec to place all refs within refs/prefetch/]' \ '(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \ - \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \ - '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \ + '--write-fetch-head[write fetched references to the FETCH_HEAD file]' \ + "--negotiate-only[don't fetch a packfile; instead, print ancestors of negotiation tips]" \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ - "--auto-gc[run 'gc --auto' after fetching]" \ + '(--auto-maintenance --auto-gc)'--auto-{maintenance,gc}"[run 'maintenance --auto' after fetching]" \ + '--write-commit-graph[write the commit-graph after fetching]' \ + '--stdin[accept refspecs from stdin]' \ '*:: :->repository-or-group-or-refspec' && ret=0 case $state in @@ -911,7 +939,7 @@ _git-format-patch () { '--start-number=[start numbering patches at given number]: :__git_guard_number "patch number"' \ '--numbered-files[use only number for file name]' \ '(-n --numbered -N --no-numbered -k --keep-subject --rfc --subject-prefix)'{-k,--keep-subject}"[don't strip/add \[PATCH\] from the first line of the commit message]" \ - '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: line to the commit message]' \ + '(-s --signoff)'{-s,--signoff}'[add Signed-off-by: trailer to the commit message]' \ '(-o --output-directory)--stdout[output the generated mbox on standard output (implies --mbox)]' \ '( --no-attach --inline)--attach=-[create attachments instead of inlining patches]::boundary' \ '(--attach --inline)--no-attach[disable creation of attachments]' \ @@ -922,7 +950,9 @@ _git-format-patch () { '--in-reply-to=[make the first mail a reply to the given message]:message id' \ '--ignore-if-in-upstream[do not include a patch that matches a commit in the given range]' \ '(-v --reroll-count)'{-v+,--reroll-count=}'[mark the series as the <n>-th iteration of the topic]: :__git_guard_number iteration' \ + '--filename-max-length=[specify max length of output filename]:length' \ '(-k --keep-subject --subject-prefix)--rfc[use \[RFC PATCH\] instead of \[PATCH\]]' \ + "--cover-from-description=[generate parts of a cover letter based on a branch's description]:mode:(message default subject auto none)" \ '(-k --keep-subject --rfc)--subject-prefix=[use the given prefix instead of \[PATCH\]]:prefix' \ '*--to=[add To: header to email headers]: :_email_addresses' \ '*--cc=[add Cc: header to email headers]: :_email_addresses' \ @@ -1140,6 +1170,8 @@ _git-init () { '--template=[directory to use as a template for the object database]: :_directories' \ '--shared=[share repository amongst several users]:: :__git_repository_permissions' \ '--separate-git-dir=[create git dir elsewhere and link it using the gitdir mechanism]:: :_directories' \ + '(-b --initial-branch)'{-b+,--initial-branch=}'[override the name of the initial branch]:branch name' \ + '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \ ':: :_directories' } @@ -1208,6 +1240,49 @@ _git-log () { return ret } +(( $+functions[_git-maintenance] )) || +_git-maintenance() { + local curcontext="$curcontext" state state_descr line ret=1 + local -A opt_args + + _arguments -C \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + local -a commands + + commands=( + register:'initialize config values to run maintenance on this repository' + run:'run one or more maintenance tasks' + start:'start running maintenance on the current repository' + stop:'halt the background maintenance schedule' + unregister:'remove the current repository from background maintenance' + ) + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + (run) + _arguments -S $endopt \ + '--auto[run tasks based on the state of the repository]' \ + '--schedule=[run tasks based on frequency]:frequency (seconds)' \ + "--quiet[don't report progress or other information to stderr]" \ + '*--task=[run a specific task]:task:(gc commit-graph prefetch loose-objects incremental-repack pack-refs)' && ret=0 + ;; + (start) + _arguments \ + '--scheduler=:scheduler:(auto crontab systemd-timer launchctl schtasks)' + esac + ;; + esac + + return ret +} + (( $+functions[_git-merge] )) || _git-merge () { local -a merge_options @@ -1239,6 +1314,7 @@ _git-mv () { '(-f --force)'{-f,--force}'[rename/move even if targets exist]' \ '-k[skip rename/move that would lead to errors]' \ '(-n --dry-run)'{-n,--dry-run}'[only show what would happen]' \ + '--sparse[allow updating entries outside of sparse-checkout cone]' \ ':source:__git_cached_files' \ '*:: :->source-or-destination' && ret=0 @@ -1302,7 +1378,6 @@ _git-notes () { ': :__git_commits' && ret=0 ;; (copy) - # TODO: --for-rewrite is undocumented. _arguments -S -s $endopt \ '(-f --force)'{-f,--force}'[replace existing note]' \ '(:)--stdin[read objects from stdin]' \ @@ -1367,7 +1442,6 @@ _git-pull () { interactive\:"allow list of commits to be edited" ))' \ '(-r --rebase )--no-rebase[do not perform a rebase after fetching]' \ - '--autostash[automatically stash/stash pop before and after rebase]' \ $fetch_options \ '(--no-tags -t --tags)--no-tags[disable automatic tag following]' \ ': :__git_any_repositories' \ @@ -1399,6 +1473,7 @@ _git-push () { '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[path to git-receive-pack on remote]:remote git-receive-pack:_files' \ '(--force-with-lease --no-force-with-lease)*--force-with-lease=-[allow refs that are not ancestors to be updated if current ref matches expected value]::ref and expectation:->lease' \ '(--force-with-lease --no-force-with-lease)--no-force-with-lease[cancel all previous force-with-lease specifications]' \ + '--force-if-includes[require remote updates to be integrated locally]' \ '(-f --force)'{-f,--force}'[allow refs that are not ancestors to be updated]' \ '(:)--repo=[default repository to use]:repository:__git_any_repositories' \ '(-u --set-upstream)'{-u,--set-upstream}'[add upstream reference for each branch that is up to date or pushed]' \ @@ -1417,7 +1492,7 @@ _git-push () { '(--no-signed --sign)--signed[GPG sign the push]' \ "(--sign --signed)--no-signed[don't GPG sign the push]" \ '--atomic[request atomic transaction on remote side]' \ - '(-o --push-option)'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \ + '*'{-o+,--push-option=}'[transmit string to server to pass to pre/post-receive hooks]:string' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ ': :__git_any_repositories' \ @@ -1445,6 +1520,9 @@ _git-range-diff () { _arguments -s -S $endopt \ '--creation-factor=[specify weighting for creation]:weighting (percent)' \ '--no-dual-color[use simple diff colors]' \ + '(--no-notes)*--notes=[show notes that annotate commit, with optional ref argument show this notes ref instead of the default notes ref(s)]:: :__git_notes_refs' \ + '(--right-only)--left-only[only emit output related to the first range]' \ + '(--left-only)--right-only[only emit output related to the second range]' \ $diff_options \ '1:range 1:__git_commit_ranges' \ '2:range 2:__git_commit_ranges' \ @@ -1470,38 +1548,38 @@ _git-rebase () { '(-)--quit[abort but keep HEAD where it is]' \ '(-)--show-current-patch[show the patch file being applied or merged]' \ - options \ - '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ + '(--onto --root)--keep-base[use the merge-base of upstream and branch as the current base]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ - '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-q,--quiet}'[suppress all output]' \ '(-q --quiet -v --verbose --stat -n --no-stat)'{-v,--verbose}'[output additional information]' \ '(-n --no-stat)'{-n,--no-stat}"[don't show diffstat of what changed upstream]" \ '--rerere-autoupdate[update the index with reused conflict resolution if possible]' \ '--no-verify[bypass the pre-rebase hook]' \ - '-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ + '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)-C-[ensure that given lines of surrounding context match]: :__git_guard_number "lines of context"' \ '(-f --force-rebase)'{-f,--force-rebase}'[force rebase even if current branch descends from commit rebasing onto]' \ - '(-i --interactive)--ignore-whitespace[ignore whitespace in context]' \ - '(-i --interactive)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \ + '(-i --interactive)--ignore-whitespace[ignore changes in whitespace]' \ + '(--apply -m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--whitespace=-[detect a new or modified line that has whitespace errors]: :__git_apply_whitespace_strategies' \ '(-i --interactive)--committer-date-is-author-date[use author date as committer date]' \ - '(-i --interactive --ignore-whitespace --whitespace --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ - '(-r --rebase-merges)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \ - '!(-p --preserve-merges --interactive)'{-p,--preserve-merges} \ - {-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \ - '(-k --keep-empty)'{-k,--keep-empty}'[keep empty commits in the result]' \ - '--allow-empty-message[allow rebasing commits with empty messages]' \ - '(1)--root[rebase all reachable commits]' \ + '(-f --force-rebase)'{--ignore-date,--reset-author-date}'[ignore author date and use current date]' \ + '(-m --merge -s --strategy -X --strategy-option --auto-squash --no-auto-squash -r --rebase-merges -i --interactive -x --exec --empty --reapply-cherry-picks --edit-todo --reschedule-failed-exec)--apply[use apply strategies to rebase]' \ + '(-m --merge --apply --whitespace -C)'{-m,--merge}'[use merging strategies to rebase]' \ + '(-i --interactive --ignore-whitespace --apply --whitespace -C --committer-date-is-author-date)'{-i,--interactive}'[make a list of commits to be rebased and open in $EDITOR]' \ + '(--apply --whitespace -C)--empty=[specify how to handle commits that become empty]:handling:(drop keep ask)' \ + '(--apply --whitespace -C)'{-x+,--exec=}'[with -i\: append "exec <cmd>" after each line]:command:_command_names -e' \ + '(-r --rebase-merges --apply --whitespace -C)'{-r-,--rebase-merges=-}'[try to rebase merges instead of skipping them]::option:(rebase-cousins no-rebase-cousins)' \ + '(--apply --whitespace -C)*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' \ + '(--apply --whitespace -C)*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \ + '(1 --keep-base --fork-point)--root[rebase all reachable commits]' \ $autosquash_opts \ '(--autostash --no-autostash)--autostash[stash uncommitted changes before rebasing and apply them afterwards]' \ "(--autostash --no-autostash)--no-autostash[don't stash uncommitted changes before rebasing and apply them afterwards]" \ - '--fork-point[use merge-base --fork-point to refine upstream]' \ - '--ignore-date[use current timestamp for author date]' \ - '--signoff[add Signed-off-by: line to the commit message]' \ + '(--root)--fork-point[use merge-base --fork-point to refine upstream]' \ + '--signoff[add Signed-off-by: trailer to the commit message]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '(--keep-base)--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ - '(--onto)--keep-base[use the merge-base of upstream and branch as the current base]' \ - "--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \ + "(--apply --whitespace -C)--reschedule-failed-exec[automatically re-schedule any 'exec' that fails]" \ + '(--apply --whitespace -C)--reapply-cherry-picks[apply all changes, even those already present upstream]' \ ':upstream branch:__git_revisions' \ '::working branch:__git_revisions' } @@ -1521,6 +1599,8 @@ _git-reset () { '--recurse-submodules=-[control recursive updating of submodules]::reset:__git_commits' \ '(-p --patch)'{-p,--patch}'[select diff hunks to remove from the index]' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(--soft --mixed --hard --merge --keep):: :__git_commits' \ '(--soft --mixed --hard --merge --keep)*:: :->file' && ret=0 @@ -1548,7 +1628,7 @@ _git-restore() { local -A opt_args _arguments -C -s -S $endopt \ - '(-s --source)'{-s,--source}'[specify which tree-ish to checkout from]:source tree:->sources' \ + '(-s --source)'{-s,--source=}'[specify which tree-ish to checkout from]:source tree:->sources' \ '(-S --staged)'{-S,--staged}'[restore the index]' \ '(-W --worktree)'{-W,--worktree}'[restore the working tree (default)]' \ '--ignore-unmerged[ignore unmerged entries]' \ @@ -1563,17 +1643,23 @@ _git-restore() { '(-2 --ours -3 --theirs -m --merge)'{-3,--theirs}'[checkout their version for unmerged files]' \ '(-p --patch)'{-p,--patch}'[select hunks interactively]' \ "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '*:path spec:->pathspecs' && ret=0 case $state in pathspecs) - if [[ -z ${opt_args[(I)-s|--source|-S|--staged]} ]] && - # use index as a default base unless -S is specified - __git_ignore_line __git_modified_files + integer opt_S opt_W + [[ -n ${opt_args[(I)-S|--staged]} ]] && opt_S=1 + [[ -n ${opt_args[(I)-W|--worktree]} ]] && opt_W=1 + if (( opt_S && opt_W )) then - ret=0 + __git_ignore_line __git_changed_files && ret=0 + elif (( opt_S )) + then + __git_ignore_line __git_changed-in-index_files && ret=0 else - __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Qv)opt_args[(i)-s|--source]:-HEAD} && ret=0 + __git_ignore_line __git_changed-in-working-tree_files && ret=0 fi ;; sources) @@ -1601,7 +1687,7 @@ _git-revert () { '(-n --no-commit)'{-n,--no-commit}'[do not commit the reversion]' \ '(-s --signoff)'{-s,--signoff}'[add Signed-off-by line at the end of the commit message]' \ '--strategy=[use given merge strategy]:merge strategy:__git_merge_strategies' \ - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' \ + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" \ ': :__git_recent_commits' @@ -1618,6 +1704,9 @@ _git-rm () { '-r[allow recursive removal when a leading directory-name is given]' \ '--cached[only remove files from the index]' \ '--ignore-unmatch[exit with 0 status even if no files matched]' \ + '--sparse[allow updating entries outside of sparse-checkout cone]' \ + '(*)--pathspec-from-file=[read pathspec from file]:file:_files' \ + '(*)--pathspec-file-nul[pathspec elements are separated with NUL character]' \ '(-q --quiet)'{-q,--quiet}"[don't list removed files]" \ '*:: :->file' && ret=0 @@ -1646,6 +1735,8 @@ _git-shortlog () { '(-s --summary)'{-s,--summary}'[suppress commit description]' \ '(-e --email)'{-e,--email}'[show email address of each author]' \ '-w-[linewrap the output]:: :->wrap' \ + '*--group=[group commits by field]: : _values -S\: field author committer trailer\:trailer' \ + '(-c --committer)'{-c,--committer}'[alias for --group=committer]' \ $revision_options \ '(-)--[start file arguments]' \ '*:: :->commit-range-or-file' && ret=0 @@ -1721,6 +1812,50 @@ _git-show () { return ret } +(( $+functions[_git-sparse-checkout] )) || +_git-sparse-checkout() { + local curcontext="$curcontext" state state_descr line ret=1 + local -A opt_args + + _arguments -C \ + ': :->command' \ + '*::: := ->option-or-argument' && ret=0 + + case $state in + (command) + local -a commands + + commands=( + list:'describe the patterns in the sparse-checkout file' + init:'enable the core.sparseCheckout setting' + set:'write a set of patterns to the sparse-checkout file' + add:'update the sparse-checkout file to include additional patterns' + reapply:'reapply the sparsity pattern rules to paths in the working tree' + disable:'disable the config setting, and restore all files in the working directory' + ) + + _describe -t commands command commands && ret=0 + ;; + (option-or-argument) + curcontext=${curcontext%:*}-$line[1]: + case $line[1] in + init) + _arguments \ + '--cone[allow for better performance with a limited set of patterns]' \ + '--no-sparse-index[rewrite index to not be sparse]' + ;; + set|add) + _arguments -S \ + '--stdin[read patterns from input]' \ + '*:pattern:_files' && ret=0 + ;; + esac + ;; + esac + + return ret +} + (( $+functions[_git-stash] )) || _git-stash () { local curcontext=$curcontext state line ret=1 @@ -1734,11 +1869,13 @@ _git-stash () { '(-q --quiet)'{-q,--quiet}'[suppress all output]' '(-p --patch -a --all -u --include-untracked)'{-u,--include-untracked}'[include untracked files]' '(-p --patch -a --all -u --include-untracked)'{-a,--all}'[include ignored files]' + '(* -p --patch)--pathspec-from-file=[read pathspec from file]:file:_files' + '(* -p --patch)--pathspec-file-nul[pathspec elements are separated with NUL character]' ) _arguments -C \ '*::: :->args' \ - '(-m --message)'{-m,--message}'[specify stash description]' \ + '(-m --message)'{-m+,--message=}'[specify stash description]:description' \ ${save_arguments//#\(/(* } && ret=0 if [[ -n $state ]]; then @@ -1771,8 +1908,8 @@ _git-stash () { (push) _arguments -S $endopt \ $save_arguments \ - '(-m --message)'{-m,--message}'[specify stash description]' \ - ':: :__git_modified_files' && ret=0 + '(-m --message)'{-m+,--message=}'[specify stash description]:description' \ + '*: : __git_ignore_line __git_modified_files' && ret=0 ;; (--) __git_modified_files @@ -1875,7 +2012,8 @@ _git-submodule () { init:'initialize a submodule' deinit:'unregister a submodule' update:'update a submodule' - set-branch:'set the default remote tracking branch for the submodule' + set-branch:'set default remote tracking branch for the submodule' + set-url:'set URL of the specified submodule' summary:'show commit summary between given commit and working tree/index' foreach:'evaluate shell command in each checked-out submodule' absorbgitdirs:'move the git directory of a submodule into its superprojects' @@ -1931,6 +2069,7 @@ _git-submodule () { '--remote[use the status of the submodule''s remote-tracking branch]' \ '--force[discard local changes by checking out the current up-to-date version]' \ '--init[initialize uninitialized submodules]' \ + '--single-branch[clone only one branch]' \ '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0 ;; (set-branch) @@ -1939,6 +2078,11 @@ _git-submodule () { '(-b --branch)'{-b,--branch=}'[specify the remote branch]:remote branch' \ '1:path:_directories' ;; + (set-url) + _arguments -C -A '-*' \ + '1:path:_directories' \ + '2:url:_urls' && ret=0 + ;; (summary) _arguments -C -A '-*' \ '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ @@ -2289,17 +2433,20 @@ _git-config () { '(--global --system --local -f --file --blob)--worktree[use per-worktree config file]' \ '(--global --system --local --worktree --blob)'{-f+,--file=}'[use given config file]:config file:_files' \ '(--global --system --local --worktree -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \ - '(-t --type --bool --int --bool-or-int --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int path expiry-date color)' \ - '(-t --type --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \ - '(-t --type --bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \ - '(-t --type --bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \ - '(-t --type --bool --int --bool-or-int --expiry-date)--path[setting is a path]' \ - '(-t --type --bool --int --bool-or-int --path)--expiry-date[setting is an expiry date]' \ + '(-t --type --bool --int --bool-or-int --bool-or-str --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int bool-or-str path expiry-date color)' \ + '(-t --type --int --bool-or-int --bool-or-str --path --expiry-date)--bool[setting is a boolean]' \ + '(-t --type --bool --bool-or-int --bool-or-str --path --expiry-date)--int[setting is an integer]' \ + '(-t --type --bool --int --bool-or-str --path --expiry-date)--bool-or-int[setting is a boolean or integer]' \ + '(-t --type --bool --int --bool-or-int --path --expiry-date)--bool-or-str[setting is a boolean or string]' \ + '(-t --type --bool --int --bool-or-int --bool-or-str --expiry-date)--path[setting is a path]' \ + '(-t --type --bool --int --bool-or-int --bool-or-str --path)--expiry-date[setting is an expiry date]' \ '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \ + '--fixed-value[use string equality when comparing values]' \ '(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \ '(--includes)'--no-includes"[don't respect \"include.*\" directives]" \ '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \ - '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--show-origin[show origin of config]' \ + '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-scope)--show-origin[show origin of config]' \ + '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool --show-origin)--show-scope[show scope of config (worktree, local, global, system, command)]' \ '(2 --add -e --edit -l --list --name-only --rename-section --remove-section --replace-all --unset --unset-all)--default=[with --get, use specified default value when entry is missing]:default' \ $name_arg \ $value_arg \ @@ -2311,14 +2458,14 @@ _git-config () { '(--name-only --show-origin)--get-urlmatch[get value specific for the URL]' \ '(-z --null --name-only --show-origin)--replace-all[replace all values of the given key]' \ '(3 -z --null --name-only --show-origin)--add[add new value without altering any existing ones]' \ - '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \ - '(2 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \ - '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \ - '(3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \ - '(: --bool --int --bool-or-int --path)'{-l,--list}'[list all variables set in config file]' \ - '(-e --edit --bool --int --bool-or-int --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \ - '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \ - '(2 3 --bool --int --bool-or-int --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0 + '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset[remove the first matching value of the key]' \ + '(2 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--unset-all[remove all matching values of the key]' \ + '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--rename-section[rename the given section]' \ + '(3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--remove-section[remove the given section]' \ + '(: --bool --int --bool-or-int --bool-or-str --path)'{-l,--list}'[list all variables set in config file]' \ + '(-e --edit --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)'{-e,--edit}'[open config file for editing]' \ + '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-color[find color setting]: :->gettable-color-option' \ + '(2 3 --bool --int --bool-or-int --bool-or-str --path -z --null --name-only --show-origin)--get-colorbool[check if color should be used]: :->gettable-colorbool-option' && ret=0 __git_config_option-or-value "$@" && ret=0 return ret } @@ -2342,7 +2489,7 @@ __git_config_value () { # Helper to _git-config(). May be called by other functions, too, provided # that The caller has set $line, $state, and $opt_args as _git-config() would # set them: -# +# # - set $line[1] to the option name being completed (even if completing an # option value). # - set $opt_args to git-config(1) options, as set by _arguments in @@ -2383,12 +2530,16 @@ __git_config_option-or-value () { advice.nestedTag:'show advice if a user attempts to recursively tag a tag object::->bool:true' author.email:'email address used for author in commits::_email_addresses -c' author.name:'full name used for author in commits:name:->string' + am.threeWay:'use 3-way merge if patch does not apply cleanly::->bool:false' blame.blankboundary:'show blank SHA-1 for boundary commits::->bool:false' blame.coloring:'determine the coloring scheme to be applied to blame output:scheme [none]:->string' + blame.showEmail:"show author email instead of author name::->bool:false" blame.showroot:'show root commits as normal commits::->bool:false' blame.ignoreRevsFile:'ignore revisions listed in the file:file:_files' blame.date:'date format to use in output::__git_date_formats:iso' 'branch.*.description:branch description:branch description:->string' + branch.sort:"default sorting order for 'git branch' output::__git_ref_sort_keys" + checkout.defaultRemote:'assumed remote name when specifying an unqualified remote branch name:remote name:__git_remotes' cvsexportcommit.cvsdir:'the default location of the CVS checkout to use for the export:cvs export dir:_directories' column.ui:'specify whether supported commands should output in columns.::->column:never' column.branch:'specify whether to output branch listing in git branch in columns::_git_column_layouts:never' @@ -2400,7 +2551,9 @@ __git_config_option-or-value () { core.fileMode:'track changes to the executable bit of files::->bool:true' core.attributesfile:'look into this file for attributes in addition to .gitattributes:additional attributes file:_files' core.abbrev:'set the length object names are abbreviated to:length:->int:7' + core.checkRoundtripEncoding:"encodings to UTF-8 round trip check::_guard '' 'comma-separated list of encodings'" # _guard used as a hack because _message doesn't take compadd options core.commentchar:'comment character when using an editor::->string' + core.filesRefLockTimeout:"how long to retry locking a reference:retry time (milliseconds, or -1 for indefinite):->int:100" core.ignoreCygwinFSTricks:'use Cygwin stat()/lstat()::->bool:true' core.ignorecase:'use workarounds for non-case-sensitive filesystems::->bool:false' core.trustctime:'trust inode change time::->bool:true' @@ -2422,6 +2575,7 @@ __git_config_option-or-value () { core.loosecompression:'level of compression to apply to non-pack files::->compression:1' core.packedGitWindowSize:'size of mappings of pack files:pack window size:->bytes' core.packedGitLimit:'maximum number of bytes to map from pack files:maximum pack file map size:->bytes' + core.packedRefsTimeout:"how long to retry locking the packed-refs file:retry time (milliseconds, or -1 for indefinite):->int:1000" core.precomposeunicode:'revert the unicode decomposition of filenames done by Mac OS::->bool:false' core.deltaBaseCacheLimit:'maximum size of cache for base objects:maximum base objects cache size:->bytes:96m' core.bigFileThreshold:'maximum size of files to compress:maximum compress size:->bytes:512m' @@ -2435,13 +2589,17 @@ __git_config_option-or-value () { core.createObject:'take steps to prevent overwriting existing objects::->core.createObject:link' core.checkstat:'determine which stat fields to match between the index and work tree::->core.checkstat:default' core.notesRef:'show notes in given refs:refs:->string:refs/notes/commits' + core.sparseCheckoutCone:"enable git-sparse-checkout(1) cone mode::->bool:false" core.sparseCheckout:'use sparse checkout::->bool:false' + core.splitIndex:"enable the split-index feature::->bool:false" + core.useReplaceRefs:"honour 'replace' refs::->bool:true" credential.helper:'external helper to be called when a username or password credential is needed::_cmdstring' credential.useHttpPath:'consider the "path" component of an http or https URL to be important::->bool:false' credential.username:'If no username is set use this username by default:default username:->string' 'credential.*.helper:external helper to be called when a username or password credential is needed::_cmdstring' 'credential.*.useHttpPath:consider the "path" component of an http or https URL to be important::->bool:false' 'credential.*.username:if no username is set use this username by default:default username:->string' + credentialCache.ignoreSIGHUP:'ignore SIGHUP in git-credential-cache—daemon::->bool:false' add.ignore-errors:'ignore indexing errors when adding files::->bool:false' add.ignoreErrors:'ignore indexing errors when adding files::->bool:false' am.keepcr:'keep CR characters when splitting mails::->bool:false' @@ -2521,13 +2679,18 @@ __git_config_option-or-value () { 'diff.*.xfuncname:regular expression that the diff driver should use to recognize the hunk header:regular expression:->string' diff.algorithm:'default diff algorithm::->diff.algorithm:default' diff.autorefreshindex:'run git update-index --refresh before git diff::->bool:true' + diff.colorMoved:"color moved lines in diffs::__git_color_moved" + diff.colorMovedWS:"ignore whitespace when detecting moved lines::__git_color_movedws" + diff.wsErrorHighlight:'highlight whitespace errors: :__git_ws_error_highlight' diff.context:'default number of context lines::->int:3' diff.dirstat:'comma separated list of --dirstat parameters specifying default behaviour:comma-separated list:->string:changes,noncumulative,3' diff.external:'command to generate diff with:diff command:_cmdstring' + diff.indentHeuristic:"heuristically shift hunk boundaries::->bool:true" + diff.interHunkContext:"combine hunks closer than N lines:number of lines:->int" diff.mnemonicprefix:'use mnemonic source and destination prefixes::->bool:false' diff.noprefix:'strip source and destination prefixes::->bool:false' diff.orderfile:'file to read patch order glob patterns from:order file:_files' - diff.renameLimit:'number of files to consider when detecting copy/renames:rename limit:->int' + diff.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int' diff.renames:'try to detect renames::->diff.renames:true' diff.ignoreSubmodules:'ignore submodules::->bool:false' diff.statGraphWidth:'width of the graph part in --stat output:width:->int' @@ -2539,10 +2702,15 @@ __git_config_option-or-value () { difftool.prompt:'prompt before each invocation of the diff tool::->bool:true' diff.wordRegex:'regex used to determine what a word is when performing word-by-word diff:regular expression:->string' diff.guitool:'diff tool with gui to use::__git_difftools' + merge.guitool:'merge tool with gui to use::__git_difftools' + fastimport.unpackLimit:"whether to import objects as loose object files or as a pack:threshold for packing (number of objects imported):->int" feature.experimental:'enable config options that are new to Git::->bool:false' feature.manyFiles:'enable config options that optimize for repos with many files::->bool:false' + fetch.output:'output format:format:compadd compact full' fetch.parallel:'specify maximum number of fetch operations to run in parallel:number:->int' fetch.prune:'remove any remote tracking branches that no longer exist remotely::->bool:false' + fetch.pruneTags:"maintain one-to-one correspondence with upstream tag refs::->bool:false" + fetch.showForcedUpdates:"show forced updates::->bool:true" fetch.unpackLimit:'maximum number of objects to unpack when fetching:unpack limit:->int' fetch.recurseSubmodules:'recurse into submodules (as needed) when fetching::->fetch.recurseSubmodules:on-demand' fetch.fsckObjects:'check all fetched objects::->bool:false' @@ -2566,13 +2734,16 @@ __git_config_option-or-value () { gc.aggressiveDepth:'maximum delta depth:maximum delta depth::->int:250' gc.aggressiveWindow:'window size used in delta compression algorithm::->int:250' gc.auto:'minimum limit for packing loose objects with --auto::->int:6700' + gc.autoDetach:"make 'git gc --auto' run in the background::->bool:true" gc.autopacklimit:'minimum limit for packing packs with --auto::->int:50' + gc.bigPackThreshold:"keep large packs:size threshold:->bytes" gc.packrefs:'allow git gc to run git pack-refs::->gc.packrefs:true' - gc.pruneexpire:'grace period for pruning::->days+now' + gc.pruneexpire:'grace period for pruning:number of days, "now", or "never":->int' gc.reflogexpire:'grace period for git reflog expire::->days:90' gc.reflogexpireunreachable:'grace period for git reflog expire for unreachable entries::->days:30' gc.rerereresolved:'number of days to keep records of resolved merges::->days:60' gc.rerereunresolved:'number of days to keep records of unresolved merges::->days:15' + gc.worktreePruneExpire:'grace period for pruning worktrees:number of days, "now", or "never":->int' # git default: 3.months.ago gitcvs.commitmsgannotation:'string to append to each commit message::->string' gitcvs.enabled:'enable the cvs server interface::->bool:false' gitcvs.logfile:'name of log file for cvs pserver:log file:_files' @@ -2591,7 +2762,10 @@ __git_config_option-or-value () { 'gitcvs.*.dbTableNamePrefix:database table name prefix:prefix:->string' gitcvs.usecrlfattr:'use end-of-line conversion attributes::->bool:false' gitcvs.allbinary:'treat all files from CVS as binary::->bool:false' - gpg.program:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_cmdstring' + gpg.format:'private key format for --gpg-sign:format:compadd openpgp x509' + gpg.minTrustLevel:'minimum trust level for signature verification:trust level:compadd undefined never marginal fully ultimate' # TODO: sort in this order (use compadd -V) + {gpg.program,gpg.openpgp.program}:'use program instead of "gpg" found on $PATH when making or verifying a PGP signature::_cmdstring' + gpg.x509.program:'use program instead of "gpgsm" found on $PATH when making or verifying an x509 signature::_cmdstring' gui.commitmsgwidth:'width of commit message window:width::->int:75' gui.diffcontext:'number of context lines used in diff window:context::->int:5' gui.encoding:'encoding to use for displaying file contents::->encoding' @@ -2623,10 +2797,12 @@ __git_config_option-or-value () { guitool.revunmerged:'show only unmerged branches in revprompt::->bool:false' guitool.title:'title of prompt dialog:prompt title:->string' guitool.prompt:'prompt to display:prompt:->string' + grep.column:"show column number of first match::->bool:false" grep.extendedRegexp:'enable --extended-regexp option by default (ignored when grep.patternType is set)::->bool:false' grep.fullname:'enable --full-name option by default::->bool:false' grep.lineNumber:'enable -n option by default::->bool:false' grep.patternType:'default matching pattern type::->grep.patternType:default' + grep.threads:"number of worker threads::->int" help.browser:'browser used to display help in web format::__git_browsers' help.htmlpath:'location of HTML help::->help.htmlpath' http.cookiefile:'file containing cookie lines which should be used in the Git http session::_files' @@ -2695,6 +2871,7 @@ __git_config_option-or-value () { instaweb.local:'bind to 127.0.0.1::->bool:false' instaweb.modulepath:'module path for the Apache HTTP-daemon for instaweb:module directory:_directories' instaweb.port:'port to bind HTTP daemon to for instaweb::_ports' + interactive.diffFilter:"mark up diffs for human consumption:filter command:_cmdstring" interactive.singlekey:'accept one-letter input without Enter::->bool:false' log.abbrevCommit:'make git-log, git-show, and git-whatchanged assume --abbrev-commit::->bool:false' log.date:'default date-time mode::__git_date_formats' @@ -2712,7 +2889,9 @@ __git_config_option-or-value () { merge.defaultToUpstream:'merge the upstream branches configured for the current branch by default::->bool:true' merge.ff:'allow fast-forward merges::->merge.ff:true' merge.log:'include summaries of merged commits in new merge commit messages::->bool:false' - merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit:->int' + merge.directoryRenames:"try to detect directory renames:mode:compadd false true conflict" + merge.renames:"try to detect renames::->diff.renames" + merge.renameLimit:'number of files to consider when detecting copy/renames during merge:limit (number of files):->int' merge.renormalize:'use canonical representation of files during merge::->bool:false' merge.stat:'print the diffstat between ORIG_HEAD and merge at end of merge::->bool:true' merge.tool:'tool used by git mergetool during merges::__git_mergetools' @@ -2748,10 +2927,13 @@ __git_config_option-or-value () { push.followTags:'enable --follow-tags option by default::->bool:false' push.gpgSign:'GPG-sign pushes::->bool:false' push.recurseSubmodules:'ensure all submodule commits are available on a remote-tracking branch' + push.pushOption:'transmit strings to server to pass to pre/post-receive hooks::->string' rebase.stat:'show a diffstat of what changed upstream since last rebase::->bool:false' rebase.autoSquash:'autosquash by default::->bool:false' rebase.autoStash:'autostash by default::->bool:false' + rebase.instructionFormat:'interactive rebase todo list format::__git_format_placeholders' rebase.missingCommitsCheck:'print a warning if some commits are removed' + rebase.rescheduleFailedExec:"automatically re-schedule any 'exec' that fails::->bool" receive.autogc:'run git gc --auto after receiving data::->bool:true' receive.fsckObjects:'check all received objects::->bool:true' receive.hiderefs:'string(s) receive-pack uses to decide which refs to omit from its initial advertisement:hidden refs:->string' @@ -2767,6 +2949,7 @@ __git_config_option-or-value () { 'remote.*.promisor:use this remote to fetch promisor objects::->bool:false' 'remote.*.pushurl:push URL of a remote repository::__git_any_repositories' 'remote.*.proxy:URL of proxy to use for a remote repository::_urls' + "remote.*.pruneTags:maintain one-to-one correspondence with remote's tag refs::->bool:false" 'remote.*.prune:remove any remote tracking branches that no longer exist remotely::->bool:false' 'remote.*.fetch:default set of refspecs for git fetch::__git_ref_specs_fetchy' 'remote.*.push:default set of refspecs for git push::__git_ref_specs_pushy' @@ -2777,9 +2960,13 @@ __git_config_option-or-value () { 'remote.*.uploadpack:default program to execute on remote when fetching:git upload-pack command:_cmdstring' 'remote.*.tagopt:options for retrieving remote tags::->remote.tagopt' 'remote.*.vcs:interact with the remote through git-remote helper:remote VCS:->string' + repack.packKeptObjects:'repack objects in packs marked with .keep::->bool' + repack.useDeltaIslands:'pass --delta-islands to git-pack-objects::->bool:false' repack.usedeltabaseoffset:'use delta-base offsets::->bool:true' + repack.writeBitmaps:'trade off disk space for faster subsequent repacks::->bool' rerere.autoupdate:'update index after resolution::->bool:false' rerere.enabled:'record resolved conflicts::->bool' + reset.quiet:'pass --quiet by default::->bool:false' sendemail.identity:'default identity::__git_sendemail_identities' sendemail.smtpencryption:'encryption method to use::->sendemail.smtpencryption' sendemail.aliasesfile:'file containing email aliases:email aliases file:_files' @@ -2788,13 +2975,15 @@ __git_config_option-or-value () { sendemail.bcc:'value of Bcc\: header::_email_addresses' sendemail.cc:'value of Cc\: header::_email_addresses' sendemail.cccmd:'command to generate Cc\: header with:Cc\: command:_cmdstring' - sendemail.toccmd:'command to generate To\: header with:To\: command:_cmdstring' + sendemail.tocmd:'command to generate To\: header with:To\: command:_cmdstring' sendemail.chainreplyto:'send each email as a reply to the previous one::->bool:false' sendemail.confirm:'type of confirmation required before sending::->sendemail.confirm:auto' sendemail.envelopesender:'envelope sender to send emails as::_email_addresses' sendemail.from:'sender email address::_email_addresses' sendemail.multiedit:'edit all files at once::->bool:true' sendemail.signedoffbycc:'add Signed-off-by\: or Cc\: lines to Cc\: header::->bool:true' + sendemail.smtpBatchSize:"number of messages to send per SMTP connection::->int" + sendemail.smtpReloginDelay:"delay before reconnecting to SMTP server:delay (seconds):->int" sendemail.smtppass:'password to use for SMTP-AUTH:password:->string' sendemail.suppresscc:'rules for suppressing Cc\:::->sendemail.suppresscc' sendemail.suppressfrom:'add From\: address to the Cc\: list::->bool:false' @@ -2807,6 +2996,7 @@ __git_config_option-or-value () { sendemail.smtpuser:'user to use for SMTP-AUTH:smtp user:_users' sendemail.thread:'set In-Reply-To\: and References\: headers::->bool:true' sendemail.validate:'perform sanity checks on patches::->bool:true' + sendemail.xmailer:'add the "X-Mailer" header::->bool:true' 'sendemail.*.aliasesfile:file containing email aliases::_files' 'sendemail.*.aliasfiletype:format of aliasesfile::->sendemail.aliasfiletype' 'sendemail.*.annotate:review and edit each patch you are about to send::bool->false' @@ -2834,17 +3024,23 @@ __git_config_option-or-value () { sendemail.assume8bitEncoding:'encoding to use for non-ASCII messages::__git_encodings' sequence.editor:'text editor used by git rebase -i::_cmdstring' showbranch.default:'default set of branches for git show-branch::->branch' + status.aheadBehind:"display detailed ahead/behind counts relative to upstream branch::->bool:true" status.relativePaths:'show paths relative to current directory::->bool:false' + status.showStash:'show number of stashes::->bool:false' status.showUntrackedFiles:'show untracked files::->status.showUntrackedFiles:normal' status.submodulesummary:'include submodule summary::->bool:false' status.branch:'show branch and tracking info in short format::->bool:false' status.short:'use short format by default::->bool:false' + status.renameLimit:'number of files to consider when detecting copy/renames:limit (number of files):->int' + status.renames:"detect renames in 'status' and 'commit'::->diff.renames" 'submodule.*.branch:remote branch name for a submodule:branch name:->string' 'submodule.*.fetchRecurseSubmodules:fetch commits of submodules::->bool' 'submodule.*.path:path within project:submodule directory:_directories -qS \:' 'submodule.*.url:URL to update from::__git_any_repositories' 'submodule.*.update:update strategy to use::->submodule.update:none' 'submodule.*.ignore:ignore modifications to submodules with git status and git diff-*::->submodule.ignore' + submodule.recurse:'recurse into submodules by default (for most git commands)::->bool:false' + ssh.variant:'SSH command flavour:flavour id:compadd ssh simple plink putty tortoiseplink' svn.noMetadata:'disable git-svn-id: lines at end of commits::->bool:false' svn.useSvmProps:'use remappings of URLs and UUIDs from mirrors::->bool:false' svn.useSvnsyncProps:'use remappings of URLs and UUIDs for the svnsync command::->bool:false' @@ -2866,6 +3062,7 @@ __git_config_option-or-value () { 'svn-remote.*.pushurl:URL to push to::_urls' 'svn-remote.*.branches:branch mappings:branch mapping:->string' 'svn-remote.*.tags:tag mappings:tag mapping:->string' + tag.gpgSign:'sign all tags::->bool' tag.sort:'default sorting method:sorting method:->string' 'tar.*.command:specify a shell command through which the tar output generated by git archive should be piped::_cmdstring' 'tar.*.remote:enable <format> for use by remote clients via git-upload-archive::->bool' @@ -2885,6 +3082,8 @@ __git_config_option-or-value () { versionsort.suffix:'specify sort order of suffixes applied to tags:suffix' web.browser:'web browser to use::__git_browsers' worktree.guessRemote:'with add, if branch matches remote track it::->bool:true' + + {fetch.fsck.skipList,receive.fsck.skipList,fsck.skipList}:'ignore objects broken in a non-fatal way:path to a list of objects:_files' ) declare -a git_present_options # 'present' is an adjective @@ -2907,12 +3106,13 @@ __git_config_option-or-value () { pretty remotes ${(u)${(M)${git_options%%:*}:#*[.][*][.]*}%%.*} + ${(u)${(M)git_present_options:#*[.][*][.]*}%%.*} ) local key for key in $git_present_options ; do if (( ${+git_options[(r)(#i)${(b)key}:*]} )); then # $key is already in git_options - continue + continue elif (( ${+sections_that_permit_arbitrary_subsection_names[(r)${(b)key%%.*}]} )); then if [[ $key == *.*.* ]]; then # If $key isn't an instance of a known foo.*.bar:baz $git_options entry... @@ -2952,6 +3152,7 @@ __git_config_option-or-value () { if compset -P '[^.]##.*.'; then declare -a match mbegin mend + # TODO: completing 'gpg.openpgp<TAB>' adds both 'gpg.openpgp.program' and 'gpg.*.program' to $options, so it ends up being listed as 'unknown option name' even though we have a description # When completing 'remote.foo.<TAB>', offer 'bar' if $git_options contains 'remote.foo.bar'. options+=(${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}) # When completing 'remote.foo.<TAB>', offer 'bar' if $git_options contains 'remote.*.bar'. @@ -2989,8 +3190,8 @@ __git_config_option-or-value () { elif compset -P '[^.]##.'; then local opt declare -a match mbegin mend - for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:]##:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do - if (( ${git_options[(I)${opt%%:*}.*]} )); then + for opt in ${${${${(M)git_options:#(#i)${IPREFIX}[^.:][^:]#:*}#(#i)${IPREFIX}}/#(#b)([^:]##:)([^\\:]#(\\?[^\\:]#)#:[^\\:]#(\\?[^\\:]#)#:->bool)/$match[1]whether or not to $match[2]}/#(#b)([^:]##:([^\\:]#(\\?[^\\:]#)#))*/$match[1]}; do + if (( ${git_options[(I)${IPREFIX}${opt%%:*}.*]} )); then sections_and_options+=$opt else options+=$opt @@ -3073,7 +3274,7 @@ __git_config_option-or-value () { ;; (*.) local -a existing_subsections=( ${${${(M)git_present_options:#${IPREFIX}*.*}#${IPREFIX}}%.*} ) - _describe -t existing-subsections "existing subsections" existing_subsections -S . && ret=0 + _describe -t existing-subsections "existing subsection" existing_subsections -S . && ret=0 ;; esac else @@ -3238,7 +3439,7 @@ __git_config_option-or-value () { _message 'git-merge options' ;; (bytes) - __git_guard_bytes "$parts[2]" && ret=0 + __git_guard_bytes "$parts[3]" && ret=0 ;; (color) compset -P '* ' @@ -3319,16 +3520,6 @@ __git_config_option-or-value () { __git_guard_number 'number of days' fi ;; - (days+now) - # TODO: This needs to be improved. - if [[ -n $current ]]; then - compadd - $current && ret=0 - elif [[ -n $parts[5] ]]; then - compadd - $parts[5] && ret=0 - else - __git_guard_number 'number of days' - fi - ;; (diff.algorithm) __git_config_values -- "$current" "$parts[5]" \ default:'basic greedy diff algorithm' \ @@ -3408,7 +3599,7 @@ __git_config_option-or-value () { elif [[ -n $parts[5] ]]; then compadd - $parts[5] && ret=0 else - __git_guard_number 'integer' + __git_guard_number ${parts[3]:-'integer'} fi ;; (merge.conflictstyle) @@ -3528,7 +3719,7 @@ __git_config_option-or-value () { (*) # TODO: Do we need to set up a _requested/_next_label? declare -a action - _description values expl "$parts[2]" + _description values expl "$parts[3]" eval "action=($parts[4])" "$action[1]" "$expl[@]" "${(@)action[2,-1]}" && ret=0 ;; @@ -3560,11 +3751,12 @@ _git-fast-export () { '--import-marks-if-exists=[load marks from file if it exists]: :_files' \ '--fake-missing-tagger=[fake a tagger when tags lack them]' \ '--use-done-feature[start with a "feature done" stanza, and terminate with a "done" command]' \ - '--no-data[do not output blocb objects, instead referring to them via their SHA-1 hash]' \ + "--no-data[skip output of blob objects, instead referring to them via their SHA-1 hash]" \ '--full-tree[output full tree for each commit]' \ '(--get --get-all)--name-only[show variable names only]' \ '*--refspec=[apply refspec to exported refs]:refspec' \ '--anonymize[anonymize output]' \ + '*--anonymize-map[apply conversion in anonymized output]:from\:to' \ '--reference-excluded-parents[reference parents not in fast-export stream by object id]' \ '--show-original-ids[show original object ids of blobs/commits]' \ '--mark-tags[label tags with mark ids]' \ @@ -3580,8 +3772,8 @@ _git-fast-import () { now\:"use current time and timezone"' \ '--done[terminate with error if there is no "done" command at the end of the stream]' \ '--force[force updating modified existing branches]' \ - '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes' \ - '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes' \ + '--max-pack-size=-[maximum size of each packfile]: : __git_guard_bytes -d unlimited size' \ + '--big-file-threshold=-[maximum size of blob to create deltas for]: : __git_guard_bytes -d 512m size' \ '--depth=-[maximum delta depth for blob and tree deltification]: :__git_guard_number "maximum delta depth"' \ '--active-branches=-[maximum number of branches to maintain active at once]: :__git_guard_number "maximum number of branches"' \ '--export-marks=-[dump internal marks table when complete]: :_files' \ @@ -3691,10 +3883,9 @@ _git-reflog () { case $line[1] in (expire) - # TODO: -n, --dry-run is undocumented. _arguments -S \ - '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \ - '--stale-fix[TODO\: provide a decent description for this option]' \ + '(-n --dry-run)'{-n,--dry-run}"[don't actually prune any entries; show what would be pruned]" \ + '--stale-fix[prune any reflog entries that point to "broken commits"]' \ '--expire=-[prune entries older than given time]: :__git_datetimes' \ '--expire-unreachable=-[prune entries older than given time and unreachable]: :__git_datetimes' \ '--all[prune all refs]' \ @@ -3703,9 +3894,8 @@ _git-reflog () { '--verbose[output additional information]' && ret=0 ;; (delete) - # TODO: -n, --dry-run is undocumented. _arguments -C -S \ - '(-n --dry-run)'{-n,--dry-run}'[undocumented]' \ + '(-n --dry-run)'{-n,--dry-run}"[dpn't update entries; show what would be done]" \ '--updateref[update ref with SHA-1 of top reflog entry after expiring or deleting]' \ '--rewrite[adjust reflog entries to ensure old SHA-1 points to new SHA-1 of previous entry after expiring or deleting]' \ '--verbose[output additional information]' \ @@ -3840,7 +4030,6 @@ _git-remote () { (( $+functions[_git-repack] )) || _git-repack () { - # TODO: --quiet is undocumented. _arguments -s \ '(-A --unpack-unreachable)-a[pack all objects into a single pack]' \ '(-a -k --keep-unreachable)-A[pack all objects into a single pack, but unreachable objects become loose]' \ @@ -3861,7 +4050,9 @@ _git-repack () { '--threads=[limit maximum number of threads]:threads' \ '--max-pack-size=-[maximum size of each output packfile]: : __git_guard_bytes "maximum pack size"' \ '--pack-kept-objects[repack objects in packs marked with .keep]' \ - '--keep-pack=[ignore named pack]:pack' + '--keep-pack=[ignore named pack]:pack' \ + '(-g --geometric)'{-g+,--geometric=}'[find a geometric progression with specified factor]:factor' \ + '(-m --write-midx)'{-m,--write-midx}'[write a multi-pack index of the resulting packs]' } (( $+functions[_git-replace] )) || @@ -3923,7 +4114,6 @@ _git-blame () { '--ignore-revs-file=[ignore revisions from file]:file:_files' \ '(--color-by-age)--color-lines[color redundant metadata from previous line differently]' \ '(--color-lines)--color-by-age[color lines by age]' \ - '--indent-heuristic[use indent-based heuristic to improve diffs]' \ $revision_options \ ':: :__git_revisions' \ ': :__git_cached_files' && ret=0 @@ -3946,12 +4136,18 @@ _git-blame () { return ret } +(( $+functions[_git-bugreport] )) || +_git-bugreport() { + _arguments \ + '(-o --output-directory)'{-o+,--output-directory=}'[specify a destination for the bugreport file]:directory:_directories' \ + '(-s --suffix)'{-s+,--suffix=}'[specify a strftime format suffix for the filename]:format:_date_formats' +} + (( $+functions[_git-cherry] )) || _git-cherry () { - # TODO: --abbrev is undocumented. _arguments -S $endopt \ '(-v --verbose)'{-v,--verbose}'[output additional information]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ ':upstream commit:__git_commits' \ '::head commit:__git_commits' \ '::limit commit:__git_commits' @@ -4015,7 +4211,7 @@ _git-help () { '(-a --all -g --guides -c --config -i --info -m --man)'{-w,--web}'[display manual for the command in HTML format]' \ '(-g --guides -c --config -i --info -m --man -w --web)'{-g,--guides}'[prints a list of useful guides on the standard output]' \ '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \ - ': : _alternative commands:command:_git_commands "guides:git guides:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"' + ': : _alternative commands:command:_git_commands "guides:git guide:(attributes cli core-tutorial cvs-migration diffcore everyday glossary hooks ignore modules namespaces repository-layout revisions tutorial tutorial-2 workflows)"' } (( $+functions[_git-instaweb] )) || @@ -4063,7 +4259,6 @@ _git-rerere () { local curcontext=$curcontext state line ret=1 declare -A opt_args - # TODO: --rerere-autoupdate is undocumented. _arguments -C -S -s $endopt \ '--rerere-autoupdate[register clean resolutions in index]' \ ': :->command' && ret=0 @@ -4352,7 +4547,8 @@ _git-send-email () { '--8bit-encoding=[encoding to use for non-ASCII messages]: :__git_encodings' \ '--compose-encoding=[encoding to use for compose messages]: :__git_encodings' \ '--transfer-encoding=[specify transfer encoding to use]:transfer encoding:(quoted-printable 8bit base64)' \ - '--envelope-sender[specify the envelope sender used to send the emails]: :_email_addresses' \ + '--envelope-sender=[specify the envelope sender used to send the emails]: :_email_addresses' \ + '--sendmail-cmd=[specify command to run to send email]:command:_cmdstring' \ '--smtp-encryption=[specify encryption method to use]: :__git_sendemail_smtpencryption_values' \ '--smtp-domain=[specify FQDN used in HELO/EHLO]: :_domains' \ '--smtp-pass=[specify password to use for SMTP-AUTH]::password' \ @@ -4441,7 +4637,6 @@ _git-svn () { case $line[1] in (clone|dcommit|fetch|init|migrate|rebase|set-tree) - # TODO: --ignore-refs is undocumented. # TODO: --no-auth-cache is undocumented. # TODO: --config-dir is undocumented. opts+=( @@ -4644,8 +4839,9 @@ _git-svn () { ;; (rebase) opts+=( - '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]" - '(--preserve-merges -p)'{--preserve-merges,-p}'[try to recreate merges instead of ignoring them]' + '(-l --local)'{-l,--local}"[don't fetch remotely, rebase against the last fetched commit from SVN]" + '!--preserve-merges' + '(--rebase-merges -p)'{--rebase-merges,-p}'[try to recreate merges instead of ignoring them]' ) ;; (reset) @@ -4744,13 +4940,15 @@ _git-commit-graph() { if [[ $words[2] = write ]]; then args=( $progress '(--split --size-multiple --max-commits --expire-time)--append[include all commits present in existing commit-graph file]' - '(--append)--split[write the commit-graph as a chain of multiple commit-graph files]' + '--changed-paths[enable computation for changed paths]' + '(--append)--split=-[write the commit-graph as a chain of multiple commit-graph files]::strategy:(no-merge replace)' '(--stdin-packs --stdin-commits)--reachable[walk commits starting at all refs]' '(--reachable --stdin-commits)--stdin-packs[only walk objects in pack-indexes read from input]' '(--reachable --stdin-packs)--stdin-commits[walk commits starting at commits read from input]' '(--append)--size-multiple=:commits [2]' '(--append)--max-commits=:commits' '(--append)--expire-time=:date/time:__git_datetimes' + '--max-new-filters=[specify maximum number of changed-path bloom filters to compute]:' ) elif [[ $words[2] = verify ]]; then args=( $progress @@ -4760,7 +4958,7 @@ _git-commit-graph() { _arguments -S $endopt $args \ '--object-dir=[specify location of packfiles and commit-graph file]:directory:_directories' \ - '(-h)1:verb:(read verify write)' + '(-h)1:verb:(verify write)' } (( $+functions[_git-commit-tree] )) || @@ -4806,6 +5004,8 @@ _git-index-pack () { _arguments \ '-v[display progress on stderr]' \ '-o[write generated pack index into specified file]: :_files' \ + '(--no-rev-index)--rev-index[generate a reverse index corresponding to the given pack]' \ + "(--rev-index)--no-rev-index[don't generate a reverse index corresponding to the given pack]" \ '--stdin[read pack from stdin and instead write to specified file]' \ $stdin_opts \ '--strict[die if the pack contains broken objects or links]' \ @@ -4826,8 +5026,6 @@ _git-merge-file () { label_opt="*-L[label to use for the $ordinals[n_labels+1] file]:label" fi - # TODO: --marker-size in undocumented. - # TODO: --diff3 is undocumented. _arguments \ $label_opt \ '(-p --stdout)'{-p,--stdout}'[send merged file to standard output instead of overwriting first file]' \ @@ -4861,7 +5059,7 @@ _git-merge-index () { (( $+functions[_git-mktag] )) || _git-mktag () { - _message 'no arguments allowed; only accepts tags on standard input' + _arguments --no-strict } (( $+functions[_git-mktree] )) || @@ -4876,6 +5074,9 @@ _git-mktree () { _git-multi-pack-index() { _arguments \ '--object-dir=[specify location of git objects]:directory:_directories' \ + '(--progress)--no-progress[turn progress off]' '!(--no-progress)--progress' \ + '--stdin-packs[write a multi-pack index containing only pack index basenames provided on stdin]' \ + '--refs-snapshot=[specify a file which contains a "refs snapshot" taken prior to repacking]:file:_files' \ '--batch-size=[during repack, select packs so as to have pack files of at least the specified size]:size' \ '1:verb:(write verify expire repack)' } @@ -4905,16 +5106,17 @@ _git-pack-objects () { '--delta-base-offset[use delta-base-offset packing]' \ '--threads=-[specify number of threads for searching for best delta matches]: :__git_guard_number "number of threads"' \ '--non-empty[only create a package if it contains at least one object]' \ - '--revs[read revision arguments from standard input]' \ + '(--stdin-packs)--revs[read revision arguments from standard input]' \ '(--revs)--unpacked[limit objects to pack to those not already packed]' \ - '(--revs)--all[include all refs as well as revisions already specified]' \ + '(--revs --stdin-packs)--all[include all refs as well as revisions already specified]' \ '--reflog[include objects referred by reflog entries]' \ '--indexed-objects[include objects referred to by the index]' \ + '(--revs --all --keep-unreachable --pack-loose-unreachable --unpack-unreachable)--stdin-packs[read packs from stdin]' \ '(: --max-pack-size)--stdout[output pack to stdout]' \ '--include-tag[include unasked-for annotated tags if object they reference is included]' \ - '(--unpack-unreachable)--keep-unreachable[keep unreachable ]' \ - '--pack-loose-unreachable[pack loose unreachable objects]' \ - '(--keep-unreachable)--unpack-unreachable=-[unpack unreachable objects newer than specified time]::time' \ + '(--revs --stdin-packs --unpack-unreachable)--keep-unreachable[add objects unreachable from refs in packs named with --unpacked to resulting pack]' \ + '(--revs --stdin-packs)--pack-loose-unreachable[pack unreachable loose objects]' \ + '(--revs --stdin-packs --keep-unreachable)--unpack-unreachable=-[keep unreachable objects in loose form]::time' \ '--sparse[use sparse reachability algorithm]' \ '--include-tag[include tag objects that refer to objects to be packed]' \ $thin_opt \ @@ -4929,6 +5131,7 @@ _git-pack-objects () { '--missing=[specify how missing objects are handled]:action:(error allow-any allow-promisor print)' \ "--exclude-promisor-objects[don't pack objects in promisor packfiles]" \ '--delta-islands[respect islands during delta compression]' \ + '--uri-protocol=[exclude any configured uploadpack.blobpackfileuri with given protocol]:protocol' \ ':base-name:_files' } @@ -5029,6 +5232,7 @@ _git-update-index () { '(-q --unmerged --ignore-missing --refresh)--really-refresh[refresh index, unconditionally checking stat information]' \ '( --no-skip-worktree)--skip-worktree[set "skip-worktree" bit for given paths]' \ '(--skip-worktree )--no-skip-worktree[unset "skip-worktree" bit for given paths]' \ + "--ignore-skip-worktree-entries[don't touch index-only entries]" \ '(-)'{-g,--again}'[run git-update-index on differing index entries]' \ '(-)--unresolve[restore "unmerged" or "needs updating" state of files]' \ '--info-only[only insert files object-IDs into index]' \ @@ -5209,6 +5413,14 @@ _git-for-each-ref () { ':: :_guard "([^-]?#|)" pattern' } +(( $+functions[_git-for-each-repo] )) || +_git-for-each-repo() { + _arguments -S \ + '(-C --config)'{-C,--config=}'[specify config variable for list of paths]:config variable' \ + ':git command:_git_commands' \ + '*:: := _git' +} + (( $+functions[_git-ls-files] )) || _git-ls-files () { local no_empty_directory_opt= @@ -5217,7 +5429,6 @@ _git-ls-files () { no_empty_directory_opt="--no-empty-directory[don't list empty directories]" fi - # TODO: --resolve-undo is undocumented. # TODO: Replace _files with something more intelligent based on seen options. # TODO: Apply excludes like we do for git-clean. _arguments -S -s $endopt \ @@ -5231,8 +5442,9 @@ _git-ls-files () { '--eol[show line endings of files]' \ $no_empty_directory_opt \ '(-s --stage -u --unmerged --with-tree)'{-u,--unmerged}'[show unmerged files in output]' \ + '--resolve-undo[show resolve-undo information]' \ '(-k --killed)'{-k,--killed}'[show killed files in output]' \ - '-z[use NUL termination on output]' \ + '-z[separate paths with the NUL character]' \ '*'{-x,--exclude=-}'[skip files matching given pattern]:file pattern' \ '*'{-X,--exclude-from=-}'[skip files matching patterns in given file]: :_files' \ '*--exclude-per-directory=-[skip directories matching patterns in given file]: :_files' \ @@ -5243,8 +5455,9 @@ _git-ls-files () { '(-v)-f[indicate status of each file using lowercase for fsmonitor clean files]' \ '--full-name[force paths to be output relative to the project top directory]' \ '--recurse-submodules[recurse through submodules]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ '--debug[show debugging data]' \ + '--deduplicate[suppress duplicate entries]' \ '*:: :_files' } @@ -5275,10 +5488,10 @@ _git-ls-tree () { '(-t)-d[do not show children of given tree (implies -t)]' \ '-r[recurse into subdirectories]' \ '-t[show tree entries even when going to recurse them]' \ - '(-l --long)'{-l,--long}'[show object size of blob entries]' \ + '(-l --long --name-only --name-status)'{-l,--long}'[show object size of blob entries]' \ '-z[use NUL termination on output]' \ - '(--name-only --name-status)'{--name-only,--name-status}'[list only filenames, one per line]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '(--name-only --name-status --abbrev)'{--name-only,--name-status}'[list only filenames, one per line]' \ + '(--name-only --name-status)--abbrev=[use specified digits to display object names]:digits' \ '--full-name[output full path-names]' \ '(--full-name)--full-tree[do not limit listing to current working-directory]' \ ': :__git_tree_ishs' \ @@ -5326,7 +5539,7 @@ _git-pack-redundant () { '(:)--all[process all packs]' \ '--alt-odb[do not require objects to be present in local packs]' \ '--verbose[output some statistics to standard error]' \ - '(--all)*::packs:_files -g "*.pack(-.)"' + '(--all)*::pack:_files -g "*.pack(-.)"' } (( $+functions[_git-rev-list] )) || @@ -5381,8 +5594,9 @@ _git_rev-list_filters() { } (( $+functions[_git-show-index] )) || -_git-show-index () { - _message 'no arguments allowed; accepts index file on standard input' +_git-show-index() { + _arguments \ + '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' } (( $+functions[_git-show-ref] )) || @@ -5395,7 +5609,7 @@ _git-show-ref () { '(-d --dereference)'{-d,--dereference}'[dereference tags into object IDs as well]' \ '(-s --hash)'{-s+,--hash=-}'[only show the SHA-1 hash, not the reference name]:: :__git_guard_number length' \ '--verify[enable stricter reference checking]' \ - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' \ + '--abbrev=[use specified digits to display object names]:digits' \ '(-q --quiet)'{-q,--quiet}'[do not print any results]' \ '*: :_guard "([^-]?#|)" pattern' \ - exclude \ @@ -5424,6 +5638,7 @@ _git-verify-pack () { _arguments -S -s $endopt \ '(-v --verbose)'{-v,--verbose}'[show objects contained in pack]' \ '(-s --stat-only)'{-s,--stat-only}'[do not verify pack contents; only display histogram of delta chain length]' \ + '--object-format=[specify the hash algorithm to use]:algortithm:(sha1 sha256)' \ '*:index file:_files -g "*.idx(-.)"' } @@ -5502,14 +5717,14 @@ _git-send-pack () { '(-q --quiet)'{-q,--quiet}'[be more quiet]' \ '(--receive-pack --exec)'{--receive-pack=-,--exec=-}'[specify path to git-receive-pack on remote side]:remote path' \ '--remote[specify remote name]:remote' \ - '--all[update all refs that exist locally]' \ + '(*)--all[update all refs that exist locally]' \ '(-n --dry-run)'{-n,--dry-run}'[do everything except actually sending the updates]' \ '--mirror[mirror all refs]' \ '(-f --force)'{-f,--force}'[update remote orphaned refs]' \ "(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \ '(--no-signed --sign)--signed[GPG sign the push]' \ "(--sign --signed)--no-signed[don't GPG sign the push]" \ - '--push-option=[specify option to transmit]:option' \ + '*--push-option=[specify option to transmit]:option' \ '--progress[force progress reporting]' \ '--thin[send a thin pack]' \ '--atomic[request atomic transaction on remote side]' \ @@ -5517,6 +5732,7 @@ _git-send-pack () { '--stdin[read refs from stdin]' \ '--helper-status[print status from remote helper]' \ '--force-with-lease=[require old value of ref to be at specified value]:refname\:expect' \ + '--force-if-includes[require remote updates to be integrated locally]' \ ': :__git_any_repositories' \ '*: :__git_remote_references' } @@ -5536,8 +5752,10 @@ _git-http-fetch () { '-v[report what is downloaded]' \ '-w[write commit-id into the filename under "$GIT_DIR/refs/<filename>"]:filename' \ '--recover[recover from a failed fetch]' \ - '(1)--stdin[read commit ids and refs from standard input]' \ - ': :__git_commits' \ + '(1 --packfile)--stdin[read commit ids and refs from standard input]' \ + '!(1 --stdin)--packfile=:hash' \ + '!--index-pack-args=:args' \ + '1: :__git_commits' \ ': :_urls' } @@ -5558,12 +5776,9 @@ _git-http-push () { (( $+functions[_git-receive-pack] )) || _git-receive-pack () { - # TODO: --advertise-refs is undocumented. - # TODO: --stateless-rpc is undocumented. _arguments -S -A '-*' $endopt \ '(-q --quiet)'{-q,--quiet}'[be quiet]' \ - '--advertise-refs[undocumented]' \ - '--stateless-rpc[undocumented]' \ + '--stateless-rpc[quit after a single request/response exchange]' \ ':directory to sync into:_directories' } @@ -5708,8 +5923,10 @@ _git-mailinfo () { '(-u --encoding)--encoding=-[encode commit information in given encoding]: :__git_encodings' \ '-n[disable all charset re-coding of metadata]' \ '(-m --message-id)'{-m,--message-id}'[copy the Message-ID header at the end of the commit message]' \ + '-n[disable charset re-coding of metadata]' \ '( --no-scissors)--scissors[remove everything in body before a scissors line]' \ '(--scissors )--no-scissors[do not remove everything in body before a scissors line]' \ + '--quoted-cr=[specify action when quoted CR is found]:action [warn]:(nowarn warn strip)' \ '--no-inbody-headers[undocumented]' \ ':message file:_files' \ ':patch file:_files' @@ -5910,6 +6127,7 @@ _git_commands () { gui:'run portable graphical interface to git' init:'create empty git repository or re-initialize an existing one' log:'show commit logs' + maintenance:'run tasks to optimize Git repository data' merge:'join two or more development histories together' mv:'move or rename file, directory, or symlink' notes:'add or inspect object notes' @@ -5923,6 +6141,7 @@ _git_commands () { rm:'remove files from the working tree and from the index' shortlog:'summarize git log output' show:'show various types of objects' + sparse-checkout:'initialize and modify the sparse-checkout' stash:'stash away changes to dirty working directory' status:'show working-tree status' submodule:'initialize, update, or inspect submodules' @@ -5946,6 +6165,7 @@ _git_commands () { ancillary_interrogator_commands=( blame:'show what revision and author last modified each line of a file' + bugreport:'collect information for user to file a bug report' count-objects:'count unpacked objects and display their disk consumption' difftool:'show changes using common diff tools' fsck:'verify connectivity and validity of objects in database' @@ -5980,7 +6200,7 @@ _git_commands () { index-pack:'build pack index file for an existing packed archive' merge-file:'run a three-way file merge' merge-index:'run merge for files needing merging' - mktag:'create tag object' + mktag:'create tag object with extra validation' mktree:'build tree-object from git ls-tree formatted text' multi-pack-index:'write and verify multi-pack-indexes' pack-objects:'create packed archive of objects' @@ -5999,6 +6219,7 @@ _git_commands () { diff-index:'compare content and mode of blobs between index and repository' diff-tree:'compare content and mode of blobs found via two tree objects' for-each-ref:'output information on each ref' + for-each-repo:'run a git command on a list of repositories' get-tar-commit-id:'extract commit ID from an archive created using git archive' ls-files:'information about files in index/working directory' ls-remote:'show references in a remote repository' @@ -6046,8 +6267,8 @@ _git_commands () { zstyle -a :completion:$curcontext: user-commands user_commands local command - for command in $_git_third_party_commands; do - (( $+commands[git-${command%%:*}] )) && third_party_commands+=$command + for command in ${(k)_git_third_party_commands}; do + (( $+commands[git-${command}] )) && third_party_commands+=$command$_git_third_party_commands[$command] done local -a aliases @@ -6207,6 +6428,16 @@ __git_merge_strategies () { "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}:-octopus ours recursive resolve subtree} } +(( $+functions[_git_strategy_options] )) || +_git_strategy_options() { + _values "strategy option" ours theirs ignore-space-change \ + ignore-all-space ignore-space-at-eol ignore-cr-at-eol \ + renormalize no-renormalize \ + 'find-renames::similarity threshold' \ + subtree:path \ + 'diff-algorithm:algorithm:(patience minimal histogram myers)' +} + (( $+functions[__git_encodings] )) || __git_encodings () { # TODO: Use better algorithm, as shown in iconv completer (separate it to a @@ -6359,6 +6590,31 @@ __git_daemon_service () { _describe -t services service services $* } +(( $+functions[_git_log_line_ranges] )) || +_git_log_line_ranges() { + local sep pos=start op=( / : ) + if compset -P '*[^,^]:'; then + __git_tree_files ${PREFIX:-.} HEAD + else + compset -P 1 '*,' && pos=end + if compset -P '(^|):'; then + _message -e functions function + elif compset -P '(^|)/'; then + _message -e patterns regex + else + zstyle -s ":completion:${curcontext}:forms" list-separator sep || sep=-- + sep=' -- ' + sep="${(q)sep}" + _guard "[0-9]#" "$pos line number" && return + compset -P \^ || op+=( \^ ) + _wanted forms expl form compadd -S '' -d "( + /\ $sep\ regex + :\ $sep\ function + ^\ $sep\ search\ from\ start\ of\ file )" $op + fi + fi +} + (( $+functions[__git_log_decorate_formats] )) || __git_log_decorate_formats () { declare -a log_decorate_formats @@ -6716,14 +6972,12 @@ __git_heads_local () { local f gitdir declare -a heads - heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"}) + heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads refs/bisect refs/stash 2>/dev/null)"}) gitdir=$(_call_program gitdir git rev-parse --git-dir 2>/dev/null) if __git_command_successful $pipestatus; then for f in HEAD FETCH_HEAD ORIG_HEAD MERGE_HEAD; do [[ -f $gitdir/$f ]] && heads+=$f done - [[ -f $gitdir/refs/stash ]] && heads+=stash - [[ -f $gitdir/refs/bisect/bad ]] && heads+=bisect/bad fi __git_describe_commit heads heads-local "local head" "$@" @@ -6847,6 +7101,16 @@ __git_recent_commits () { return ret } +(( $+functions[_git_fixup] )) || +_git_fixup() { + local alts + alts=( 'commits: :__git_recent_commits' ) + if ! compset -P '(amend|reword):'; then + alts+=( 'actions:action:compadd -S: amend reword' ) + fi + _alternative $alts +} + (( $+functions[__git_blob_objects] )) || __git_blob_objects () { _guard '[[:xdigit:]](#c,40)' 'blob object name' @@ -7084,27 +7348,34 @@ __git_files_relative () { (( $+functions[__git_files] )) || __git_files () { - local compadd_opts opts tag description gitcdup gitprefix files expl + local compadd_opts opts tag description gittoplevel gitprefix files expl zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: zparseopts -D -E -a opts -- -cached -deleted -modified -others -ignored -unmerged -killed x+: --exclude+: tag=$1 description=$2; shift 2 - gitcdup=$(_call_program gitcdup git rev-parse --show-cdup 2>/dev/null) + gittoplevel=$(_call_program toplevel git rev-parse --show-toplevel 2>/dev/null) __git_command_successful $pipestatus || return 1 + [[ -n $gittoplevel ]] && gittoplevel+="/" gitprefix=$(_call_program gitprefix git rev-parse --show-prefix 2>/dev/null) __git_command_successful $pipestatus || return 1 # TODO: --directory should probably be added to $opts when --others is given. - local pref=$gitcdup$gitprefix$PREFIX + local pref=${(Q)${~PREFIX}} + [[ $pref[1] == '/' ]] || pref=$gittoplevel$gitprefix$pref - # First allow ls-files to pattern-match in case of remote repository - files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"}) + # First allow ls-files to pattern-match in case of remote repository. Use the + # icase pathspec magic word to ensure that we support case-insensitive path + # completion for users with the appropriate matcher configuration + files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+:\(icase\)$pref\*}:-.} 2>/dev/null)"}) __git_command_successful $pipestatus || return - # If ls-files succeeded but returned nothing, try again with no pattern + # If ls-files succeeded but returned nothing, try again with no pattern. Note + # that ls-files defaults to the CWD if not given a path, so if the file we + # were trying to add is in an *adjacent* directory, this won't return anything + # helpful either if [[ -z "$files" && -n "$pref" ]]; then files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- 2>/dev/null)"}) __git_command_successful $pipestatus || return @@ -7206,7 +7477,6 @@ __git_changed_files () { # which case it is relative to the repository root. (( $+functions[__git_tree_files] )) || __git_tree_files () { - local multi_parts_opts local tree Path integer at_least_one_tree_added local -a tree_files compadd_opts @@ -7219,11 +7489,12 @@ __git_tree_files () { zparseopts -D -E -a compadd_opts V+: J+: 1 2 o+: n f x+: X+: M+: P: S: r: R: q F: - [[ "$1" == */ ]] && Path="$1" || Path="${1:h}/" + Path=${(M)1##(../)#} + [[ ${1##(../)#} = */* ]] && extra_args+=( -r ) shift (( at_least_one_tree_added = 0 )) - for tree in $*; do - tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree -r ${(q)extra_args} --name-only -z ${(q)tree} 2>/dev/null)"}) + for tree; do + tree_files+=(${(ps:\0:)"$(_call_program tree-files git ls-tree $extra_args --name-only -z ${(q)tree} $Path 2>/dev/null)"}) __git_command_successful $pipestatus && (( at_least_one_tree_added = 1 )) done @@ -7257,7 +7528,7 @@ __git_repositories () { __git_local_repositories () { local expl - _wanted local-repositories expl 'local repositories' _directories + _wanted local-repositories expl 'local repository' _directories } (( $+functions[__git_repositories_or_urls] )) || @@ -7342,7 +7613,7 @@ __git_guard_number () { (( $+functions[__git_guard_bytes] )) || __git_guard_bytes () { - _guard '[[:digit:]]#([kKmMgG]|)' ${*:-size} + _numbers -u bytes ${*:-size} k m g } (( $+functions[__git_datetimes] )) || @@ -7375,8 +7646,31 @@ __git_setup_log_options () { '( --no-follow)--follow[follow renames]' '(--follow )--no-follow[do not follow renames]' '--source[show which ref each commit is reached from]' - '-L+[trace the evolution of a line range or regex within a file]:range' + '*-L+[trace evolution of line range, function or regex within a file]: :_git_log_line_ranges' + ) +} + +(( $+functions[__git_ws_error_highlight] )) || +__git_ws_error_highlight() { + _values -s , "kind of line" all default none context old new +} + +(( $+functions[__git_color_moved] )) || +__git_color_moved() { + local -a __git_color_moved=( + no:"do not highlight moved lines" + default:"like zebra" + plain:"highlight moved lines with color" + blocks:"greedily detect blocks of moved text of at least 20 characters" + zebra:"like blocks, with alternating colors between different blocks" + dimmed-zebra:"like zebra, uninteresting parts are dimmed" ) + _describe "mode" __git_color_moved +} + +(( $+functions[__git_color_movedws] )) || +__git_color_movedws() { + _sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change } (( $+functions[__git_setup_diff_options] )) || @@ -7425,13 +7719,8 @@ __git_setup_diff_options () { none\:"disable word diff"))' '--word-diff-regex=-[specify what constitutes a word]:word regex' '(--color --no-color )--color-words=-[show colored-word diff]::word regex' - '(--color --no-color )--color-moved=-[color moved lines differently]::mode:((no\:"do not highlith moved lines" - default\:"like zebra" - plain\:"highlight moved lines with color" - blocks\:"greedily detect blocks of moved text of at least 20 characters" - zebra\:"like blocks, with alternating colors between different blocks" - dimmed-zebra\:"like zebra, uninteresting parts are dimmed"))' - '(--no-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:_sequence compadd - no ignore-space-at-eol ignore-space-change ignore-all-space allow-indentation-change' + '(--color --no-color )--color-moved=-[color moved lines differently]::mode:__git_color_moved' + '(--no-color-moved-ws)--color-moved-ws=[configure how whitespace is ignored when performing move detection for --color-moved]:mode:__git_color_movedws' "(--color-moved-ws)--no-color-moved-ws=[don't ignore whitespace when performing move detection]" "--ita-invisible-in-index[hide 'git add -N' entries from the index]" "!(--ita-invisible-in-index)--ita-visible-in-index" @@ -7439,8 +7728,8 @@ __git_setup_diff_options () { $exclusive_diff_options'--check[warn if changes introduce trailing whitespace or space/tab indents]' '--full-index[show full object name of pre- and post-image blob]' '(--full-index)--binary[in addition to --full-index, output binary diffs for git-apply]' - '--ws-error-highlight=[specify where to highlight whitespace errors]: :_values -s , "kind of line" all default none context old new' - '--abbrev=[set minimum SHA1 display-length]: :__git_guard_number length' + '--ws-error-highlight=[specify where to highlight whitespace errors]: :__git_ws_error_highlight' + '--abbrev=[use specified digits to display object names]:digits' '(-B --break-rewrites)'{-B-,--break-rewrites=-}'[break complete rewrite changes into pairs of given size]:: :__git_guard_number size' '(-M --find-renames)'{-M-,--find-renames=-}'[detect renames with given scope]:: :__git_guard_number size' '(-C --find-copies)'{-C-,--find-copies=-}'[detect copies as well as renames with given scope]:: :__git_guard_number size' @@ -7452,10 +7741,12 @@ __git_setup_diff_options () { '--diff-filter=-[select certain kinds of files for diff]: :_git_diff_filters' '-S-[look for differences that add or remove the given string]:string' '-G-[look for differences whose added or removed line matches the given regex]:pattern' - '--find-object=[look for differences that change the number of occurrences of the specified object]:object:__git_blobs' '--pickaxe-all[when -S finds a change, show all changes in that changeset]' '--pickaxe-regex[treat argument of -S as regular expression]' '-O-[output patch in the order of glob-pattern lines in given file]: :_files' + '--rotate-to=[show the change in specified path first]:path:_directories' + '--skip-to=[skip the output to the specified path]:path:_directories' + '--find-object=[look for differences that change the number of occurrences of specified object]:object:__git_blobs' '-R[do a reverse diff]' '--relative=-[exclude changes outside and output relative to given directory]:: :_directories' '(-a --text)'{-a,--text}'[treat all files as text]' @@ -7463,9 +7754,10 @@ __git_setup_diff_options () { '--ignore-cr-at-eol[ignore carriage-return at end of line]' '(-b --ignore-space-change -w --ignore-all-space)'{-b,--ignore-space-change}'[ignore changes in amount of white space]' '(-b --ignore-space-change -w --ignore-all-space)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' - '--ignore-blank-lines[do not show hunks that add or remove blank lines]' + '--ignore-blank-lines[ignore changes whose lines are all blank]' + \*{-I+,--ignore-matching-lines=}'[ignore changes whose lines all match regex]:regex' '--no-indent-heuristic[disable heuristic that shifts diff hunk boundaries to make patches easier to read]' - '--inter-hunk-context=[combine hunks closer than n lines]:n' + '--inter-hunk-context=[combine hunks closer than N lines]:number of lines' '--output-indicator-new=[specify the character to indicate a new line]:character [+]' '--output-indicator-old=[specify the character to indicate a old line]:character [-]' '--output-indicator-context=[specify the character to indicate a context line]:character [ ]' @@ -7479,11 +7771,8 @@ __git_setup_diff_options () { '(--no-prefix)--dst-prefix=[use given prefix for destination]:prefix' '--line-prefix=[prepend additional prefix to every line of output]:prefix' '(--src-prefix --dst-prefix)--no-prefix[do not show any source or destination prefix]' - '(-c --cc)'{-c,--cc}'[combined diff format for merge commits]' - - # TODO: --output is undocumented. - '--output[undocumented]:undocumented') + '--output=[output to a specific file]: :_files') } (( $+functions[__git_setup_diff_stage_options] )) || @@ -7500,13 +7789,15 @@ __git_setup_diff_stage_options () { __git_format_placeholders() { local sep local -a disp names placeholders expl - _describe -t formats format '( oneline:"commit-ids and subject of messages" - short:"few headers and only subject of messages" - medium:"most parts of messages" - full:"all parts of commit messages" - fuller:"like full and includes dates" - email:"use email headers like From and Subject" - raw:"the raw commits" )' -- '( format:"specify own format" )' -S ':' && return + _describe -t formats format '( oneline:"<hash> <title>" + short:"commit hash plus author and title headers" + medium:"like short plus author date header and full message" + full:"like medium with committer header instead of date" + fuller:"like full plus author and commit date headers" + reference:"<abbrev hash> (<title>, <short author date>)" + email:"email patch format" + mboxrd:"like email with From lines in message quoted with >" + raw:"entire commit object" )' -- '( format:"specify own format" )' -S ':' && return compset -P 'format:' compset -P '(%[^acgCG]|%?[^%]|[^%])#' if compset -P '%C'; then @@ -7672,7 +7963,7 @@ __git_setup_revision_options () { '(--left-only --right-only --cherry-pick --cherry-mark --no-merges --merges --max-parents)--cherry[synonym for --right-only --cherry-mark --no-merges]' '(-c --cc )--full-diff[show full commit diffs when using log -p, not only those affecting the given path]' '--log-size[print log message size in bytes before the message]' - '--use-mailmap[use mailmap file to map author and committer names and email]' + --{use-,}mailmap'[use mailmap file to map author and committer names and email]' '--reflog[show all commits from reflogs]' '--single-worktree[examine the current working tree only]' @@ -7702,13 +7993,14 @@ __git_setup_merge_options () { '(-n --no-stat)--stat[show a diffstat at the end of the merge]' '(--stat -n --no-stat)'{-n,--no-stat}'[do not show diffstat at the end of the merge]' '( --no-squash)--squash[merge, but do not commit]' - '--signoff[add Signed-off-by:]' + '--autostash[automatically stash/stash pop before and after]' + '--signoff[add Signed-off-by: trailer]' '(--squash )--no-squash[merge and commit]' '--ff-only[refuse to merge unless HEAD is up to date or merge can be resolved as a fast-forward]' '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' "(-S --gpg-sign --no-gpg-sign)--no-gpg-sign[don't GPG-sign the commit]" - '*'{-s,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' - '*'{-X,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]:option' + '*'{-s+,--strategy=}'[use given merge strategy]:merge strategy:__git_merge_strategies' + '*'{-X+,--strategy-option=}'[pass merge-strategy-specific option to merge strategy]: :_git_strategy_options' '(--verify-signatures)--verify-signatures[verify the commits being merged or abort]' '(--no-verify-signatures)--no-verify-signatures[do not verify the commits being merged]' '(-q --quiet -v --verbose)'{-q,--quiet}'[suppress all output]' @@ -7748,6 +8040,11 @@ __git_setup_fetch_options () { '(-q --quiet)--progress[force progress reporting]' '--show-forced-updates[check for forced-updates on all updated branches]' '--set-upstream[set upstream for git pull/fetch]' + '--shallow-since=[deepen history of shallow repository based on time]:time' \ + '*--shallow-exclude=[deepen history of shallow clone by excluding revision]:revision' \ + '--deepen[deepen history of shallow clone]:number of commits' \ + \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' + '--negotiation-tip=[only report refs reachable from specified object to the server]:commit:__git_commits' \ ) } @@ -7938,6 +8235,8 @@ __git_diff-or-merge-tools () { diffuse ecmerge emerge + examdiff + guiffy gvimdiff gvimdiff2 gvimdiff3 @@ -7951,6 +8250,7 @@ __git_diff-or-merge-tools () { vimdiff vimdiff2 vimdiff3 + winmerge xxdiff) builtindifftools=($builtintools kompare) @@ -8083,7 +8383,7 @@ _git() { local -A git_aliases local a k v local endopt='!(-)--end-of-options' - aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\.')"}) + aliases=(${(0)"$(_call_program aliases git config -z --get-regexp '\^alias\\.')"}) for a in ${aliases}; do k="${${a/$'\n'*}/alias.}" v="${a#*$'\n'}" @@ -8118,16 +8418,17 @@ _git() { '(- :)--version[display version information]' \ '(- :)--help[display help message]' \ '-C[run as if git was started in given path]: :_directories' \ - '*-c[pass configuration parameter to command]: :->configuration' \ + \*{-c,--config-env=}'[pass configuration parameter to command]: :->configuration' \ '--exec-path=-[path containing core git-programs]:: :_directories' \ '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \ '(: -)--info-path[print the path where the info files are installed and exit]' \ '(: -)--html-path[display path to HTML documentation and exit]' \ '(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe output into a pager]' \ '(-p --paginate -P --no-pager)'{-P,--no-pager}"[don't pipe git output into a pager]" \ - '--git-dir=-[path to repository]: :_directories' \ - '--work-tree=-[path to working tree]: :_directories' \ - '--namespace=-[set the Git namespace]:namespace' \ + '--git-dir=[path to repository]: :_directories' \ + '--work-tree=[path to working tree]: :_directories' \ + '--namespace=[set the Git namespace]:namespace' \ + '--super-prefix=[set a prefix which gives a path from above a repository down to its root]:path:_directories' \ '--bare[use $PWD as repository]' \ '--no-replace-objects[do not use replacement refs to replace git objects]' \ '--literal-pathspecs[treat pathspecs literally, rather than as glob patterns]' \ @@ -8140,7 +8441,8 @@ _git() { ;; (option-or-argument) curcontext=${curcontext%:*:*}:git-$words[1]: - (( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir] + (( $+opt_args[--git-dir] )) && local -x GIT_DIR=${(Q)${~opt_args[--git-dir]}} + (( $+opt_args[--work-tree] )) && local -x GIT_WORK_TREE=${(Q)${~opt_args[--work-tree]}} if ! _call_function ret _git-$words[1]; then if [[ $words[1] = \!* ]]; then words[1]=${words[1]##\!} @@ -8173,7 +8475,7 @@ _git() { } # Load any _git-* definitions so that they may be completed as commands. -declare -gUa _git_third_party_commands +declare -gA _git_third_party_commands _git_third_party_commands=() local file input @@ -8195,7 +8497,7 @@ for file in ${^fpath}/_git-*~(*~|*.zwc)(-.N); do (( i++ )) done < $file - _git_third_party_commands+=$name$desc + _git_third_party_commands+=([$name]=$desc) done _git diff --git a/Completion/Unix/Command/_gnupod b/Completion/Unix/Command/_gnupod index f53ae6c59..22ccabb9d 100644 --- a/Completion/Unix/Command/_gnupod +++ b/Completion/Unix/Command/_gnupod @@ -30,8 +30,8 @@ case "$service" in '(-b --set-bookmarkable)'{-b,--set-bookmarkable}'[set this song as bookmarkable (= Remember position)]' --set-shuffleskip'[exclude this file in shuffle-mode]' --set-compilation'[mark songs as being part of a compilation]' - --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]' - --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag (range -100 to 100, default 0)]' + --min-vol-adj='[minimum volume adjustment allowed by ID3v2.4 RVA2 tag]:adjustment (-100..100) [0]' + --max-vol-adj='[maximum volume adjustment allowed by ID3v2.4 RVA2 tag]:adjustment (-100..100) [0]' --artwork='[use FILE as album cover]:artwork:_files' '*:file to add:_files' ) diff --git a/Completion/Unix/Command/_gnutls b/Completion/Unix/Command/_gnutls index 6c9956b10..b9f91264d 100644 --- a/Completion/Unix/Command/_gnutls +++ b/Completion/Unix/Command/_gnutls @@ -37,6 +37,8 @@ case "$service" in '--x509crlfile=[specify CRL file to use]:file:_files' '*--x509keyfile=[specify X.509 key file to use]:file:_files' '*--x509certfile=[specify X.509 certificate file to use]:file:_files' + '*--rawpkkeyfile=[specify private key file or URL to use]:file:_files' + '*--rawpkfile=[specify raw public-key file to use]:file:_files' '(-l --list -p --port)'{-l,--list}'[print list of the supported algorithms/modes]' '--keymatexport=[specify label used for exporting keying material]:label' '--keymatexportsize=[specify size of the exported keying material]:size' @@ -70,7 +72,8 @@ case "$service" in '--fastopen[enable TCP Fast Open]' "--print-cert[print peer's certificate in PEM format]" "--save-cert=[save peer's certificate chain in the specified file in PEM format]:file:_files" - "--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files" + "(--save-ocsp-multi)--save-ocsp=[save peer's OCSP status response in the provided file]:file:_files" + "(--save-ocsp)--save-ocsp-multi=[save all peer's OCSP responses in the provided file]:file:_files" '--save-server-trace=[save the server-side TLS message trace in the provided file]:file:_files' '--save-client-trace=[save the client-side TLS message trace in the provided file]:file:_files' '--dh-bits=[specify minimum number of bits allowed for DH]:bits' @@ -93,6 +96,8 @@ case "$service" in '--inline-commands-prefix=[change delimiter used for inline commands]:delimiter [^]' '--fips140-mode[report status of FIPS140-2 mode in gnutls library]' '--logfile=[redirect informational messages to a specific file]:file:_files' + '--waitresumption[block waiting for the resumption data under TLS1.3]' + '--ca-auto-retrieve[enable automatic retrieval of missing CA certificates]' ) ;; @@ -109,6 +114,7 @@ case "$service" in "--nodb[don't use a resumption database]" '--http[act as an HTTP server]' '--echo[act as an Echo server]' + "--crlf[don't replace CRLF by LF in Echo server mode]" '(-a --disable-client-cert -r --require-client-cert)'{-a,--disable-client-cert}"[don't request a client certificate]" '(-a --disable-client-cert -r --require-client-cert)'{-r,--require-client-cert}'[require a client certificate]' '--verify-client-cert[if a client certificate is sent then verify it]' @@ -144,7 +150,8 @@ case "$service" in '--verify-crl[verify a CRL]' '(--verify-email)--verify-hostname=[specify hostname to be used for certificate chain verification]:hostname:_hosts' '(--verify-hostname)--verify-email=[specify email to be used for certificate chain verification]:email:_email_addresses' - '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]' + '--verify-purpose=[specify a purpose OID to be used for certificate chain verification]:purpose' + '--verify-profile=[specify a security level profile to be used for verification]:profile' '--p7-sign[sign using a PKCS #7 structure]' '--p7-detached-sign[sign using a detached PKCS #7 structure]' "--no-p7-include-cert[don't include signer's certificate will in the cert list]" diff --git a/Completion/Unix/Command/_go b/Completion/Unix/Command/_go index 30a2bf88f..0b4b16dfa 100644 --- a/Completion/Unix/Command/_go +++ b/Completion/Unix/Command/_go @@ -15,4 +15,4 @@ case $service in ;; esac -_wanted files expl "input file" _files -g "$pat" +_wanted files expl "input file" _files -g "$pat(-.)" diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg index b35693d1f..5d54865d5 100644 --- a/Completion/Unix/Command/_gpg +++ b/Completion/Unix/Command/_gpg @@ -173,7 +173,7 @@ fi '--dump-options[show all options]' ) -extra=( ${${${args#\([^\)]#\)}#\*}%%[:=\[]*} ) +extra=( ${${${args#\([^\)]#\)}#\*}%%[=:\[]*} ) extra=( ${allopts:|extra} ) _arguments -C -s -S -A "-*" $args $extra '*:args:->args' && ret=0 diff --git a/Completion/Unix/Command/_gprof b/Completion/Unix/Command/_gprof index 3bb7a5765..a7e602fd5 100644 --- a/Completion/Unix/Command/_gprof +++ b/Completion/Unix/Command/_gprof @@ -3,8 +3,8 @@ local curcontext="$curcontext" state line ret=1 typeset -A opt_args -_arguments -C -s -{a,b,c,D,h,i,l,L,s,T,v,w,x,y,z} \ - -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,Z}:'function name:->funcs' \ +_arguments -C -s -{a,b,c,D,h,i,l,L,r,s,T,v,w,x,y,z} \ + -{A,C,e,E,f,F,J,n,N,O,p,P,q,Q,R,S,t,Z}:'function name:->funcs' \ '-I:directory:_dir_list' \ '-d-:debug level:' '-k:function names:->pair' \ '-m:minimum execution count:' \ diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle index 9a75daefb..a1d9381cb 100644 --- a/Completion/Unix/Command/_gradle +++ b/Completion/Unix/Command/_gradle @@ -1,9 +1,9 @@ #compdef gradle gradlew local curcontext="$curcontext" ret=1 state state_descr line -local gradle_inspect=yes cache_policy tag_order +local gradle_inspect=yes cache_policy tag_order filter= local -A opt_args -local -a gradle_group_tasks gradle_all_tasks +local -aU gradle_group_tasks gradle_all_tasks tasks # Set the caching policy to invalidate cache if the build file is newer than the cache. _gradle_caching_policy() { @@ -78,35 +78,57 @@ if [[ $words[CURRENT] != -* ]]; then local -a match mbegin mend # Run gradle/gradlew and retrieve possible tasks. for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do - if [[ $outputline == [[:blank:]]#(#b)([[:alnum:]]##)' - '(*) ]]; then + # Subproject tasks are prefixed with one or more instances of [[:alnum:]]##\: + # Leaving out the prefix runs the task in all subprojects where it exists. + if [[ $outputline == + [[:blank:]]#(#b)([[:alnum:]]##\:)#([[:alnum:]]##)' - '(*) ]]; then # The descriptions of main tasks start at beginning of line, descriptions of # secondary tasks are indented. if [[ $outputline == [[:alnum:]]* ]]; then - gradle_group_tasks+=( "$match[1]:$match[2]" ) + gradle_group_tasks+=( + "$match[-2]:$match[-1]" + "${${(j::)match[1,-2]}//:/\:}:$match[-1]" + ) else - gradle_all_tasks+=( "$match[1]:$match[2]" ) + gradle_all_tasks+=( + "${${(j::)match[1,-2]}//:/\:}:$match[-1]" + ) fi fi done _store_cache $cache_name gradle_group_tasks gradle_all_tasks fi + filter= + zstyle -T ":completion:${curcontext}:tasks" prefix-needed && + [[ $PREFIX != ([[:alnum:]]##\:)## ]] && + filter+="*\:*" if [[ $state == task ]]; then _tags gradle_group gradle_all while _tags; do # Offer main tasks and secondary tasks in different tags. - _requested gradle_group && _describe 'group tasks' gradle_group_tasks && ret=0 - _requested gradle_all && _describe 'secondary tasks' gradle_all_tasks && ret=0 + if _requested gradle_group; then + tasks=( ${gradle_group_tasks:#$~filter} ) + _describe -t tasks 'group task' tasks && + ret=0 + fi + if _requested gradle_all; then + tasks=( ${gradle_all_tasks:#$~filter} ) + _describe -t tasks 'secondary task' tasks && + ret=0 + fi (( ret )) || break done elif [[ $state == alltask ]]; then # After '--exclude-task', we don't make a distinction between main tasks and # secondary tasks. - _describe 'all tasks' gradle_group_tasks -- gradle_all_tasks && ret=0 + tasks=( ${gradle_group_tasks:#$~filter} ${gradle_all_tasks:#$~filter} ) + _describe -t tasks 'task' tasks && + ret=0 fi fi else - _describe 'built-in tasks' '( + _describe 'built-in task' '( "dependencies:Displays all dependencies declared in root project." "dependencyInsight:Displays the insight into a specific dependency in root project." "help:Displays a help message." diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep index 81516b08a..2dcbff4a3 100644 --- a/Completion/Unix/Command/_grep +++ b/Completion/Unix/Command/_grep @@ -1,6 +1,7 @@ -#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default- +#compdef grep egrep fgrep bsdgrep rgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default- -local arguments matchers command variant +local command variant +local -a arguments matchers if [[ $service = *GREP_OPT* ]]; then compset -q @@ -27,6 +28,10 @@ if [[ $service != (|g|z|gz|bz)[ef]grep ]]; then $matchers{--basic-regexp,-G}'[use basic regular expression]' ) fi +[[ $service = rgrep ]] || arguments+=( + '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)' + '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]' +) arguments+=( '(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines' @@ -37,7 +42,6 @@ arguments+=( '(--byte-offset -b -c)'{--byte-offset,-b}'[print the byte offset with output lines]' '(--text -a -I)--binary-files=[specify type to assume for binary files]:file type:(binary without-match text)' '(--count -c --byte-offset -b --line-number -n)'{--count,-c}'[only print a count of matching lines]' - '(--directories -d -r --recursive)'{--directories=,-d+}'[specify handling of directories]:action on directory:(read skip recurse)' '(--devices -D)'{--devices=,-D+}'[specify handling of devices, FIFOs and sockets]:action on device:(read skip)' '(1)*'{--regexp=,-e+}'[specify pattern]:pattern' '(1)*'{--file=,-f+}'[specify pattern file]:file:_files' @@ -53,11 +57,10 @@ arguments+=( '(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]' '(--only-matching -o --files-with-matches -l --files-without-match -L)'{--only-matching,-o}'[show only matching part of line]' '(--quiet --silent -q)'{--quiet,--silent,-q}'[suppress normal output]' - '(--recursive -r --dereference-recursive -R -d --directories)'{--recursive,-r}'[recurse subdirectories]' '*--include=[examine files matching specified pattern]:file pattern' '*--exclude=[skip files matching specified pattern]:file pattern' '*--exclude-dir=[skip directories matching specified pattern]:directory pattern' - '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable]' + '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable or non-existent files]' '(--version -V)'{--version,-V}'[display version info]' '(--invert-match -v)'{--invert-match,-v}'[select non-matching lines]' '(--word-regexp -w --line-regexp -x)'{--word-regexp,-w}'[force pattern to match only whole words]' @@ -72,6 +75,12 @@ case $variant:$OSTYPE in $matchers{--perl-regexp,-P}'[use perl regular expression]' ) ;| + *:openbsd*|unix:freebsd*) + arguments=( # argument to context is optional and after = only + ${arguments:#((#s)|*\))-(C|-context)*} + '(--context -C)'{--context=-,-C-}'[specify lines of context]::lines' + ) + ;| (gnu:*|gpl2:(free|net)bsd*)) arguments+=( '*--exclude-from=[skip files matching pattern in specified file]:file:_files' @@ -85,15 +94,15 @@ case $variant:$OSTYPE in '(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]" ) ;| - gpl2:darwin*) + (gpl2:darwin*|unix:freebsd*)) arguments+=( - '(-p -S)-O[follow symlinks on the command line]' - '(-O -S)-p[do not follow symlinks]' - '(-O -p)-S[follow all symlinks]' + '(-p -S)-O[recurse symlinks on the command line]' + "!(-O -S)-p[don't recurse symlinks]" + '(-O -p)-S[recurse all symlinks]' '*--include-dir=[only search directories matching specified pattern]:directory pattern' ) ;| - (gnu:*|gpl2:netbsd*)) + (gnu:*|gpl2:netbsd*|unix:freebsd*)) arguments+=( '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after each filename]' ) @@ -106,6 +115,15 @@ case $variant:$OSTYPE in '(--recursive -r --dereference-recursive -R -d --directories)'{--dereference-recursive,-R}'[recurse subdirectories, following symlinks]' ) ;; + unix:freebsd*) + arguments+=( + '!(-U --binary --binary-files)'{-U,--binary} + '--mmap[use mmap(2) instead of read(2) to read input]' + ) + [[ $service = rgrep ]] || arguments+=( + '(--recursive -r -d --directories)-R[recurse subdirectories]' + ) + ;; gpl2:*) arguments=( ${${arguments:#*\)-r}/\)-r/\)-R} ) ;; *:openbsd*) arguments=( @@ -122,4 +140,3 @@ case $variant:$OSTYPE in esac _arguments -S -s $arguments[@] - diff --git a/Completion/Unix/Command/_growisofs b/Completion/Unix/Command/_growisofs index 8f4da4030..206d2c2c7 100644 --- a/Completion/Unix/Command/_growisofs +++ b/Completion/Unix/Command/_growisofs @@ -270,7 +270,7 @@ else '-sort[sort files on the image based on weights defined in the given file]:sort-weighting file:_files' \ '-sparc-label[set the sun disk-label-name used for the -sparc-boot option]:label' \ '-split-output[split the output image into several files ~1GiB in size]' \ - '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size in sectors' \ + '-stream-media-size[enable streaming operation and set media size to given number of sectors]:media size (sectors)' \ '-stream-file-name[reserved for future use]:name' \ '-sunx86-boot[specify a comma-separated list of file-system images needed to make a bootable Solaris-x86-CD]:list' \ '-sunx86-label[specify the SVr4 disk-label-name for the SVr4 disk-label created with the -sunx86-boot option]:label' \ diff --git a/Completion/Unix/Command/_gzip b/Completion/Unix/Command/_gzip index 42d4ae705..8354b34d4 100644 --- a/Completion/Unix/Command/_gzip +++ b/Completion/Unix/Command/_gzip @@ -9,10 +9,14 @@ files=( '*:files:->files' ) case "$service" in unpigz|pigz) pigz=( - '(-K --zip)'{-K,--zip}'[compress to PKWare zip format]' + '(-A --alias)'{-A+,--alias=}'[specify filename to use in zip entry for stdin]:filename' + '(-C --comment)'{-C+,--comment=}'[put specified comment in the gzip or zip header]' + '(-H --huffman -U --rle)'{-H,--huffman}'[use only Huffman coding for compression]' + '(-U --rle -H --huffman)'{-U,--rle}'[use run-length encoding for compression]' + '(-K --zip -z --zlib)'{-K,--zip}'[compress to PKWare zip format]' '(-b --blocksize)'{-b+,--blocksize}'[set compression block size]:size (KiB)' '(-p --processes)'{-p,--processes}'[specify number of processes to use]' - '(-z --zlib)'{-z,--zlib}'[compress to zlib (.zz) format]' + '(-z --zlib -K --zip)'{-z,--zlib}'[compress to zlib (.zz) format]' '(-m --no-time)'{-m,--no-time}"[don't store/restore modification time in/from header]" '(-M --time)'{-M,--time}"[store/restore modification time in/from header]" '(--synchronous)-Y[force output file write to permanent storage]' diff --git a/Completion/Unix/Command/_head b/Completion/Unix/Command/_head index 1e968cc11..0771b1e4d 100644 --- a/Completion/Unix/Command/_head +++ b/Completion/Unix/Command/_head @@ -18,7 +18,13 @@ else case $OSTYPE in (freebsd*|darwin*|dragonfly*|netbsd*) args+=( '(-n)-c+[display the first specified bytes]:number of bytes' ) - ;; + ;| + dragonfly*|netbsd*) + args+=( + '(-v)-q[never print headers giving file names]' + '(-q)-v[always print headers giving file names]' + ) + ;; esac fi @@ -26,20 +32,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return 0 case $state in (number) - local mlt sign digit - mlt='multiplier:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' - mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' - sign='sign:sign:((-\:"print all but the last specified bytes/lines"' - sign+=' +\:"print the first specified bytes/lines (default)"))' - digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '(-|+|)[0-9]##'; then - _alternative $mlt $digit && ret=0 - elif [[ -z $PREFIX ]]; then - _alternative $sign $digit && ret=0 - elif compset -P '(+|-)'; then - _alternative $digit && ret=0 - fi - ;; + local alts + [[ -z $PREFIX ]] && alts=( + 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))' + ) + compset -P '+' + alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' ) + _alternative $alts && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_imagemagick b/Completion/Unix/Command/_imagemagick index 3afa108ae..b7671fe49 100644 --- a/Completion/Unix/Command/_imagemagick +++ b/Completion/Unix/Command/_imagemagick @@ -262,7 +262,10 @@ case "$service" in _arguments -C -M 'm:{a-z}={A-Z}' \ '-adjoin[join images]' \ '-affine[drawing transform matrix]:matrix' \ + '-alpha[set the alpha channel]:alpha' \ '-antialias[remove pixel aliasing]' \ + '-authenticate[decrypt image with specified password]:password' \ + '-attenuate[lessen (or intensify) when adding noise to an image]:value' \ '-append[append image sequence]' \ '-average[average image sequence]' \ '-background[specify background color]:color:_x_color' \ @@ -301,6 +304,7 @@ case "$service" in '(-endian)+endian' \ '-enhance[enhance image]' \ '-equalize[histogram equalization]' \ + '-features[analyze image features (e.g. contrast, correlation)]:distance' \ '-fill[specify color to use when filling a graphic primitive]:color:_x_color' \ '-filter:filter type for resizing:(Point Box Triangle Hermite Hanning Hamming Blackman Gaussian Quadratic Cubic Catrom Mitchell Lanczos Bessel Sinc)' \ '-flatten[flatten a sequence of images]' \ @@ -315,12 +319,14 @@ case "$service" in '-gravity:image gravity:(Center North NorthEast East SouthEast South SouthWest West NorthWest)' \ '-implode:implosion factor (0.0 - 99.9%%)' \ '-interlace:interlacing scheme:(None Line Plane Partition)' \ + '-interpolative-resize[resize image using point sampled interpolation]:geometry' \ '-label:label string' \ '-layer:layer type:(Red Green Blue Matte)' \ '-linewidth:line width' \ '-loop:number of iterations (GIF animation)' \ '-map[single image colormap file]:picture file for colors:_imagemagick' \ '+map[all images colormap file]:picture file for colors:_imagemagick' \ + '-mask[associate a mask with the image]:file:_files' \ '-matte[store matte channel]' \ '-modulate:<brightness>,<saturation>,<hue>' \ '-monochrome[transform to black and white]' \ @@ -352,6 +358,7 @@ case "$service" in '-size:image size (<width>x<height>+<offset>)' \ '-solarize:solarization threshold' \ '-spread:neighborhood size' \ + '-support[specify resize support]:support (>1.0 is blurry, < 1.0 is sharp)' \ '-swirl:swirl tightness' \ '-texture:background texture image:_imagemagick' \ '-threshold:threshold for maximum intensity' \ diff --git a/Completion/Unix/Command/_initctl b/Completion/Unix/Command/_initctl index 2d7c2494b..b60bdbc5b 100644 --- a/Completion/Unix/Command/_initctl +++ b/Completion/Unix/Command/_initctl @@ -51,14 +51,14 @@ _initctl_known_events() _initctl_multiple_known_events() { [[ ${#_initctl_events_list} -eq 0 ]] && _initctl_fillarray_events_args - _values -s "," "Events" "$_initctl_events_list[@]" + _values -s "," "event" "$_initctl_events_list[@]" } # list KEY= arguments, generate array if necessary _initctl_known_eventargs() { [[ ${#_initctl_eventargs_list} -eq 0 ]] && _initctl_fillarray_events_args - _values "Argument Keys" "$_initctl_eventargs_list[@]" + _values "argument key" "$_initctl_eventargs_list[@]" } # describe and offer commands for initctl, then call matching completion function @@ -82,7 +82,7 @@ _initctl_command() ) if (( CURRENT == 1 )); then - _describe -t command "initctl Commands" cmds + _describe -t command "initctl command" cmds fi local cmd=$words[1] @@ -97,8 +97,8 @@ _initctl_startstop() _arguments \ '--no-wait[do not wait for operation to complete before exiting]' \ "${common_args[@]}" \ - ':Upstart Jobs:_initctl_helper_jobs' \ - '*::Argument Keys:_initctl_known_eventargs' + ':upstart job:_initctl_helper_jobs' \ + '*::argument key:_initctl_known_eventargs' } # completion for anything that takes one job @@ -106,7 +106,7 @@ _initctl_argjob() { _arguments \ "${common_args[@]}" \ - ':Upstart Jobs:_initctl_helper_jobs' \ + ':upstart job:_initctl_helper_jobs' \ '*::' } @@ -116,8 +116,8 @@ _initctl_emit() _arguments \ '--no-wait[do not wait for event to finish before exiting]' \ "${common_args[@]}" \ - ':Events:_initctl_known_events' \ - '*::Argument Keys:_initctl_known_eventargs' + ':event:_initctl_known_events' \ + '*::argument key:_initctl_known_eventargs' } # the fallback, just the options @@ -133,7 +133,7 @@ _initctl_show-config() _arguments \ "(-e --enumerate)"{-e,--enumerate}"[enumerate emit lines]" \ "${common_args[@]}" \ - '::Upstart Jobs:_initctl_helper_jobs' \ + '::upstart job:_initctl_helper_jobs' \ '*::' } @@ -144,7 +144,7 @@ _initctl_check-config() "(-i --ignore-events)"{-i,--ignore-events}"[list of comma-separated events to ignore]:Events:_initctl_multiple_known_events" \ "(-w --warn)"{-w,--warn}"[treat any unknown jobs or events as error]" \ "${common_args[@]}" \ - '::Upstart Jobs:_initctl_helper_jobs' \ + '::upstart job:_initctl_helper_jobs' \ '*::' } @@ -157,7 +157,7 @@ _initctl() '--system[talk via DBUS system bus instead of socket]' '(-q --quiet)'{-q,--quiet}'[reduce output to errors only]' '(-v --verbose)'{-v,--verbose}'[increase output to include informational messages]' - '--dest=[D-Bus name for init, defaults to com.ubuntu.Upstart]' + '--dest=[specify D-Bus name for init]:D-Bus name [com.ubuntu.Upstart]' '--help[display help and exit]' '--version[output version information and exit]' ) @@ -172,7 +172,7 @@ _initctl() # depending on which command was used, call different completion functions case $service in initctl) - _arguments "${common_args[@]}" '*::Initctl Commands:_initctl_command' + _arguments "${common_args[@]}" '*::initctl command:_initctl_command' ;; start|stop|restart|reload|status) _call_function ret _initctl_${cmd_completion_funcs[${service}]-${cmd_completion_default}} diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install index 5ad84645e..364119961 100644 --- a/Completion/Unix/Command/_install +++ b/Completion/Unix/Command/_install @@ -106,7 +106,7 @@ case $state in 'a[symlinks use absolute path]' 'r[symlinks use relative path]' ) - _values -S '' 'link flags' $tmp && ret=0 + _values -S '' 'link flag' $tmp && ret=0 ;; esac diff --git a/Completion/Unix/Command/_iostat b/Completion/Unix/Command/_iostat index f5291a19b..1152b0d8b 100644 --- a/Completion/Unix/Command/_iostat +++ b/Completion/Unix/Command/_iostat @@ -128,10 +128,13 @@ case $OSTYPE:l in '-c[display CPU utilization report]' '-d[display device utilization report]' '--dec=-[specify the number of decimal places to use]:decimal places [2]:(0 1 2)' + '-f[specify alternative directory to read device statistics from]:directory:_directories' + '+f[specify additional directory to read device statistics from]:directory:_directories' '*-g[display statistics for a group of devices]:group name' '-H[only display global statistics for group]' '(--human)-h[human readable device utilization report]' '--human[print sizes in human readable format]' + '--pretty[make report easier to read by a human]' '-j[display persistent device name]:name type:(ID LABEL PATH UUID)' '(-m)-k[display statistics in kB/s]' '(-k)-m[display statistics in MB/s]' diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index ee0441d97..ff6e82645 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -24,18 +24,24 @@ javac) '(-cp -classpath)'{-cp,-classpath}'[specify where to find user class files]:class path:->classpath' \ '-sourcepath[specify where to find input source files]:source path:->sourcepath' \ '-bootclasspath[override location of bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-endorseddirs[override location of endorsed standards path]:path:->extdirs' \ '-extdirs[override location of installed extensions]:extensions directories:->extdirs' \ '-d[specify where to place generated class files]:directory:_files -/' \ '-encoding[specify character encoding used by source files]:encoding:->encoding' \ '-proc\:-[control annotation processing]:annotation processing:(none only)' \ '-processor[specify annotation processors to run]:class:_files' \ '-processorpath[specify where to find annotation processors]:directory:_directories' \ + '-parameters[generate metadata for reflection on method parameters]' \ '-s[specify directory for generated source files]:directory:_directories' \ + '-h[specify where to place generated native header files]:directory:_directories' \ '-source[provide source compatibility with specified release]:release:(1.{2..8} {5..8})' \ '-target[specify VM version]:release:(1.{1..5})' \ + '-profile[check that API used is available in the specified profile]:profile' \ '(-)-help[print a synopsis of standard options]' \ '(-)-version[print version information]' \ '(-)-X[display information about non-standard options]' \ + '-J-[pass flag directly to the runtime system]:flag' \ + '-Werror[terminate compilation if warnings occur]' \ '*:java source file:_files -g \*.java\(-.\)' && return 0 ;; @@ -75,6 +81,7 @@ java) '(- 1)-'{\?,help}'[print help message]' \ '(- 1)-X-[non-standard java option]:option' \ '(- 1)-jar[specify a program encapsulated as jar]:jar:_files -g \*.jar\(-.\)' \ + '-splash\:-[show splash screen with specified image]:image:_files' \ '(-):class:_java_class -m main ${(kv)opt_args[(i)(-classpath|-cp)]}' \ '*::args:= _normal' \ && return 0 @@ -90,15 +97,20 @@ javadoc) '-help[print help message]' \ '-doclet[specify a doclet]:doclet:_java_class -t doclet ${(kv)opt_args[(i)-classpath]}' \ '-docletpath[specify a path to search doclet]:doclet path:->docletpath' \ - '-1.1[Javadoc 1.1 compatible output]' \ '-sourcepath[specify path for source files]:source path:->sourcepath' \ - '-classpath[specify path for user class files]:class path:->classpath' \ + {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ + '-exclude[specify a list of packages to exclude]:package list' \ + '-subpackages[specify subpackages to recursively load]:subpackage list' \ + '-breakiterator[compute first sentence with BreakIterator]' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ + '-source[provide source compatibility with specified release]:release' \ '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ '-verbose[print verbose messages]' \ '-locale[specify locale]:language_country_variant:' \ '-encoding[specify character encoding for source files]:encoding:->encoding' \ + "-quiet[don't display status messages]" \ '-J-[specify java option]:java option:' \ + '-X[print a synopsis of nonstandard options and exit]' \ '-d[specify destination directory]:destination directory:_files -/' \ '-use[display pages for use]' \ '-version[include @version text]' \ @@ -111,15 +123,27 @@ javadoc) '-bottom[specify bottom text]:bottom text:' \ '-link[generate a link to external reference classes]:document URL:' \ '-linkoffline[generate a link for external reference class names]:document URL::package list URL:' \ + '-excludedocfilessubdir[exclude any doc-files subdirectories with given name]:name:_directories' \ '-group[generate tables for each group]:group heading::package patterns:' \ - '-nodeprecated[do not document deprecated API]' \ - '-nodeprecatedlist[do not generate deprecated API list]' \ - '-notree[do not generate class and interface hierarchy]' \ - '-noindex[do not generate index]' \ - '-nohelp[do not generate help link]' \ - '-nonavbar[do not generate navigation bar]' \ + "-nodeprecated[don't include @deprecated information]" \ + '-noqualifier[exclude the list of qualifiers from the output]:qualifier list' \ + "-nosince[don't include @since information]" \ + "-notimestamp[don't include hidden time stamp]" \ + "-nodeprecatedlist[don't generate deprecated API list]" \ + "-notree[don't generate class and interface hierarchy]" \ + "-noindex[don't generate index]" \ + "-nohelp[don't generate help link]" \ + "-nonavbar[don't generate navigation bar]" \ + '-serialwarn[generate warning about @serial tag]' \ + '*-tag[specify single argument custom tag]:tag' \ + '-taglet[specify fully qualified name of Taglet to register]:taglet' \ + '-tagletpath[specify path to Taglets]:path:_directories' \ + '-charset[specify charset of generated documentation]:charset:->encoding' \ '-helpfile[specify alternative help link]:helpfile path/filename:' \ - '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \ + '-linksource[generate source in HTML]' \ + '-sourcetab[specify the number of spaces each tab takes up in the source]:spaces' \ + '-keywords[include HTML meta tags with package, class and member info]' \ + '-stylesheetfile[specify alternative HTML style sheet]:stylesheet path/filename:_directories' \ '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \ '*:package name, source file or @list:->docsrc' && ret=0 ;; @@ -143,9 +167,11 @@ jar) 'f[specify archive file]' \ 'v[verbose mode]' \ '(e)m[specify manifest file]' \ + 'n[perform Pack200 normalization after creating a new archive]' \ '(m)e[specify class of for application entry point]' \ '0[store only without using ZIP compression]' \ - 'M[do not create manifest file]' \ + "M[don't create manifest file]" \ + "P[preserve leading / and .. components on file names]" \ 'i[generate index information for specified jar files]' && return else jar_cmd="${words[2]#-}" @@ -171,7 +197,7 @@ javah|javah_g) '-help[print help message]' \ '-version[print version]' \ '-jni[JNI-style native method function prototypes]' \ - '-classpath[specify path for user class files]:class path:->classpath' \ + {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-old[generate old JDK1.0-style header files]' \ '-force[force output]' \ @@ -182,17 +208,19 @@ javah|javah_g) javap) _arguments -C \ '-help[print help message]' \ + '-version[print version information]' \ + {-v,-verbose}'[print additional information]' \ '-l[line and local variable tables]' \ - '-b[backward compatible to JDK1.1]' \ - '-public[only public classes and members]' \ - '-protected[only protected and public classes and members]' \ - '-package[only package, protected and public classes and members (default)]' \ - '-private[all classes and members]' \ + '(-protected -package -p -private)-public[show only public classes and members]' \ + '(-public -package -p -private)-protected[show only protected/public classes and members]' \ + '(-public -protected -p -private)-package[show only package/protected/public classes and members (default)]' \ + '(-public -package -protected -p -private)'{-p,-private}'[show all classes and members]' \ '-J-[specify java option]:java option:' \ - '-s[internal type signatures]' \ '-c[disassemble code]' \ - '-verbose[stack size, number of locals and args for methods]' \ - '-classpath[specify path for user class files]:class path:->classpath' \ + '-s[print internal type signatures]' \ + '-sysinfo[show system info (path, size, date, MD5 hash) of class being processed]' \ + '-constants[show final constants]' \ + {-cp,-classpath}'[specify path for user class files]:class path:->classpath' \ '-bootclasspath[specify path for bootstrap class files]:bootstrap class path:->bootstrapclasspath' \ '-extdirs[specify directories for extensions]:extensions directories:->extdirs' \ '*:class:_java_class ${(kv)opt_args[(i)-classpath]}' && return 0 diff --git a/Completion/Unix/Command/_joe b/Completion/Unix/Command/_joe index 592c34a10..74b0bf1a3 100644 --- a/Completion/Unix/Command/_joe +++ b/Completion/Unix/Command/_joe @@ -36,4 +36,4 @@ _arguments \ '-linums[display line numbers before each line]' \ '-rdonly[make file read-only]' \ '-keymap[use an alternate section of joerc for keybindings]:keymap name' \ - '*:files:_files' + '*:file:_files' diff --git a/Completion/Unix/Command/_killall b/Completion/Unix/Command/_killall index 36accb2e0..3ddd36341 100644 --- a/Completion/Unix/Command/_killall +++ b/Completion/Unix/Command/_killall @@ -38,15 +38,9 @@ if _pick_variant psmisc=PSmisc unix --version; then case $state in (time) - local -a units=( 's:seconds' 'm:minutes' 'h:hours' 'd:days' - 'w:weeks' 'M:months' 'y:years' ) - if compset -P '[0-9]##(|.[0-9]#)'; then - _alternative 'float-numbers:: _message "float number"' \ - 'units:: _describe unit units' && ret=0 - else - _message 'float number and unit' && ret=0 - fi - ;; + _numbers -fN age 's:seconds' 'm:minutes' 'h:hours' 'd:days' \ + 'w:weeks' 'M:months' 'y:years' + ;; esac return ret diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less index cb71314a6..69f75fd0e 100644 --- a/Completion/Unix/Command/_less +++ b/Completion/Unix/Command/_less @@ -1,7 +1,7 @@ #compdef less -value-,LESS,-default- -value-,LESSCHARSET,-default- -local curcontext="$curcontext" state line expl ret=1 -local -a files +local curcontext="$curcontext" fgbg=foreground ret=1 +local -a state line expl files basic suf case $service in *LESSCHARSET*) @@ -37,15 +37,15 @@ _arguments -S -s -A "[-+]*" \ '(-b --buffers)'{-b+,--buffers=}'[specify amount of buffer space used for each file]:buffer space (kilobytes)' \ '(-B --auto-buffers)'{-B,--auto-buffers}"[don't automatically allocate buffers for pipes]" \ '(-C --CLEAR-SCREEN -c --clear-screen)'{-c,--clear-screen}'[repaint screen instead of scrolling]' \ - '(-c --clear-screen -C --CLEAR-SCREEN)'{-C,--CLEAR-SCREEN}'[clear screen before repaints]' \ + '!(-c --clear-screen)'{-C,--CLEAR-SCREEN} \ '(-d --dumb)'{-d,--dumb}'[suppress error message if terminal is dumb]' \ + '*'{-D+,--color=}'[set screen colors]: :->colors' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-e,--quit-at-eof}'[exit the second time end-of-file is reached]' \ '(-e -E --quit-at-eof --QUIT-AT-EOF)'{-E,--QUIT-AT-EOF}'[exit when end-of-file is reached]' \ '(-f --force)'{-f,--force}'[force opening of non-regular files]' \ '(-F --quit-if-one-screen)'{-F,--quit-if-one-screen}'[exit if entire file fits on first screen]' \ '(-G --HILITE-SEARCH -g --hilite-search)'{-g,--hilite-search}'[highlight only one match for searches]' \ '(-g --hilite-search -G --HILITE-SEARCH)'{-G,--HILITE-SEARCH}'[disable highlighting of search matches]' \ - '--old-bot[revert to the old bottom of screen behavior]' \ '(-h --max-back-scroll)'{-h+,--max-back-scroll=}'[specify backward scroll limit]:backward scroll limit (lines)' \ '(-I --IGNORE-CASE -i --ignore-case)'{-i,--ignore-case}'[ignore case in searches that lack uppercase]' \ '(-i --ignore-case -I --IGNORE-CASE)'{-I,--IGNORE-CASE}'[ignore case in all searches]' \ @@ -80,21 +80,52 @@ _arguments -S -s -A "[-+]*" \ '--no-keypad[disable use of keypad terminal init string]' \ '(-y --max-forw-scroll)'{-y,--max-forw-scroll}'[specify forward scroll limit]' \ '(-z --window)'{-z+,--window=}'[specify scrolling window size]:lines' \ - '(-\" --quotes)'{-\"+,--quotes=}'[change quoting character]:quoting characters' \ + '(-\" --quotes)'{'-\"+',--quotes=}'[change quoting character]:quoting characters' \ '(-~ --tilde)'{-~,--tilde}"[don't display tildes after end of file]" \ - '(-\# --shift)'{-\#+,--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '(-\# --shift)'{'-\#+',--shift=}"[specify amount to move when scrolling horizontally]:number" \ + '--file-size[automatically determine the size of the input file]' \ + '--incsearch[search file as each pattern character is typed in]' \ + '--line-num-width=[set the width of line number field]:width [7]' \ '--follow-name[the F command changes file if the input file is renamed]' \ '--mouse[enable mouse input]' \ '--no-histdups[remove duplicates from command history]' \ '--rscroll=[set the character used to mark truncated lines]:character [>]' \ '--save-marks[retain marks across invocations of less]' \ + '--status-col-width=[set the width of the -J status column]:width [2]' \ '--use-backslash[subsequent options use backslash as escape char]' \ + '--use-color[enable colored text]' \ '--wheel-lines=[specify lines to move for each click of the mouse wheel]:lines' \ "$files[@]" && ret=0 if [[ -n "$state" ]]; then case $state in + colors) + if compset -P 1 \?; then + [[ $IPREFIX[-1] != [a-z] ]] || compset -P 1 + || _describe 'color application' '( +:add\ to\ existing\ attribute )' + suf=( -S '' ) + compset -P 1 '([-a-zA-Z]|*.)' && fgbg=background && suf=() + basic=( B:blue C:cyan G:green K:black M:magenta R:red W:white Y:yellow ) + _describe -t colors "$fgbg color" \ + "( -:default ${(j. .)${(@)basic/:/:light\ }} ${(Lj. .)basic} )" "$suf[@]" && ret=0 + else + _describe 'text' '( + B:binary\ characters + C:control\ characters + E:errors\ and\ informational\ messages + M:mark\ letters\ in\ the\ status\ column + N:line\ numbers\ enabled\ via\ the\ -N\ option + P:prompts + R:the\ rscroll\ character + S:search\ results + W:the\ highlight\ enabled\ via\ the\ -w\ option + d:bold\ text + k:blinking\ text + s:standout\ text + u:underlined\ text + )' -S '' && ret=0 + fi + ;; prompts) if compset -p 1; then _message -e prompt diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb index 0426f69f2..eae8e1d3a 100644 --- a/Completion/Unix/Command/_lldb +++ b/Completion/Unix/Command/_lldb @@ -6,12 +6,12 @@ typeset -a opts args [[ $EUID = 0 || $_comp_priv_prefix[1] = sudo ]] && opts=( -a ) args=( - '*'{-o+,--one-line=}'[run one-line lldb command after loading executable]:lldb command: ' - '*'{-s+,--source=}'[run lldb commands from a file after loading executable]:file:_files' - '*'{-O+,--one-line-before-file=}'[run one-line lldb command before loading executable]:lldb command' - '*'{-S+,--source-before-file=}'[run lldb commands from a file before loading executable]:file:_files' - '(-k --one-line-on-crash)'{-k+,--one-line-on-crash=}'[run one-line lldb command if target crashes in batch mode]:lldb command' - '(-K --source-on-crash)'{-K+,--source-on-crash=}'[run lldb commands from a file if target crashes in batch mode]:file:_files' + '*'{-o+,--one-line}'[run one-line lldb command after loading executable]:lldb command: ' + '*'{-s+,--source}'[run lldb commands from a file after loading executable]:file:_files' + '*'{-O+,--one-line-before-file}'[run one-line lldb command before loading executable]:lldb command' + '*'{-S+,--source-before-file}'[run lldb commands from a file before loading executable]:file:_files' + '(-k --one-line-on-crash)'{-k+,--one-line-on-crash}'[run one-line lldb command if target crashes in batch mode]:lldb command' + '(-K --source-on-crash)'{-K+,--source-on-crash}'[run lldb commands from a file if target crashes in batch mode]:file:_files' '(-b --batch)'{-b,--batch}'[run commands from -s -S -o -O and quit]' '(-Q --source-quietly)'{-Q,--source-quietly}'[suppress output from -s, -S, -o or -O]' '(-e --editor)'{-e,--editor}'[open source files using "external editor" mechanism]' @@ -19,21 +19,21 @@ args=( '(-X --no-use-colors)'{-X,--no-use-colors}'[do not use colors]' '(-d --debug)'{-d,--debug}'[print extra information for debugging itself]' '(-r --repl)'{-r,--repl}'[run lldb in REPL mode]' - '(-l --script-language)'{-l+,--script-language=}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)' + '(-l --script-language)'{-l+,--script-language}'[use the specified scripting language]:language:(Python Perl Ruby Tcl)' - info '(-)'{-h,--help}'[print the usage information]' '(-)'{-v,--version}'[print the current version number]' '(-)'{-P,--python-path}'[print path to the lldb.py file]' - file - '(-f --file)'{-f+,--file=}'[specify executable file to debug]:executable:_files -g "*(-*)"' - '(-a --arch)'{-a+,--arch=}'[use the specified architecture]:arch' - '(-c --core)'{-c+,--core=}'[specify core file to open]:core file:_files -g "*core*(-.)"' + '(-f --file)'{-f+,--file}'[specify executable file to debug]:executable:_files -g "*(-*)"' + '(-a --arch)'{-a+,--arch}'[use the specified architecture]:arch' + '(-c --core)'{-c+,--core}'[specify core file to open]:core file:_files -g "*core*(-.)"' '*::executable and arguments:->exe_args' - name - '(-n --attach-name)'{-n+,--attach-name=}"[attach to the named process]: :_process_names $opts" + '(-n --attach-name)'{-n+,--attach-name}"[attach to the named process]: :_process_names $opts" '(-w --wait-for)'{-w,--wait-for}'[wait for the specified process to launch]' - pid - '(-p --attach-pid)'{-p+,--attach-pid=}'[attach to the specified process]:pid:_pids' + '(-p --attach-pid)'{-p+,--attach-pid}'[attach to the specified process]:pid:_pids' ) _arguments -C -s -S : $args && return 0 diff --git a/Completion/Unix/Command/_locale b/Completion/Unix/Command/_locale index a7fd88f65..b2ee14ee0 100644 --- a/Completion/Unix/Command/_locale +++ b/Completion/Unix/Command/_locale @@ -28,6 +28,7 @@ elif [[ $OSTYPE == openbsd* ]]; then specs=( '(-m)-a[list all available locales]' '(-a)-m[list all available charmaps]' + '(-a -m)1:name:(charmap)' ) else diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 23305f798..af07473b3 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -44,7 +44,7 @@ case $variant in -u'[create slocate database starting at path /]' -U'[create slocate database starting at given path]:directory:_files -/' -c'[parse GNU locate updatedb with -u, -U]' - -e'[exclude directories with -u, -U]:directories:_files -/' + -e'[exclude directories with -u, -U]: : _dir_list -s,' -f'[exclude file system types from db with -u, -U]:file system:_file_systems' -l'[security level]:level:(0 1)' -q'[quiet mode]' diff --git a/Completion/Unix/Command/_logger b/Completion/Unix/Command/_logger new file mode 100644 index 000000000..0d47d2f03 --- /dev/null +++ b/Completion/Unix/Command/_logger @@ -0,0 +1,80 @@ +#compdef logger + +local variant ign +local -a args common +local -a priorities + +_pick_variant -r variant linux=util-linux busybox=BusyBox $OSTYPE -V + +priorities=( {kern,user,mail,daemon,auth,syslog,lpr,news,uucp,cron,authpriv,ftp,ntp,security,console,local{0..7}}.{emerg,panic,alert,crit,err,error,warn,warning,notice,info,debug} ) +args=( "(--id)-i[log the logger command's pid]" ) +common=( + '(-f --file --journald *)'{-f+,--file=}'[log contents of specified file]:file:_files' + '(-s --stderr)'{-s,--stderr}'[output message to standard error as well]' + '(-P --port)'{-P+,--port}'[use specified port for UDP or TCP connection]:port [514]:_ports' + '(-p --priority)'{-p+,--priority}'[mark message with specified priority]:priority:_multi_parts . priorities' + '(-t --tag)'{-t+,--tag}"[specify tag to mark log line with]:tag [$USER]" +) + +case $variant in + (net|open)bsd*) + args+=( ${(M)common:#*\)-[fpst]*} + '-c[write the message to the console if unable to use syslogd(8)]' + ) + ;| + dragonfly*|freebsd*) + args+=( + '(-6)-4[use IPv4 addresses only]' + '(-4)-6[use IPv6 addresses only]' + '-A[send the message to all addresses]' + ) + ;| + darwin*|dragonfly*) args+=( ${(M)common:#*\)-[sfpt]*} ) ;| + freebsd*) + args+=( ${common:#*\)--*} + "-H+[set value for hostname in message header]:hostname [${HOST%%.*}]" + '-h+[write to specified remote syslog server or socket]: : _alternative + "hosts\:server\:_hosts" + "sockets\:socket\:_files -g \*\(=\)"' + '-S+[specify source address and port when using -h]: :_bind_addresses -0bh' + ) + ;; + dragonfly*) + args+=( '-h+[write to specified remote syslog server]:server:_hosts' ) + ;; + busybox) args=( ${(M)common:#*\)-[spt]*} ) ;; # no -i + solaris*) args+=( ${(M)common:#*\)-[fpt]*} ) ;; + netbsd*) + args+=( + '-d+[log this in the structured data (SD) field]:sd field' + '-m+[specify message ID used for the message]:message id' + '-n[open log file immediately]' + ) + ;; + linux) + (( $#words > 2 )) && ign='!' + args+=( $common + "(-i)--id=-[log the given id, or otherwise the pid]::id [$$]:_pids" + '(* -e --skip-empty)'{-e,--skip-empty}"[don't log empty lines when processing files]" + '--no-act[do everything except the write the log]' + '--octet-count[use rfc6587 octet counting]' + '(*)--prio-prefix[look for a prefix on every line read from stdin]' + '(-S --size)'{-S+,--size=}'[specify maximum size for a single message]:size [1KiB]' + '(-n --server)'{-n+,--server=}'[write to specified remote syslog server]:server:_hosts' + '(-T --tcp -d --udp)'{-T,--tcp}'[use TCP only]' + '(-d --udp -T --tcp)'{-d,--udp}'[use UDP only]' + '(--rfc5424 --msgid --sd-id --sd-param)--rfc3164[use the obsolete BSD syslog protocol]' + '(--rfc3164)--rfc5424=-[use the syslog protocol (default for remote)]::without:_sequence compadd - notime notq nohost' + '(--rfc3164)*--sd-id=[specify rfc5424 structured data ID]:id' + '(--rfc3164)*--sd-param=[specify rfc5424 structured data name=value]:data' + '(--rfc3164)--msgid=[set rfc5424 message id field]:message id' + '(-u --socket)'{-u,--socket=}'[write to specified Unix socket]:socket:compadd -f -M "r\:|_=* r\:|=*" ${${(M)${(f)"$(</proc/net/unix)"}\:#* /*}##* }' + '--socket-errors=-[print connection errors when using Unix sockets]::state:(on off auto)' + '(* -f --file)--journald=-[write journald entry]::file:_files' + "${ign}(- *)"{-h,--help}'[display usage information]' + "${ign}(- *)"{-V,--version}'[display version information]' + ) + ;; +esac + +_arguments -s -S -A "-*" $args '*: :_guard "^-*" message' diff --git a/Completion/Unix/Command/_lp b/Completion/Unix/Command/_lp index e84d9ad04..ad7e97203 100644 --- a/Completion/Unix/Command/_lp +++ b/Completion/Unix/Command/_lp @@ -58,6 +58,9 @@ _lp_job_options() '6:rotated 180 degrees') _describe "orientation requested" desc_opts ;; + (job-sheets(|-*)) + compadd "$@" /usr/share/cups/banners/*(:t) + ;; (sides) compadd "$@" one-sided two-sided-{long,short}-edge ;; @@ -80,7 +83,7 @@ _lp_job_options() "DuplexTumble:flip short side" "DuplexNoTumble:flip long side" "None") - _describe "duplex options" desc_opts + _describe "duplex option" desc_opts ;; (*) @@ -100,11 +103,11 @@ _lp_job_options() eq_suffix=(-S '=') fi - _description lpopts expl "generic printer options" + _description lpopts expl "generic printer option" compadd "$expl[@]" $eq_suffix $lopts_with_args compadd "$expl[@]" $lopts_no_args - _description printeropts expl "printer specific options" + _description printeropts expl "printer specific option" compadd "$expl[@]" $eq_suffix \ $(_call_program list-printer-options \ lpoptions $printer -l | cut -d/ -f1) @@ -163,128 +166,128 @@ _lp() case $service in (lpq) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-a)-P+[Destination printer]:printers:_printers' \ - '(-P)-a[All printers]' \ - '-l[Long listing]' \ - '*:poll interval (+seconds):' + '(-a)-P+[destination printer]:printer:_printers' \ + '(-P)-a[all printers]' \ + '-l[long listing]' \ + '*:poll interval (+seconds)' ;; (lprm) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '-P+[Destination printer]:printers:_printers' \ - '*:job ids:_lp_list_jobs' + '-P+[destination printer]:printer:_printers' \ + '*:job id:_lp_list_jobs' ;; (lpoptions) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-U:username (for connection to server):_users' \ '-h:alternate server:_hosts' \ - '(-p -l -r -x)-d+[Set default printer]:printers:_printers' \ - '(-l -x)*-o:job options:_lp_job_options' \ - '(-d -x)-p+[Destination printer for options]:printers:_printers' \ - '(-d -o -r -x)-l[List options]' \ + '(-p -l -r -x)-d+[set default printer]:printer:_printers' \ + '(-l -x)*-o:job option:_lp_job_options' \ + '(-d -x)-p+[destination printer for options]:printer:_printers' \ + '(-d -o -r -x)-l[list options]' \ '(-d -l -x)*-r:remove option:_lp_job_options' \ - '(-d -l -r -o)-x+[Remove all options]:printers:_printers' + '(-d -l -r -o)-x+[remove all options]:printer:_printers' ;; (lpstat) _arguments \ - '-E[Force encryption]' \ - '-R[Shows print job ranking]' \ + '-E[force encryption]' \ + '-R[shows print job ranking]' \ '-U:username (for connection to server):_users' \ - '-W:which jobs:(completed not-completed)' \ - '-a+[Show accepting state]:printers:_printers' \ - '-c:printer classes:' \ - '-d[Show current default destination]' \ + '-W:which job:(completed not-completed)' \ + '-a+[show accepting state]:printer:_printers' \ + '-c:printer class' \ + '-d[show current default destination]' \ '-h:hostname (alternate server):_hosts' \ - '-l[Long listing]' \ - '-o+[Destinations]:printers:_printers' \ - '-p+:printers:_printers' \ + '-l[long listing]' \ + '-o+[destinations]:printer:_printers' \ + '-p+:printer:_printers' \ '-r[CUPS server running status]' \ - '-s[Status summary]' \ - '-t[All status info]' \ - '-u[List jobs by users]:users:_users' \ - '-v+[Show devices]:printers:_printers' + '-s[status summary]' \ + '-t[all status info]' \ + '-u[list jobs by users]:user:_users' \ + '-v+[show devices]:printer:_printers' ;; (lpr) _arguments \ - '-E[Force encryption]' \ + '-E[force encryption]' \ '-H:hostname (alternate server):_hosts' \ - '(-C -J -T)'-{C,J,T}':job name:' \ - '-P+[Destination printer]:printers:_printers' \ + '(-C -J -T)'-{C,J,T}':job name' \ + '-P+[destination printer]:printer:_printers' \ '-U:username (for connection to server):_users' \ - '-#[Copies]:copies (1--100):' \ - '-h[Disables banner printing]' \ - '-l[Raw file]' \ - '-m[Send an email on job completion]' \ - '*-o:print job options:_lp_job_options' \ - '-p[Format with shaded header incl. date, time etc.]' \ - '-q[Hold job for printing.]' \ - '-r[Delete files after printing]' \ - '*:PS/PDF files:_pspdf' + '-#[copies]:copies (1--100)' \ + '-h[disables banner printing]' \ + '-l[raw file]' \ + '-m[send an email on job completion]' \ + '*-o:print job option:_lp_job_options' \ + '-p[format with shaded header incl. date, time etc.]' \ + '-q[hold job for printing]' \ + '-r[delete files after printing]' \ + '*:PS/PDF file:_pspdf' ;; (lp) _arguments \ - '-E[Force encryption]' \ - '-U[Username (for connection to server)]:username:_users' \ + '-E[force encryption]' \ + '-U[username (for connection to server)]:username:_users' \ '-c[(OBSOLETE) copy to spool dir before printing]' \ - '-d+[Destination printer]:printers:_printers' \ + '-d+[destination printer]:printer:_printers' \ '-h:hostname (alternate server):_hosts' \ - '-i[Job id to modify]:job id:' \ - '-m[Send an email on job completion]' \ - '-n[Copies]:copies (1--100):' \ - '*-o:print job options:_lp_job_options' \ - '-q[Job priority -- 1 (lowest) to 100 (highest)]:priority:' \ - "-s[Don't report resulting job IDs]" \ - '-t[Sets the job name]:job name:' \ - '-u[Job submission username]:username:_users' \ - '-H[Time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ - '-P:page range list:' \ - '*:PS/PDF files:_pspdf' + '-i[job id to modify]:job id' \ + '-m[send an email on job completion]' \ + '-n[copies]:copies (1--100)' \ + '*-o:print job option:_lp_job_options' \ + '-q[job priority -- 1 (lowest) to 100 (highest)]:priority' \ + "-s[don't report resulting job IDs]" \ + '-t[set the job name]:job name' \ + '-u[job submission username]:username:_users' \ + '-H[time to print]:print time (or enter hh\:mm):(hold immediate restart resume)' \ + '-P:page range list' \ + '*:PS/PDF file:_pspdf' ;; (lpinfo) _arguments \ - '-E[Force encryption]' \ - '-U[Username (for connection to server)]:username:_users' \ + '-E[force encryption]' \ + '-U[username (for connection to server)]:username:_users' \ '-h:hostname (alternate server):_hosts' \ - '-l[Shows a "long" listing of devices or drivers]' \ - {--exclude-schemes,--include-schemes}'[Device/PPD schemes to filter from results]:scheme-list:' \ - '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string:' \ - '(-v --timeout)--language:locale:' \ - '(-v --timeout)--product[Product to match]:name:' \ - '(-v --timeout)--make-and-model[Make and model to match]:name:' \ - '(-v --timeout)-m[List available drivers]' \ - '(-m --device-id --language --make-and-model --product)--timeout[Timeout when listing devices with -v]:timeout (seconds):' \ - '(-m --device-id --language --make-and-model --product)-v[List available devices]' + '-l[show a "long" listing of devices or drivers]' \ + {--exclude-schemes,--include-schemes}'[device/PPD schemes to filter from results]:scheme-list' \ + '(-v --timeout)--device-id[IEEE-1284 device ID to match]:device-id-string' \ + '(-v --timeout)--language:locale' \ + '(-v --timeout)--product[product to match]:name' \ + '(-v --timeout)--make-and-model[make and model to match]:name' \ + '(-v --timeout)-m[list available drivers]' \ + '(-m --device-id --language --make-and-model --product)--timeout[timeout when listing devices with -v]:timeout (seconds)' \ + '(-m --device-id --language --make-and-model --product)-v[list available devices]' ;; (lpadmin) _arguments \ - '-E[Force encryption/Enable destination]' \ - '-U[Username (for connection to server)]:username:_users' \ + '-E[force encryption/enable destination]' \ + '-U[username (for connection to server)]:username:_users' \ '-h:hostname (alternate server):_hosts' \ - '(-p -R -x -o)-d+[Default printer]:printers:_printers' \ - '(-d -x)-p+[Configure printer]:printers:_printers' \ - '(-p -R -d -o)-x+[Delete printer]:printers:_printers' \ - '(-x -d)-R[Name-default]:name-default:' \ - '-c:printer classes:' \ - '-m:model:' \ - '(-x -d)*-o:options:_lp_job_options' \ - '-r[Remove from class]:class:' \ - '-u[Access policy]:access policy:' \ - '-v[Device-uri of printer queue]:device-uri:' \ - '-D[Text description of destination]:info:' \ - '-L[Location of the printer]:location:' \ + '(-p -R -x -o)-d+[default printer]:printer:_printers' \ + '(-d -x)-p+[configure printer]:printer:_printers' \ + '(-p -R -d -o)-x+[delete printer]:printer:_printers' \ + '(-x -d)-R[name-default]:name-default' \ + '-c:printer class' \ + '-m:model' \ + '(-x -d)*-o:option:_lp_job_options' \ + '-r[remove from class]:class' \ + '-u[access policy]:access policy' \ + '-v[device-uri of printer queue]:device-uri' \ + '-D[text description of destination]:info' \ + '-L[location of the printer]:location' \ '-P[PPD file to use]:PPD file:_files "*.(#i)ppd(-.)"' esac } diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index 1fd9383f5..df14e7e2c 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -196,7 +196,7 @@ else '(-q --hide-control-chars)--show-control-chars' '(- :)--help[display help information]' '(- :)--version[display version information]' - '*:files:_files' + '*:file:_files' ) if [[ $OSTYPE = linux* ]]; then arguments+=( diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index 754012e3b..8afb55e1d 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -34,7 +34,7 @@ _arguments -C -s -S $args \ '-f[inhibit listing of kernel file structure info]::info type:->file-structures' \ '+f[enable listing of kernel file structure info]::info type:->file-structures' \ '-F[select output fields]:fields:->fields' \ - '-g[select by process group id]::process group id' \ + '-g[select by process group id]::process group id:_sequence -s , _pgids' \ '(*)*-i[select internet files]::address:->addresses' \ '-K+[select listing of tasks of processes]::value:((i\:ignore\ tasks))' \ '-k[specify kernel name list file]:kernel file:_files' \ diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks index 0915765dc..42169c22a 100644 --- a/Completion/Unix/Command/_luarocks +++ b/Completion/Unix/Command/_luarocks @@ -34,8 +34,8 @@ local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:_ local rockspec_options=( '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")' - '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}' - '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}' + '--summary=[a short one-line description summary]:summary' + '--detailed=[a longer description string]:detailed description' '--homepage=[project homepage]:URL:_urls' '--lua-versions=[specify supported Lua versions]:lua version:_sequence compadd - 5.{1,2,3,4}' '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: ' @@ -321,7 +321,7 @@ __luarocks_rock(){ continue ;; (rockpack) - alts+=(':rock file:{_files -g "*.src.rock(-.)"}') + alts+=( ':rock file:_files -g "*.src.rock(-.)"' ) shift 1 continue ;; @@ -332,7 +332,7 @@ __luarocks_rock(){ ;; (installed) tree="$2" - alts+=(":local rock:{__luarocks_installed_rocks ${tree}}") + alts+=(":local rock: __luarocks_installed_rocks ${tree}") if [[ -z "${tree}" ]]; then shift else @@ -364,7 +364,7 @@ __luarocks_git_tags(){ local make_command_options=( '--pack-binary-rock[produce a .rock file with the contents of compilation inside the current directory instead of installing it]' '--keep[do not remove previously installed versions of the rock after building a new one]' - '--branch=[override the `source.branch` field in the loaded rockspec]:NAME:{_message "branch name"}' + '--branch=[override the `source.branch` field in the loaded rockspec]:branch name' ) local build_command_options=( "${make_command_options[@]}" @@ -375,8 +375,8 @@ local build_command_options=( _luarocks_build(){ _arguments -A "-*" \ "${build_command_options[@]}" \ - '1: :{__luarocks_rock "rockspec" "external"}' \ - '2:: :{__luarocks_rock_version "external_or_local"}' + '1: : __luarocks_rock "rockspec" "external"' \ + '2:: : __luarocks_rock_version "external_or_local"' } # arguments: # - must: option @@ -402,7 +402,7 @@ local doc_command_options=( _luarocks_doc(){ _arguments \ "${doc_command_options[@]}" \ - "1: :{__luarocks_rock installed ${opt_args[--tree]}}" + "1: : __luarocks_rock installed ${opt_args[--tree]}" } # arguments: # - must: external only rockspec @@ -416,14 +416,14 @@ local download_command_options=( _luarocks_download(){ _arguments -A "-*" \ "${download_command_options[@]}" \ - '1: :{__luarocks_rock "external"}' \ - '2:: :{__luarocks_rock_version "external_or_local"}' + '1: : __luarocks_rock "external"' \ + '2:: : __luarocks_rock_version "external_or_local"' } # arguments: # must: luarocks sub command (( $+functions[_luarocks_help] )) || _luarocks_help(){ - _arguments '1: :__luarocks_command' + _arguments '1: : __luarocks_command' } (( $+functions[_luarocks_init] )) || @@ -446,7 +446,7 @@ _luarocks_install(){ # - must: rockspec file (first and last) (( $+functions[_luarocks_lint] )) || _luarocks_lint(){ - _arguments '1:: :{__luarocks_rock "rockspec"}' + _arguments '1:: : __luarocks_rock "rockspec"' } # arguments: # NOTE: receives only options @@ -463,7 +463,7 @@ _luarocks_list(){ # NOTE: it's options were already described above. (( $+functions[_luarocks_make] )) || _luarocks_make(){ - _arguments '1:: :{__luarocks_rock "rockspec"}' + _arguments '1:: : __luarocks_rock "rockspec"' } # arguments: # - optional: .rockspec file / external rock @@ -476,8 +476,8 @@ local new_version_command_options=( _luarocks_new_version(){ _arguments -A "-*" \ "${new_version_command_options[@]}" \ - '1:: :{__luarocks_rock "external" "rockspec"}' \ - '2:: :{__luarocks_rock_version "external_or_local"}' \ + '1:: : __luarocks_rock "external" "rockspec"' \ + '2:: : __luarocks_rock_version "external_or_local"' \ '3:: :_urls' } # arguments: @@ -524,8 +524,8 @@ local remove_command_options=( _luarocks_remove(){ _arguments -A "-*" \ "${remove_command_options[@]}" \ - "1: :{__luarocks_rock installed ${opt_args[--tree]}}" \ - "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}" + "1: : __luarocks_rock installed ${opt_args[--tree]}" \ + "2:: : __luarocks_rock_version installed ${opt_args[--tree]}" } # arguments: # - must: string as a search query @@ -558,8 +558,8 @@ local show_command_options=( _luarocks_show(){ _arguments \ "${show_command_options[@]}" \ - "1: :{__luarocks_rock installed "${opt_args[--tree]}"}" \ - "2:: :{__luarocks_rock_version installed ${opt_args[--tree]}}" + "1: : __luarocks_rock installed "${opt_args[--tree]}"" \ + "2:: : __luarocks_rock_version installed ${opt_args[--tree]}" } (( $+functions[_luarocks_test] )) || @@ -567,7 +567,7 @@ _luarocks_test(){ _arguments $option_deps_modes \ '--test-type=[specify the test suite type manually]:test suite type' \ '--reset[regenerate files if they already exist]' \ - '1:rockspec:__luarocks_rock' \ + '1: : __luarocks_rock' \ '*:arg' } @@ -581,7 +581,7 @@ local unpack_command_options=( _luarocks_unpack(){ _arguments \ "${unpack_command_options[@]}" \ - '1: :{__luarocks_rock "rockpack" "external"}' + '1: : __luarocks_rock "rockpack" "external"' } # arguments: # - must: rockspec file @@ -595,7 +595,7 @@ local upload_command_options=( _luarocks_upload(){ _arguments \ "${upload_command_options[@]}" \ - '1: :{__luarocks_rock "rockspec"}' + '1: : __luarocks_rock "rockspec"' } (( $+functions[_luarocks_which] )) || @@ -609,8 +609,8 @@ _luarocks_write_rockspec(){ "${rockspec_options[@]}" \ '--output=[write the rockspec with the given file]:file:_files' \ '--tag=[specify tag to use. Will attempt to extract version number from it]:tag:__git_tag' \ - '1:: :{_message "new rock name"}' \ - '2:: :{__luarocks_rock_version "new_rock"}' \ + '1::new rock name' \ + '2:: : __luarocks_rock_version "new_rock"' \ '3:: :_urls' } diff --git a/Completion/Unix/Command/_lz4 b/Completion/Unix/Command/_lz4 index 2697c4d11..6676943c4 100644 --- a/Completion/Unix/Command/_lz4 +++ b/Completion/Unix/Command/_lz4 @@ -42,8 +42,8 @@ args=( '(b t -k --keep)--rm[remove source file]' '!(b t -c --stdout)--to-stdout' + b # Benchmark-mode options - "(C c d t)-b-[benchmark file using specified compression level]::compression level:(${(j< >)levels//-/})" - "(C c d t)-e-[specify upper compression level limit (with -b)]:compression level:(${(j< >)levels//-/})" + "(C c d t)-b-[benchmark file using specified compression level]:: :->levels" + "(C c d t)-e-[specify upper compression level limit (with -b)]: :->levels" '(C c d t)-i-[specify minimum evaluation time (with -b)]:evaluation time (seconds)' + c # Compress-mode options "(b d t ${(j< >)levels} -c0 -c1 -c2 -hc)"${^levels} @@ -98,6 +98,11 @@ case $state in _message 'no more arguments' && ret=0 fi ;; + levels) + _wanted levels expl 'compression level' \ + compadd -o numeric - ${levels/#-/} \ + && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make index 21ed56184..ae91440f0 100644 --- a/Completion/Unix/Command/_make +++ b/Completion/Unix/Command/_make @@ -204,7 +204,7 @@ _make() { ;; (debug) - _values -s , 'debug options' \ + _values -s , 'debug option' \ '(b v i j m)a[all debugging output]' \ 'b[basic debugging output]' \ '(b)v[one level above basic]' \ diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 7d55201e3..dba1d13dc 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -6,7 +6,6 @@ # - We assume that Linux distributions are using either man-db or mandoc # - @todo Would be nice to support completing the initial operand as a section # name (on non-Solaris systems) -# - @todo We don't support the man-db syntax <name>.<section> (e.g., `ls.1`) # - @todo We don't support the man-db feature of 'sub-pages' — that is, treating # pairs of operands like `git diff` as `git-diff` # - @todo Option exclusivity isn't super accurate @@ -415,7 +414,7 @@ _man() { } _man_pages() { - local pages sopt + local pages sopt tmp # What files corresponding to manual pages can end in. local suf='.((?|<->*|ntcl)(|.gz|.bz2|.z|.Z|.lzma))' @@ -444,13 +443,20 @@ _man_pages() { # `POSIX.1.5'. [[ $variant = solaris* ]] && sopt='-s ' - if ((CURRENT > 1 || noinsert)) || - ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections - then - compadd "$@" - ${pages%$~suf} - else - compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf} + if ! ((CURRENT > 1 || noinsert)); then + zstyle -s ":completion:${curcontext}:manuals.$sect_dirname" insert-sections tmp fi + case "$tmp" in + prepend|true|on|yes|1) + compadd "$@" -P "$sopt$sect_dirname " - ${pages%$~suf} + ;; + suffix) + compadd "$@" -s ".$sect_dirname" - ${pages%$~suf} + ;; + *) + compadd "$@" - ${pages%$~suf} + ;; + esac } _man "$@" diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum index 3dfcd6322..e0de826a7 100644 --- a/Completion/Unix/Command/_md5sum +++ b/Completion/Unix/Command/_md5sum @@ -45,6 +45,9 @@ args+=( '(sum -w --status --warn)'{-w,--warn}'[warn about each improperly formatted checksum line]' ) # Operands -args+=( '*: :_files' ) +args+=( + + operand + '*: :_files' +) _arguments -s -S : $args diff --git a/Completion/Unix/Command/_module b/Completion/Unix/Command/_module index 2a4dba740..23cf0c589 100644 --- a/Completion/Unix/Command/_module +++ b/Completion/Unix/Command/_module @@ -85,7 +85,7 @@ _module_available_modules() { if [[ -n $MODULEPATH ]] && [[ ${+_available_modules} -eq 0 ]] then - _available_modules=(${$(find -L ${(e)=MODULEPATH//:/ } -type f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g'):#*\~}) + _available_modules=(${$(find -L ${(e)=MODULEPATH//:/ } -type f -print 2>/dev/null | grep -v \\.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g' -e 's,\.lua$,,g'):#*\~}) fi } diff --git a/Completion/Unix/Command/_moosic b/Completion/Unix/Command/_moosic index 54d768c8c..475a0c75c 100644 --- a/Completion/Unix/Command/_moosic +++ b/Completion/Unix/Command/_moosic @@ -216,7 +216,7 @@ _moosic_cmd_version() { _moosic_song_files() { _arguments -A '-*' $main_opts $filelist_opts $auto_opts \ - '*:song files:_files' + '*:song file:_files' } _moosic_cmd_append() { @@ -282,7 +282,7 @@ _moosic_cmd_stagger-merge() { _moosic_cmd_interval-add() { _arguments -A '-*' $main_opts $filelist_opts \ '1:interval:' \ - '*:song files:_files' + '*:song file:_files' } ### REMOVING COMMANDS diff --git a/Completion/Unix/Command/_mtr b/Completion/Unix/Command/_mtr index 806e344d1..9a73cfbd4 100644 --- a/Completion/Unix/Command/_mtr +++ b/Completion/Unix/Command/_mtr @@ -4,6 +4,7 @@ _arguments -s -S \ '(H -F --filename)'{-F,--filename}'[read hostnames from a file]' \ '(H -6)-4[use IPv4 only]' \ '(H -4)-6[use IPv6 only]' \ + '(H -I --interface)'{-I+,--interface=}'[use named network interface]: :_net_interfaces' \ '(H -a --address)'{-a+,--address=}'[bind outgoing packets to specific interface]:source IP:_hosts' \ '(H -f --first-ttl)'{-f+,--first-ttl=}'[specify TTL to start]:TTL [1]' \ '(H -m --max-ttl)'{-m+,--max-ttl=}'[specify maximum number of hops to probe]:hops [30]' \ @@ -17,7 +18,6 @@ _arguments -s -S \ '(H -Q --tos)'{-Q+,--tos=}'[specify type of service for IP header]:tos (0-255)' \ '(H -e --mpls)'{-e,--mpls}'[display ICMP MPLS information]' \ '(H -Z --timeout)'{-Z+,--timeout=}'[specify how long to keep probe sockets open before giving up on the connection]:timeout (seconds)' \ - '(H -M --mark)'{-M+,--mark=}'[mark each sent packet]:mark' \ '(H -r --report)'{-r,--report}'[report mode]' \ '(H -w --report-wide)'{-w,--report-wide}"[wide report mode\: don't truncate hostnames]" \ '(H -c --report-cycles)'{-c+,--report-cycles=}'[report cycles]:number of pings' \ diff --git a/Completion/Unix/Command/_mysql_utils b/Completion/Unix/Command/_mysql_utils index f1ad97bcd..9f70687b0 100644 --- a/Completion/Unix/Command/_mysql_utils +++ b/Completion/Unix/Command/_mysql_utils @@ -187,7 +187,7 @@ _mysqladmin() { _wanted databases expl "MySQL database" _mysql_databases && ret=0 ;; kill) - _message -e ids 'thread ids' + _message -e ids 'thread id' ;; password) _message -e passwords 'new password' @@ -220,8 +220,8 @@ _mysql_utils() { ) _mysql_variables_opts=( - '--max_allowed_packet[maximum allowed packet size]:packet size in bytes' - '--net_buffer_length[network buffer length]:buffer length in bytes' + '--max_allowed_packet[maximum allowed packet size]:packet size (bytes)' + '--net_buffer_length[network buffer length]:buffer length (bytes)' '--connect_timeout:timeout' '--select_limit:limit' '--max_join_size:size' diff --git a/Completion/Unix/Command/_mysqldiff b/Completion/Unix/Command/_mysqldiff index 4b46c86df..2515834e0 100644 --- a/Completion/Unix/Command/_mysqldiff +++ b/Completion/Unix/Command/_mysqldiff @@ -6,7 +6,7 @@ _mysqldiff () { {-p{,1,2},--password{,1,2}=}':server password: ' \ {-u{,1,2},--user{,1,2}=}':server username:_mysql_users' \ {-s{,1,2},--socket{,1,2}=}':server socket:_directories' \ - {-d,--debug=}':debugging level (default 1):(1 2 3 4 5 6 7 8)' \ + {-d,--debug=}':debugging level [1]:(1 2 3 4 5 6 7 8)' \ {-i,--tolerant}':ignore DEFAULT and formatting changes: ' \ {-k,--keep-old-tables}":don\'t output DROP TABLE commands: " \ {-n,--no-old-defs}"[don't output old defs as comments]" \ @@ -20,8 +20,8 @@ _mysqldiff () { _mysql_db_or_file () { _alternative \ - 'databases:MySQL databases:_mysql_databases' \ - 'files:MySQL database definition files:_files -g "*.(my|)sql(-.)"' + 'databases:MySQL database:_mysql_databases' \ + 'files:MySQL database definition file:_files -g "*.(my|)sql(-.)"' } _mysql_utils diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat index 94aa1688d..67133dc6c 100644 --- a/Completion/Unix/Command/_netstat +++ b/Completion/Unix/Command/_netstat @@ -5,10 +5,10 @@ local lopt='[show only listening sockets]' local zopt='-z[reset statistic counters after displaying them]' local popt='(-f)-p+[filter by protocol]:protocol:compadd -a plist' local Iopt='(-i)-I+[show information about the specified interface]:interface:_net_interfaces' -local set sel +local set sel tblopt local -A sets local -a Mopts families flist plist args sockets extend interval verbose -local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,routing,statistics,wireless} +local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,rdomains,routing,statistics,wireless} case $OSTYPE in linux-gnu) @@ -130,7 +130,7 @@ case $OSTYPE in ) routing=( $families ) sel_memory=( '-m[display statistics recorded by the memory management routines]' ) - sel_interfaces+=( '(1 -a -f -i -p -s)-w+[display packet traffic at intervals]:interval (seconds)' ) + sel_interfaces+=( '(1 -a -f -i -p -s -u)-w+[display packet traffic at intervals]:interval (seconds)' ) ;| darwin*|dragonfly*|(net|free)bsd*) interfaces+=( '-a[show multicast addresses currently in use]' ) @@ -266,13 +266,15 @@ case $OSTYPE in ) ;; openbsd*) - sets+=( wireless '-W*' ) + sets+=( wireless '-W*' rdomains '-R' ) + sel_rdomains=( '-R[show all rdomains with associated interfaces and routing tables]' ) sel_wireless=( '-W+[display per-interface IEEE 802.11 wireless statistics]:interface' ) flist+=( local mpls ) - sockets+=( -l$lopt '-B[show buffer sizes for TCP sockets]' ) - routing+=( + tblopt='-T+[select an alternate routing table to query]:routing table:_routing_tables' + sockets+=( -l$lopt $tblopt '-B[show buffer sizes for TCP sockets]' ) + routing+=( $Mopts $tblopt + '-A[show the internal addresses of the routing table]' '-F[only show routes with gateway in the same address family as the destination]' - '-T+[select an alternate routing table to query]:routing table' ) interfaces+=( '-c+[show specified number of updates, then exit]:count' @@ -280,7 +282,8 @@ case $OSTYPE in '-q[only show interfaces that have seen packets]' '-t[show current value of the watchdog timer function]' ) - statistics+=( $popt ) + statistics+=( $popt '-r[display routing statistics]' ) + groups+=( -n$nopt ) pcb+=( $Mopts $verbose ) ;; netbsd*) @@ -300,6 +303,12 @@ case $OSTYPE in memory+=( $Xopt) statistics+=( $Xopt ) pcb+=( $Mopts $popt ) ;; + freebsd<13->.*) + sockets+=( + '-c[show TCP stack used for each session]' + '-C[show TCP congestion control algorithm and diagnostic]' + ) + ;& freebsd<11->.*) routing+=( '-F+[show specified routing table]:routing table' ) bpf=( '-z[reset statistic counters after displaying them]' ) diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 423fd3223..888f1ef87 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -53,7 +53,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '(-C)--demangle[decode symbol names]' '(--format -P)-f+[specify output format]:format:(bsd sysv posix)' '(- *)--usage[give a short usage message]' - '(- *)-\\?[display help information]' + '(- *)-?[display help information]' ) ;; binutils) @@ -62,11 +62,12 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '!(--no-recurse-limit)--recurse-limit' '--no-recurse-limit[disable demangling recursion limit]' '(-f --format -P)-f+[specify output format]:format:(bsd sysv posix)' - '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)' + '(-C --no-demangle)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat rust dlang)' + '--ifunc-chars=[specify characters to use for indirect function symbols]:characters for global/local indirect function symbols [ii]' '--plugin[load specified plugin]:plugin' '--special-syms[include special symbols in the output]' '--synthetic[display synthetic symbols as well]' - "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" + "--target=[target object format]:target:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" '--with-symbol-versions[display version strings after symbol names]' ) ;; diff --git a/Completion/Unix/Command/_nmap b/Completion/Unix/Command/_nmap index b3d3d488a..2a507baa3 100644 --- a/Completion/Unix/Command/_nmap +++ b/Completion/Unix/Command/_nmap @@ -17,7 +17,7 @@ _arguments -C \ '-h[show help information]' \ '*-o-[log results]:log format:->log-forms:log filename:_files' \ '--resume[resume cancelled scan]:log filename:_files' \ - '--append_output[append results to any log files]' \ + '--append-output[append results to any log files]' \ '-iL[read target specifications from file]:file:_files' \ '-iR[scan random hosts]:num hosts' \ '-p[specify ports to try]:port numbers' \ @@ -26,24 +26,24 @@ _arguments -C \ '-S[specify source address]:address:_hosts' \ '-e[specify interface to use]:network interface:_net_interfaces' \ '-g[specify source port number]:port number' \ - '--data_length[add random data to packets]:data length' \ + '--data-length[add random data to packets]:data length' \ '(-R)-n[skip reverse DNS to speed things up]' \ '(-n)-R[always do reverse DNS on targets]' \ "-r[don't randomize order in which ports are scanned]" \ '-ttl[specify IPv4 time to live for sent packets]' \ - '--randomize_hosts[scan hosts in random order]' \ + '--randomize-hosts[scan hosts in random order]' \ '-M[specify maximum number of parallel TCP connects]:maximum TCP connects' \ - '--packet_trace[show all packets sent in tcpdump-like format]' \ - '--version_trace[show packets related to version scanning]' \ + '--packet-trace[show all packets sent in tcpdump-like format]' \ + '--version-trace[show packets related to version scanning]' \ '--datadir[specify directory containing data files]:directory:_directories' \ '-T[specify timing policy]:timing policy:(Paranoid Sneaky Polite Normal Aggressive Insane)' \ - '--host_timeout[specify maximum time for scanning a single host]:timeout (ms)' \ - '--max_rtt_timeout[maximum time for a probe response]:timeout (ms)' \ - '--min_rtt_timeout[minimum time to wait for a probe response]:time (ms)' \ - '--initial_rtt_timeout[specify initial probe timeout]:timeout (ms)' \ - '--max_parallelism[specify max number of scans to perform in parallel]:number' \ - '--min_parallelism[scan at least specified number of ports in parallel]:number' \ - '--scan_delay[specify minimum amount of time between probes]:delay (ms)' \ + '--host-timeout[specify maximum time for scanning a single host]:timeout (ms)' \ + '--max-rtt-timeout[maximum time for a probe response]:timeout (ms)' \ + '--min-rtt-timeout[minimum time to wait for a probe response]:time (ms)' \ + '--initial-rtt-timeout[specify initial probe timeout]:timeout (ms)' \ + '--max-parallelism[specify max number of scans to perform in parallel]:number' \ + '--min-parallelism[scan at least specified number of ports in parallel]:number' \ + '--scan-delay[specify minimum amount of time between probes]:delay (ms)' \ '--interactive[go into interactive mode]' \ '*:host:_hosts' && ret=0 diff --git a/Completion/Unix/Command/_objdump b/Completion/Unix/Command/_objdump index 989cd3f0b..e2dde7e4c 100644 --- a/Completion/Unix/Command/_objdump +++ b/Completion/Unix/Command/_objdump @@ -67,7 +67,8 @@ case $variant in '(-z --disassemble-zeroes)'{-z,--disassemble-zeroes}"[don't skip blocks of zeroes when disassembling]" '--start-address=[only process data whose address is >= ADDR]:address' - '--stop-address=[only process data whose address is <= ADDR]:address' + '--stop-address=[only process data whose address is < ADDR]:address' + "--no-addresses[don't print address alongside disassembly]" '--prefix-addresses[print complete address alongside disassembly]' '(--show-raw-insn --no-show-raw-insn)'--{,no-}show-raw-insn'[display hex alongside symbolic disassembly]' '--insn-width=[display specified number of bytes on a single line with -d]:width (bytes)' @@ -80,6 +81,7 @@ case $variant in '--dwarf-start=[display DIEs at specified or deeper depth]:depth' '--dwarf-check[perform additional dwarf internal consistency checks]' '--ctf-parent=[use specified section as the CTF parent]:section' + '--visualize-jumps=-[visualize jumps by drawing ASCII art lines]::color:(color extended-color off)' ) ;; elfutils) @@ -165,6 +167,7 @@ case "$state" in _values -s "" "dwarf section" \ "l[rawline]" "L[decodedline]" "i[info]" "a[abbrev]" "p[pubnames]" \ "r[aranges]" "m[macro]" "f[frames]" "F[frames-interp]" "s[str]" \ + 'O[str-offsets]' \ "o[loc]" "R[ranges]" "t[pubtypes]" "U[trace_info]" "u[trace_abbrev]" \ "T[trace_aranges]" "g[gdb_index]" "A[addr]" "c[cu_index]" "k[links]" \ "K[follow-links]" && ret=0 @@ -172,7 +175,7 @@ case "$state" in dwarf-names) _sequence _wanted dwarf-sections expl "dwarf section" compadd - \ rawline decodedline info abbrev pubnames aranges macro frames \ - frames-interp str loc Ranges pubtypes gdb_index trace_info \ + frames-interp str str-offsets loc Ranges pubtypes gdb_index trace_info \ trace_abbrev trace_aranges addr cu_index links follow-links && ret=0 ;; bfdnames) @@ -184,7 +187,7 @@ case "$state" in ${=${(M)${(f)"$(_call_program targets objdump --help)"}##* supported architectures:*}##*: } && ret=0 ;; disassembler_options) - _values -s , "disassembler options" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0 + _values -s , "disassembler option" "${(@)${(@)${(@M)${(f)${(ps.-M switch.)$(_call_program targets objdump --help)}[2]}:# [^ ]*}# }%% *}" && ret=0 ;; llvm_targets) _values "target architecture" "${(z)${(@)${(f)$(_call_program targets diff --git a/Completion/Unix/Command/_openstack b/Completion/Unix/Command/_openstack index fcb704ac8..d55686b80 100644 --- a/Completion/Unix/Command/_openstack +++ b/Completion/Unix/Command/_openstack @@ -34,8 +34,6 @@ if (( ! $+_cache_openstack_clnt_opts )); then typeset -gA _cache_openstack_clnt_opts typeset -gA _cache_openstack_clnt_cmds typeset -gA _cache_openstack_clnt_cmds_opts - typeset -gA _cache_openstack_clnt_cmds_subcmds - typeset -gA _cache_openstack_clnt_cmds_subcmd_opts fi local -a conn_opts @@ -61,65 +59,78 @@ if [[ -n ${clnts_compl_new[(r)$service]} ]]; then # Populate caches - clnt_outputs is command raw output used later _cache_openstack_clnt_outputs[$service]=${:-"$($service ${(Q)conn_opts} complete 2>/dev/null)"} _cache_openstack_clnt_opts[$service]=${${${${(M)${${${${=${(f)"$($service help 2>/dev/null)"}}/\[}/\]}/\;}:#-[-0-9A-Za-z]*}/,}/\.}%--os-} - _cache_openstack_clnt_cmds[$service]=${${${${_cache_openstack_clnt_outputs[$service]}/* cmds=\'}/\'*}/complete} fi - local cmd subcmd - # Determine the command - for word in ${words:1}; do - local s=${_cache_openstack_clnt_cmds[$service]} - [[ $s[(wI)$word] -gt 0 ]] && cmd=$word && break - done - # Populate the subcommand cache - if [[ -n $cmd && -z $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]]; then - local t=cmds_${cmd//-/_} - _cache_openstack_clnt_cmds_subcmds[$service$cmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*} + + # get worlds left of the curser into an array + local -a left_words + left_words=(${=LBUFFER}) + + # if curser is directly at a word (no space at the end), + # exclude the last word to offer right matches + # the last word could be a partial match that is later checked (prefix-needed) + local partial="" + if [[ "${LBUFFER[-1]}" != " " ]]; then + partial=${(@)left_words[-1]} + left_words=(${(@)left_words[1,$#left_words-1]}) fi - # Determine the subcommand - if [[ -n $cmd ]]; then - for word in ${words:2}; do - local s=${_cache_openstack_clnt_cmds_subcmds[$service$cmd]} - [[ $s[(wI)$word] -gt 0 ]] && subcmd=$word && break - done - # Populate subcommand option cache - if [[ -n $subcmd && -z $_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd] ]]; then - local t=cmds_${cmd//-/_}_${subcmd//-/_} - _cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*} - fi + # remove $service + left_words=(${left_words:1}) + + # filter out "help" + if [[ $left_words[1] == help ]]; then + left_words=(${(@)left_words[2,$#left_words]}) fi - # Special treatment for the help command - if [[ $cmd == help ]]; then - if [[ $words[CURRENT-1] == $cmd && $words[CURRENT] != -* ]]; then - # Offer commands - [[ -n $_cache_openstack_clnt_cmds[$service] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds[$service]} && ret=0 - elif [[ $words[CURRENT-2] == $cmd && $words[CURRENT-1] != -* && $words[CURRENT] != -* ]]; then - # Offer subcommands - local cmd=$words[CURRENT-1] - local t=cmds_${cmd//-/_} - [[ -z $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _cache_openstack_clnt_cmds_subcmds[$service$cmd]=${${${_cache_openstack_clnt_outputs[$service]}/* $t=\'}/\'*} - [[ -n $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmds[$service$cmd]} && ret=0 - else - # Handle help<TAB> properly - _values -w option help && ret=0 - fi - # Client options - elif [[ -z $cmd && $words[CURRENT] == -* ]]; then - _values -w option ${(u)=_cache_openstack_clnt_opts[$service]} && ret=0 - # Commands - elif [[ -z $cmd ]]; then - if [[ -z $_cache_openstack_clnt_cmds[$service] ]]; then - _message "missing authentication options" + + # filter out options (-*) + left_words=(${left_words//-*}) + + local -a subcmd_array cmds_array cache_key_array cache_values + subcmd_array=() + cmds_array=(cmds) + cache_key_array=(${service}) + cache_values=() + local cache_key cmds + cache_key="" + cmds="" + + # Check for matches one level at a time + # example: "" server create + for word in "" ${(@)left_words}; do # first loop second loop third loop + subcmd_array=(${(@)subcmd_array} ${word}) # () (server) (server create) + cmds_array=(${(@)cmds_array} ${word}) # (cmds) (cmds server) (cmds server create) + cmds=${${(j:_:)cmds_array}/-/_} # cmds cmds_openstack cmds_server_create + cache_key_array=(${(@)cache_key_array} ${word}) # (openstack) (openstack server) (openstack server create) + cache_key=${${(j:_:)cache_key_array}/-/_} # openstack openstack_server openstack_server_create + + # lookup if current word is in cache_values of last elements + if [[ ${cache_values[(wI)${word}]} -gt 0 || $word == "" ]]; then + _cache_openstack_clnt_cmds[${cache_key}]=${${${_cache_openstack_clnt_outputs[${service}]}/* ${cmds}=\'}/\'*} else - _values -w option ${(u)=_cache_openstack_clnt_cmds[$service]} && ret=0 + # unknown word: set cache_key to last cache_key and break + cache_key=${${(j:_:)${cache_key_array:0:${#cache_key_array}-1}}/-/_} + break fi - # Subcommands - elif [[ -z $subcmd ]]; then - [[ -n $_cache_openstack_clnt_cmds_subcmds[$service$cmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmds[$service$cmd]} && ret=0 - # Subcommand options + # set cache_values for next loop + cache_values=${_cache_openstack_clnt_cmds[${cache_key}]} + done + + # Populate the command cache + if [[ -z $_cache_openstack_clnt_cmds[${cache_key}] ]]; then + _message "missing authentication options" else - { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ -prefix - ]] } && \ - [[ -n $_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd] ]] && _values -w option ${(u)=_cache_openstack_clnt_cmds_subcmd_opts[$service${cmd}--$subcmd]//\:/\\\:} && ret=0 + # add global options to completion list if current word start with -* + local extra_opts + if [[ $words[CURRENT] == -* ]]; then; + extra_opts=${_cache_openstack_clnt_opts[$service]} + fi + + { ! zstyle -T ":completion:${curcontext}:options" prefix-needed \ + || [[ -n "${partial}" && ${${_cache_openstack_clnt_cmds[${cache_key}]}[(Iw)${partial}*]} -gt 0 || -prefix - ]] } \ + && _values -w option ${(u)=_cache_openstack_clnt_cmds[${cache_key}]} ${(u)=extra_opts} \ + && ret=0 fi + # Old style clients elif [[ -n ${clnts_compl_old[(r)$service]} ]]; then if [[ -z $_cache_openstack_clnt_cmds[$service] ]]; then diff --git a/Completion/Unix/Command/_opustools b/Completion/Unix/Command/_opustools new file mode 100644 index 000000000..1fd97798a --- /dev/null +++ b/Completion/Unix/Command/_opustools @@ -0,0 +1,71 @@ +#compdef opusenc opusdec opusinfo + +case $service in + opusenc) + _arguments -S \ + '1:input file:_files -g "*.(#i)(wav|flac|ogg|aif(|f))(-.)"' \ + '2:output file:_files -g "*.(#i)opus(-.)"' \ + '(- 1 *)'{-h,--help}'[show usage information]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(- 1 *)--help-picture[show help on attaching album art]' \ + '--quiet[enable quiet mode]' \ + '--bitrate[set target bitrate per channel]:target bitrate per channel (kbps) (6-256)' \ + '--comp[set encoding complexity]:encoding complexity (1-10) [10]:(1 2 3 4 5 6 7 8 9 10)' \ + '--cvbr[use constrained variable bitrate encoding]' \ + '--downmix-mono[downmix to mono]' \ + '--downmix-stereo[downmix to stereo (if >2 channels)]' \ + '--expect-loss[set expected packet loss]:expected packet loss (%%) (0-100) [0]' \ + '--framesize[set maximum frame size]:maximum frame size (milliseconds) [20]:(2.5 5 10 20 40 60)' \ + '--hard-cbr[use hard constant bitrate encoding]' \ + '--max-delay[set maximum container delay]:maximum container delay (milliseconds) (0-1000) [1000]' \ + '--music[tune low bitrates for music (override automatic detection)]' \ + '--no-phase-inv[disable use of phase inversion for intensity stereo]' \ + '--speech[tune low bitrates for speech (override automatic detection)]' \ + '--vbr[use variable bitrate encoding (default)]' \ + '--album[set album or collection]:album or collection' \ + '--date[set date of track]:date of track (YYYY, YYYY-MM, or YYYY-MM-DD):_dates -f "%F"' \ + '--discard-comments[discard metadata when transcoding]' \ + '--discard-pictures[discard pictures when transcoding]' \ + '--padding[reserve extra bytes for metadata]:padding size (bytes) [512]' \ + '--title[set track title]:track title' \ + '--tracknumber[set track number]:track number' \ + '*--artist[add artist or author]:artist or author' \ + '*--comment[add an extra comment]:comment (tag=val)' \ + '*--genre[add genre]:genre' \ + '*--picture[attach album art]:album art:_files -g "*.(#i)(jp(|e)g|png|gif)(-.)"' \ + '--ignorelength[ignore the data length in RIFF wav headers]' \ + '--raw-bits[set bits per sample for raw input]:bits per sample [16]:(8 16 24)' \ + '--raw-chan[set number of channels for raw input]:number of channels (1-255) [2]' \ + '--raw-endianness[set endianness for raw input]:endianness:(("0"\:"big endian" "1"\:"little endian"))' \ + '--raw-rate[set sampling rate for raw input]:sample rate (Hz) (100-768000) [48000]' \ + '--raw[interpret input as raw PCM data without headers]' \ + '--serial[force use of a specific stream serial number]:stream serial number' \ + '--save-range[save check values for every frame to a file]:output for check values:_files' \ + '--set-ctl-int[pass encoder control]:encoder control' + ;; + opusdec) + _arguments -S \ + '1:input file:_files -g "*.(#i)opus(-.)"' \ + '2::output file:_files -g "*.(#i)wav(-.)"' \ + '(- 1 *)'{-h,--help}'[show usage information]' \ + '(- 1 *)'{-V,--version}'[show version information]' \ + '(- 1 *)--help-picture[show help on attaching album art]' \ + '--quiet[enable quiet mode]' \ + '--rate[force decoding at given sample rate]:sample rate (Hz) (8000-192000)' \ + '--force-stereo[force decoding to stereo]' \ + '--gain[adjust output volume]:gain (dB) (negative is quieter)' \ + '--no-dither[do not dither 16-bit output]' \ + '--float[output 32-bit floating-point samples]' \ + '--force-wav[force RIFF wav header on output]' \ + '--packet-loss[simulate random packet loss]:packet loss probability (%%) (0-100)' \ + '--save-range[save check values for every frame to a file]:output for check values:_files' + ;; + opusinfo) + _arguments -s -S \ + '(- 1 *)-h[show usage information]' \ + '(- 1 *)-V[show version information]' \ + '*-q[make the output quieter]' \ + '*-v[make the output more verbose]' \ + '*:opus file:_files -g "*.(#i)opus(-.)"' + ;; +esac diff --git a/Completion/Unix/Command/_pandoc b/Completion/Unix/Command/_pandoc index 29d3724e0..b0fff80d6 100644 --- a/Completion/Unix/Command/_pandoc +++ b/Completion/Unix/Command/_pandoc @@ -1,130 +1,40 @@ #compdef pandoc -# {{{ helper: cache policy for available formats and other variables -(( $+functions[__pandoc_cache_policy] )) || -__pandoc_cache_policy(){ - local cache_file="$1" - if [[ -f "${commands[pandoc]}" && -f "${cache_file}" ]]; then - # if the manifest file is newer then the cache: - if [[ "${commands[pandoc]}" -nt "${cache_file}" ]]; then - return 0 - else - return 1 - fi +# input or output formats with optional extensions +# required option: -T (input|output) +(( $+functions[_pandoc_format] )) || +_pandoc_format() { + local -a inout expl + zparseopts -D -E - T:=inout + local format=${PREFIX%%(+|-)*} + if compset -P '*(+|-)'; then + local pm=${IPREFIX[-1]} # '+' or '-' + local -a extensions=(${${$(pandoc --list-extensions=$format):#$pm*}#(+|-)}) + _wanted extensions expl 'extension' compadd -S '+' -r '-+ ' -a extensions else - return 0 + local -a formats=( $(pandoc --list-$inout[2]-formats) ) + _wanted formats expl 'format' compadd -S '+' -r '-+ ' -a formats fi } -# }}} -# {{{ choose a format among supported output format -(( $+functions[_pandoc_output_format] )) || -_pandoc_output_format(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_output_formats_simple; then - output_formats_simple=($(pandoc --list-output-formats)) - _store_cache pandoc_output_formats_simple output_formats_simple - else - _retrieve_cache pandoc_output_formats_simple - fi - if _cache_invalid pandoc_output_formats_plus_extensible || _cache_invalid pandoc_output_formats_minus_extensible; then - for f in ${output_formats_simple[*]}; do - for e in $(pandoc --list-extensions=${f}); do - if [[ "${e}" =~ '^\+' ]]; then - output_formats_plus_extensible+=("${f}${e}") - elif [[ "${e}" =~ '^\-' ]]; then - output_formats_minus_extensible+=("${f}${e}") - fi - done - done - _store_cache pandoc_output_formats_minus_extensible output_formats_minus_extensible - _store_cache pandoc_output_formats_plus_extensible output_formats_plus_extensible - else - _retrieve_cache pandoc_output_formats_minus_extensible - _retrieve_cache pandoc_output_formats_plus_extensible - fi - _alternative \ - 'formats_plus:format:{_multi_parts "+" output_formats_plus_extensible}' \ - 'formats_minus:format:{_multi_parts -- "-" output_formats_minus_extensible}' -} -# }}} -# {{{ choose a format among supported input format -(( $+functions[_pandoc_input_format] )) || -_pandoc_input_format(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_input_formats_simple; then - input_formats_simple=($(pandoc --list-input-formats)) - _store_cache pandoc_input_formats_simple input_formats_simple - else - _retrieve_cache pandoc_input_formats_simple - fi - if _cache_invalid pandoc_input_formats_plus_extensible || _cache_invalid pandoc_input_formats_minus_extensible; then - for f in ${input_formats_simple[*]}; do - for e in $(pandoc --list-extensions=${f}); do - if [[ "${e}" =~ '^\+' ]]; then - input_formats_plus_extensible+=("${f}${e}") - elif [[ "${e}" =~ '^\-' ]]; then - input_formats_minus_extensible+=("${f}${e}") - fi - done - done - _store_cache pandoc_input_formats_minus_extensible input_formats_minus_extensible - _store_cache pandoc_input_formats_plus_extensible input_formats_plus_extensible - else - _retrieve_cache pandoc_input_formats_minus_extensible - _retrieve_cache pandoc_input_formats_plus_extensible - fi - _alternative \ - 'formats_plus:format:{_multi_parts "+" input_formats_plus_extensible}' \ - 'formats_minus:format:{_multi_parts -- "-" input_formats_minus_extensible}' -} -# }}} -# {{{ choose a format among all supported formats + +# all supported formats (( $+functions[_pandoc_all_formats] )) || _pandoc_all_formats(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_input_formats_simple; then - input_formats_simple=($(pandoc --list-input-formats)) - _store_cache pandoc_input_formats_simple input_formats_simple - else - _retrieve_cache pandoc_input_formats_simple - fi - if _cache_invalid pandoc_output_formats_simple; then - output_formats_simple=($(pandoc --list-output-formats)) - _store_cache pandoc_output_formats_simple output_formats_simple - else - _retrieve_cache pandoc_output_formats_simple - fi - if _cache_invalid pandoc_all_formats; then - all_formats=(${output_formats_simple} ${input_formats_simple}) - all_formats=($(sort -u <<<"${all_formats[*]}")) - _store_cache pandoc_all_formats all_formats - else - _retrieve_cache pandoc_all_formats - fi - _describe "format" all_formats + local -a expl + local -aU formats + formats=( $(pandoc --list-input-formats) $(pandoc --list-output-formats) ) + _wanted formats expl 'format' compadd -a formats } -# }}} -# {{{ pdf engine choice + +# pdf engine choice (( $+functions[_pandoc_pdf_engine] )) || _pandoc_pdf_engine(){ _alternative \ - 'engines:engine:{_values "engine" pdflatex lualatex xelatex wkhtmltopdf weasyprint prince context pdfroff}' \ - 'engine_files:engine:_files' + 'engines:engine:(pdflatex lualatex xelatex latexmk tectonic wkhtmltopdf weasyprint prince context pdfroff)' \ + 'engine-executables:engine executable:_files -g "*(#q*)"' } -# }}} -# {{{ options to pass to --pdf-engine command + +# options to pass to --pdf-engine command (( $+functions[_pandoc_pdf_engine_opts] )) || _pandoc_pdf_engine_opts(){ local pdf_engine=${opt_args[--pdf-engine]} @@ -133,123 +43,75 @@ _pandoc_pdf_engine_opts(){ _tex ;; *) - type _${pdf_engine} > /dev/null - if [[ $? == 1 ]]; then - _message "Options for ${pdf_engine}" - fi + _message "Options for ${pdf_engine}" ;; esac } -# }}} -# {{{ choose data-dir -(( $+functions[_pandoc_data_dir] )) || -_pandoc_data_dir(){ - _files -/ + +# data-dir specified by --data-dir option, or the default dir +_pandoc_default_dir() { + if (( $+opt_args[--data-dir] )); then + echo ${opt_args[--data-dir]:a} + else + # XXX Some versions of pandoc may output two user data directories: + # ~/.local/share/pandoc or ~/.pandoc + # Here we use only the first one. + pandoc --version | sed -ne 's/.*[Uu]ser data directory: \([^ ]*\).*/\1/p' + fi } -# }}} -# {{{ choose template from data-dir + +# template file in $PWD or data-dir/templates/, or URL (( $+functions[_pandoc_template] )) || _pandoc_template(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_output_formats_simple; then - output_formats_simple=($(pandoc --list-output-formats)) - _store_cache pandoc_output_formats_simple output_formats_simple - else - _retrieve_cache pandoc_output_formats_simple - fi - local data_dir=${opt_args[--data-dir]} - if [[ -z $data_dir ]]; then - if _cache_invalid pandoc_default_data_dir; then - default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') - _store_cache pandoc_default_data_dir default_data_dir - else - _retrieve_cache pandoc_default_data_dir - fi - data_dir=${default_data_dir} - fi - _pandoc_template_find_args="-name '*.'${output_formats_simple[1]}" - for ((i = 2; i < ${#output_formats_simple[@]}; i++ )); do - _pandoc_template_find_args=$_pandoc_template_find_args" -or -name '*.'${output_formats_simple[$i]}" - done - templates=($(eval find -L ${data_dir}/templates ${_pandoc_template_find_args} 2>/dev/null | sed -e 's/.*\///' -e 's/\.[^.]*$//')) - if [[ -z "${templates}" ]]; then - templates=default - fi - _describe 'templates from default data-dir' templates + # find output format from '-t format' or '-o xxx.format' + local format=${${(v)opt_args[(i)(-t|--to|-w|--write)]}%%(+|-)*} + [[ -z $format ]] && format=${(v)opt_args[(i)(-o|--output)]:e} + local pat="'*'" # or '*.*' ? + [[ -n $format ]] && pat="'*.$format(-.)'" + local template_dir=$(_pandoc_default_dir)/templates + _alternative \ + "local-templates:local template:_files -g $pat" \ + "data-dir-templates:template in data-dir:_files -W $template_dir -g $pat" \ + 'urls: :_urls' } -# }}} -# {{{ choose highlight-style + +# choose highlight-style (( $+functions[_pandoc_highlight_style] )) || _pandoc_highlight_style(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - if _cache_invalid pandoc_highlighting_styles; then - highlighting_styles=($(pandoc --list-highlight-styles)) - _store_cache pandoc_highlighting_styles highlighting_styles - else - _retrieve_cache pandoc_highlighting_styles - fi _alternative \ - 'styles:style:{_values "syntax builting style" ${highlighting_styles[*]}}' \ - 'style_files_here:style:{_files -g "*.theme"}' + 'styles:style:( $(pandoc --list-highlight-styles) )' \ + 'style-files:style file:_files -g "*.theme(-.)"' } -# }}} -# {{{ choose filter from specified or default data-dir + +# filter file in $PWD, data-dir/filters/ or $PATH (( $+functions[_pandoc_filter] )) || _pandoc_filter(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - local data_dir=${opt_args[--data-dir]} - if [[ -z $data_dir ]]; then - if _cache_invalid pandoc_default_data_dir; then - default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') - _store_cache pandoc_default_data_dir default_data_dir - else - _retrieve_cache pandoc_default_data_dir - fi - data_dir=${default_data_dir} - fi - local filters_dir=$data_dir"/filters" + local filters_dir=$(_pandoc_default_dir)/filters _alternative \ - 'local_filter:filter:{_files -g "*.lua"}' \ - 'data_dir_filter:filter:{_files -W filters_dir -g "*.lua"}' + 'local-filters:local filter:_files' \ + 'data-dir-filters:filter in data-dir:_files -W filters_dir' \ + 'commands: : _command_names -e' } -# }}} -# {{{ choose lua filter from specified or default data-dir + +# lua filter in $PWD or data-dir/filters/ (( $+functions[_pandoc_lua_filter] )) || _pandoc_lua_filter(){ - local update_policy - zstyle -s ":completion:${curcontext}:" cache-policy update_policy - if [[ -z "$update_policy" ]]; then - zstyle ":completion:${curcontext}:" cache-policy __pandoc_cache_policy - fi - local data_dir=${opt_args[--data-dir]} - if [[ -z $data_dir ]]; then - if _cache_invalid pandoc_default_data_dir; then - default_data_dir=$(pandoc --version | sed -ne 's/Default user data directory: \(.*\)/\1/p') - _store_cache pandoc_default_data_dir default_data_dir - else - _retrieve_cache pandoc_default_data_dir - fi - data_dir=${default_data_dir} - fi - local filters_dir=$data_dir"/filters" + local filters_dir=$(_pandoc_default_dir)/filters _alternative \ - 'local_filter:filter:{_files -g "(#q*)(.)"}' \ - 'data_dir_filter:filter:{_files -W filters_dir -g "(#q*)(.)"}' - } -# }}} -# {{{ choose reference location + 'local-filters:local filter:_files -g "*.lua(-.)"' \ + 'data-dir-filters:filter in data-dir:_files -W filters_dir -g "*.lua(-.)"' +} + +# default file in $PWD or data-dir/defaults/ +(( $+functions[_pandoc_defaults_file] )) || +_pandoc_defaults_file() { + local defaults_dir=$(_pandoc_default_dir)/defaults + _alternative \ + 'local-defaults:default file:_files -g "*.yaml(-.)"' \ + 'data-dir-defaults:default in data-dir:_files -W defaults_dir -g "*.yaml(-.)"' +} + +# choose reference location (( $+functions[_pandoc_reference_location] )) || _pandoc_reference_location(){ local -a policies @@ -260,49 +122,38 @@ _pandoc_reference_location(){ ) _describe 'location' policies } -# }}} -# --base-header-level must be 1-5: https://github.com/jgm/pandoc/blob/34d8ffbcfc33b86766ff7229be4d8a0d1fbffb50/src/Text/Pandoc/App.hs#L867 -# {{{ choose top level division + +# choose top level division (( $+functions[_pandoc_top_level_division] )) || _pandoc_top_level_division(){ _values 'top level division' default section chapter part } -# }}} -# {{{ choose header levels -(( $+functions[_pandoc_header_levels] )) || -_pandoc_header_levels(){ - _values -s , "number" 1 2 3 4 5 6 -} -(( $+functions[_pandoc_header_level] )) || -_pandoc_header_level(){ - _values "number" 1 2 3 4 5 6 -} -# }}} -# {{{ choose email obfusication + +# choose email obfusication (( $+functions[_pandoc_email_obfusication] )) || _pandoc_email_obfusication(){ local -a policies policies=( - 'none:(default) leaves mailto: links as they are' + 'none:leave mailto: links as they are' 'javascript:obfuscates them using JavaScript' 'references:obfuscates them by printing their letters as decimal or hexadecimal character references' ) - _describe 'obfusication' policies + _describe 'obfuscation policy [none]' policies } -# }}} -# {{{ choose wrapping policy + +# choose wrapping policy (( $+functions[_pandoc_wrap] )) || _pandoc_wrap() { local -a policies policies=( - 'auto:(default) wrap lines to the column width specified by --columns (default 72)' + 'auto:wrap lines to the column width specified by --columns (default 72)' "none:don't wrap lines at all" 'preserve:attempt to preserve the wrapping from the source document' ) - _describe 'policy' policies + _describe 'policy [auto]' policies } -# }}} -# {{{ choose eol policy + +# choose eol policy (( $+functions[_pandoc_eol] )) || _pandoc_eol() { local -a policies @@ -313,105 +164,107 @@ _pandoc_eol() { ) _describe 'policy' policies } -# }}} -# {{{ choose changes tracking policy + +# choose changes tracking policy (( $+functions[_pandoc_track_changes] )) || _pandoc_track_changes() { local -a policies policies=( - 'accept:(default) inserts all insertions, and ignores all deletions' + 'accept:insert all insertions, and ignore all deletions' 'reject:inserts all deletions and ignores insertions' 'all:puts in insertions, deletions, and comments, wrapped in spans with insertion, deletion, comment-start, and comment-end classes, respectively' ) - _describe 'policy' policies + _describe 'policy [accept]' policies } -# }}} # The real thing -_arguments -C \ - {-f,-r,--from=,--read=}'[specify input format]:format:_pandoc_input_format' \ - {-t,-w,--to=,--write=}'[specify output format]:format:_pandoc_output_format' \ - {-o,--output=}'[write output to FILE instead of stdout]:file:_files' \ - '--data-dir=[specify the user data directory to search for pandoc data files]:dir:_pandoc_data_dir' \ - '--base-header-level=[specify the base level for headers (defaults to 1)]:number:_pandoc_header_level' \ - '--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]: :' \ - '--indented-code-classes=[classes to use for indented code blocks]:class:{_message "Classes separated with ,"}' \ - '*--filter=[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]:file:_pandoc_filter' \ - '*--lua-filter=[transform the document in a similar fashion as JSON filters (see --filter), but use pandoc'"'"'s built-in lua filtering system]:file:_pandoc_lua_filter' \ - {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]: :' \ - '--tab-stop=[specify the number of spaces per tab (default is 4)]:number:{_message -r "choose a number equals to or greater then 1"}' \ +_arguments -s \ + {-f+,-r+,--from=,--read=}'[specify input format]: :_pandoc_format -T input' \ + {-t+,-w+,--to=,--write=}'[specify output format]: :_pandoc_format -T output' \ + {-o+,--output=}'[write output to FILE instead of stdout]:file:_files' \ + '--data-dir=[specify the user data directory to search for pandoc data files]:data directory:_files -/' \ + {-d+,--defaults=}'[read default from YAML file]: :_pandoc_defaults_file' \ + '--shift-heading-level-by=[shift heading levels by specified number]:positive or negative integer: ' \ + '!--base-header-level=:number [1]:(1 2 3 4 5)' \ + '!--strip-empty-paragraphs[deprecated. Use the +empty_paragraphs extension instead]' \ + '--indented-code-classes=[classes to use for indented code blocks]:class list (comma-separated)' \ + '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \ + '--file-scope[parse each file individually before combining for multifile documents]' \ + {\*-F+,\*--filter=}'[specify an executable to be used as a filter transforming the pandoc AST after the input is parsed and before the output is written]: :_pandoc_filter' \ + {\*-L+,\*--lua-filter=}"[transform the document by using pandoc's built-in lua filtering system]: :_pandoc_lua_filter" \ + {\*-M+,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \ + '*--metadata-file=[read metadata from file]:YAML or JSON file:_files' \ + {-p,--preserve-tabs}'[preserve tabs instead of converting them to spaces]' \ + '--tab-stop=[specify the number of spaces per tab]:spaces [4]' \ '--track-changes=[specifies what to do with insertions, deletions, and comments produced by the MS Word "Track Changes" feature]: :_pandoc_track_changes' \ - '--file-scope[parse each file individually before combining for multifile documents]: :' \ - '--extract-media=[extract images and other media contained in or linked from the source document to the path DIR]:dir:{_dir_list}' \ - {-s,--standalone}'[produce output with an appropriate header and footer]: :' \ + '--extract-media=[extract media in source document to specified directory]:directory:_files -/' \ + '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \ + {-s,--standalone}'[produce output with an appropriate header and footer]' \ '--template=[use FILE as a custom template for the generated document. Implies --standalone]: :_pandoc_template' \ - {\*-M,\*--metadata=}'[set the metadata field KEY to the value VALUE]:key\:value: ' \ - {\*-V,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \ - '(- :)'{-D,--print-default-template=}'[print the system default template for an output]:format:_pandoc_output_format' \ + {\*-V+,\*--variable=}'[set the variable KEY to the value VALUE]:key\:value: ' \ + '(- :)'{-D+,--print-default-template=}'[print the system default template for an output]:format:( $(pandoc --list-output-formats) )' \ '(- :)--print-default-data-file=[print a system default data file]:file: ' \ - '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]:style|file: ' \ - '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \ '--eol=[manually specify line endings (crlf|lf|native)]: :_pandoc_eol' \ + '--dpi=[specify the dpi (dots per inch) value for conversion from pixels to inch/centimeters and vice versa]:number: ' \ '--wrap=[determine how text is wrapped in the output (the source code, not the rendered version)]: :_pandoc_wrap ' \ - '--columns=[specify length of lines in characters (default 72)]:number: ' \ - '--strip-comments[strip out HTML comments in the Markdown or Textile source]: : ' \ - {--toc,--table-of-contents}'[include an automatically generated table of contents]: : ' \ - '--toc-depth=[specify the number of section levels to include in the table of contents]:number:{_message -r "choose a number equals to or greater then 1"}' \ - '--no-highlight[disables syntax highlighting for code blocks and inlines]: : ' \ + '--columns=[specify length of lines in characters]:length [72]' \ + {--toc,--table-of-contents}'[include an automatically generated table of contents]' \ + '--toc-depth=[specify the number of section levels to include in the table of contents]:number' \ + '--strip-comments[strip out HTML comments in the Markdown or Textile source]' \ + '--no-highlight[disables syntax highlighting for code blocks and inlines]' \ '--highlight-style=[specifies the coloring style to be used in highlighted source code]:style|file:_pandoc_highlight_style' \ - '--syntax-definition=[load a KDE XML syntax definition file]:file:{_files -g "*.xml"}' \ - {\*-H,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \ - {\*-B,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \ - {\*-A,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \ + '(- :)--print-highlight-style=[prints a JSON version of a highlighting style]: :_pandoc_highlight_style' \ + '--syntax-definition=[load a KDE XML syntax definition file]:file:_files -g "*.xml(-.)"' \ + {\*-H+,\*--include-in-header=}'[include contents of FILE, verbatim, at the end of the header, implies --standalone]:file:_files' \ + {\*-B+,\*--include-before-body=}'[include contents of FILE, verbatim, at the beginning of the document body, implies --standalone]:file:_files' \ + {\*-A+,\*--include-end-body=}'[include contents of FILE, verbatim, at the end of the document body, implies --standalone]:file:_files' \ '--resource-path=[list of paths to search for images and other resources]:searchpath:_dir_list' \ '--request-header=[set the request header NAME to the value VAL when making HTTP requests]:name\:val: ' \ - '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]: : ' \ - '--html-q-tags[use <q> tags for quotes in HTML]: : ' \ - '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]: : ' \ - '--reference-links[use reference-style links, rather than inline links]: : ' \ + '--no-check-certificate[disable the certificate verification]' \ + '--self-contained[produce a standalone HTML file with no external dependencies, using data: URIs to incorporate the contents of linked scripts, stylesheets, images, and videos. Implies --standalone]' \ + '--html-q-tags[use <q> tags for quotes in HTML]' \ + '--ascii[use only ASCII characters in output, supported only for HTML and DocBook output]' \ + '--reference-links[use reference-style links, rather than inline links]' \ '--reference-location=[specify where footnotes (and references, if reference-links is set) are placed (block|section|document)]: :_pandoc_reference_location' \ - '--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]: : ' \ + '--markdown-headings[specify style for level1 and 2 headings in markdown output]:style [atx]:(setext atx)' \ + '!--atx-headers[use ATX-style headers in Markdown and AsciiDoc output]' \ '--top-level-division=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output]: :_pandoc_top_level_division' \ - {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]: : ' \ - '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]: :_pandoc_header_levels' \ - '--listings[use the listings package for LaTeX code blocks]: : ' \ - {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]: : ' \ - '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]: :_pandoc_header_levels' \ - '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]: : ' \ + {-N,--number-sections}'[number section headings in LaTeX, ConTeXt, HTML, or EPUB output]' \ + '--number-offset=[offset for section headings in HTML output (ignored in other output formats)]:number[number,...] [0]' \ + '--listings[use the listings package for LaTeX code blocks]' \ + {-i,--incremental}'[make list items in slide shows display incrementally (one by one)]' \ + '--slide-level=[specifies that headers with the specified level create slides (for beamer, s5, slidy, slideous, dzslides)]:slide level:(1 2 3 4 5 6)' \ + '--section-divs[wrap sections in <section> tags (or <div> tags for html4)Use the section-divs package for LaTeX code blocks]' \ '--email-obfusication=[treat top-level headers as the given division type in LaTeX, ConTeXt, DocBook, and TEI output (none|javascript|references)]: :_pandoc_email_obfusication' \ - '--default-image-extension=[specify a default extension to use when image paths/URLs have no extension]:extension: ' \ '--id-prefix=[specify a prefix to be added to all identifiers and internal links in HTML and DocBook output]:string: ' \ - {-T,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \ - {\*-c,\*--css=}'[link to a CSS style sheet]:url: ' \ + {-T+,--title-prefix=}'[specify STRING as a prefix at the beginning of the title that appears in the HTML header]:string: ' \ + {\*-c+,\*--css=}'[link to a CSS style sheet]: :_urls' \ '--reference-doc=[use the specified file as a style reference in producing a docx or ODT file]:file: ' \ - '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:dir:{_files -/}' \ + '--epub-subdirectory=[specify the subdirectory in the OCF container that is to hold the EPUB-specific contents]:directory:_files -/' \ '--epub-cover-image=[use the specified image as the EPUB cover]:file:_files' \ - '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:{_files -g "*.xml"}' \ + '--epub-metadata=[look in the specified XML file for metadata for the EPUB]:file:_files -g "*.xml(-.)"' \ '*--epub-embed-font=[embed the specified font in the EPUB]:file:_files ' \ - '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:_pandoc_header_level' \ + '--epub-chapter-level=[specify the header level at which to split the EPUB into separate "chapter" files]:number:(1 2 3 4 5 6)' \ + '--ipynb-output=[specify how to tread ipynb output cells]:method:(all none best)' \ '--pdf-engine=[use the specified engine when producing PDF output]:program:_pandoc_pdf_engine' \ '*--pdf-engine-opt=[use the given string as a command-line argument to the pdf-engine]:string:_pandoc_pdf_engine_opts' \ - '*--bibliography=[set the bibliography field in the document'"'"'s metadata to FILE]:file:{_files -g "*.{bib,bibtex,copac,json,yaml,enl,xml,wos,medline,mods,ris}"}' \ - '--csl=[set the csl field in the document'"'"'s metadata to FILE]:file:{_files -g "*.csl"}' \ + "*--bibliography=[set the bibliography field in the document's metadata to specified file]:file:_files -g '*.(bib|bibtex|copac|json|yaml|enl|xml|wos|medline|mods|ris)(-.)'" \ + "--csl=[set the csl field in the document's metadata to specified file]:file:_files -g '*.csl(-.)'" \ '--citation-abbreviations=[set the citation-abbreviations field in the document'"'"'s metadata to FILE]:file:_files' \ '--natbib[use natbib for citations in LaTeX output]' \ '--biblatex[use biblatex for citations in LaTeX output]' \ '--mathml[convert TeX math to MathML (in epub3, docbook4, docbook5, jats, html4 and html5)]' \ - '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]::url: ' \ - '--mathjax=[use MathJax to display embedded TeX math in HTML output]::url: ' \ - '--katex=[use KaTeX to display embedded TeX math in HTML output]::url: ' \ - {-m,--latexmathml=,--asciimathml=}'[deprecated. Use the LaTeXMathML script to display embedded TeX math in HTML output]::url: ' \ - '--mimetex=[deprecated. Render TeX math using the mimeTeX CGI script, which generates an image for each TeX formula]::url: ' \ - '--jsmath=[deprecated. Use jsMath (the predecessor of MathJax) to display embedded TeX math in HTML output]::url: ' \ - '--gladtex[deprecated. Enclose TeX math in <eq> tags in HTML output]: : ' \ - '--abbreviations=[specifies a custom abbreviations file]:file:_files ' \ + '--webtex=[convert TeX formulas to <img> tags that link to an external script that converts formulas to images]:: :_urls' \ + '--mathjax=[use MathJax to display embedded TeX math in HTML output]:: :_urls' \ + '--katex=[use KaTeX to display embedded TeX math in HTML output]:: :_urls' \ + '--gladtex[Enclose TeX math in <eq> tags in HTML output]' \ '--trace[enable tracing]' \ '--dump-args[print information about command-line arguments to stdout, then exit]' \ '--ignore-args[ignore command-line arguments (for use in wrapper scripts)]' \ '--verbose[give verbose debugging output]' \ '--quiet[suppress warning messages]' \ '--fail-if-warnings[exit with error status if there are any warnings]' \ - '--log=[write log messages in machine-readable JSON format to FILE]:file:_file' \ + '--log=[write log messages in machine-readable JSON format to FILE]:file:_files' \ '(- :)--bash-completion[generate a bash completion script]' \ '(- :)--list-input-formats[list supported input formats, one per line]' \ '(- :)--list-output-formats[list supported output formats, one per line]' \ diff --git a/Completion/Unix/Command/_patchutils b/Completion/Unix/Command/_patchutils index 50ea3e4c4..a5f6441b1 100644 --- a/Completion/Unix/Command/_patchutils +++ b/Completion/Unix/Command/_patchutils @@ -85,6 +85,7 @@ case $service in '(-H --with-filename -h --no-filename)'{-h,--no-filename}"[don't print the name of the patch file containing each patch]" '(-f --file)'{-f+,--file=}'[read regular expressions from file]:file:_files' '--output-matching=[display the matching hunk- or file-level diffs]:level:(hunk file)' + '--only-match=[restrict regex to matching removals, additions or modifications]:limit:(rem removals add additions mod modifications all)' ) ;; splitdiff) diff --git a/Completion/Unix/Command/_pbm b/Completion/Unix/Command/_pbm index 62004f79e..8b5576c5f 100644 --- a/Completion/Unix/Command/_pbm +++ b/Completion/Unix/Command/_pbm @@ -740,7 +740,7 @@ ppmtomitsu) _arguments \ '-sharpness:sharpness:(1 2 3 4)' \ '-enlarge:enlargement factor:(1 2 3)' \ - '-media:output media (default\: 1184x1350):((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \ + '-media:output media [1184x1350]:((A\:1216x1350 A4\:1184x1452 AS\:1216x1650 A4S\:1184x1754))' \ '-copy:number of copies:(1 2 3 4 5 6 7 8 9)' \ -{dpi300,tiny} ':file:_pbm' ;; diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index 0d007e3bc..a52ac1d06 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -1354,7 +1354,7 @@ _perforce_fstat_fields() { ${${${${(M)${(f)"$(_perforce_call_p4 help-fstat help fstat)"}:#[[:blank:]]#[a-zA-Z]##(|\#)[[:blank:]]##--*}##[[:blank:]]#}:#fstat *}//[[:blank:]]##--[[:blank:]]##/:} ) compset -P '*[,[:blank:]]' - _describe -t fstat-fields 'Perforce fstat fields' values -S, -q + _describe -t fstat-fields 'Perforce fstat field' values -S, -q } @@ -2551,7 +2551,7 @@ _perforce_cmd_logstat() { (( $+functions[_perforce_cmd_logtail] )) || _perforce_cmd_logtail() { _arguments -s : \ - '-b[specify block size, default 8192]:block size: ' \ + '-b[specify block size]:block size [8192]' \ '-s[specify start offset]:offset: ' \ '-m[specify max blocks]:max blocks: ' } @@ -2668,12 +2668,12 @@ _perforce_cmd_passwd() { _perforce_cmd_ping() { _arguments -s : \ '-c[specify count of messages]:count of messages: ' \ - '-t[specify total time of test]:time in seconds: ' \ + '-t[specify total time of test]:time (seconds)' \ '-i[specify iterations for test]:number of iterations: ' \ '-f[transmit continuously without waiting for responses]' \ - '-p[specify pause between tests]:pause in seconds: ' \ - '-s[specify send size]:send size in octets: ' \ - '-r[specify receive size]:receive size in octets: ' + '-p[specify pause between tests]:pause (seconds)' \ + '-s[specify send size]:send size (octets)' \ + '-r[specify receive size]:receive size (octets)' } @@ -2942,7 +2942,7 @@ _perforce_cmd_status() { _perforce_cmd_sizes() { _arguments -s : \ '-a[list all revisions in range]' \ - '-b[specify blocksize]:blocksize in bytes: ' \ + '-b[specify blocksize]:blocksize (bytes)' \ '(-H)-h[print sizes in human-readable form (GiB)]' \ '(-h)-H[print sizes in human-readable form (GB)]' \ '-m[limit max files]:max files: ' \ diff --git a/Completion/Unix/Command/_perl b/Completion/Unix/Command/_perl index 0914264fe..d7e8f1b51 100644 --- a/Completion/Unix/Command/_perl +++ b/Completion/Unix/Command/_perl @@ -1,14 +1,10 @@ #compdef perl -# -# zsh completion code for the Perl interpreter -# Adam Spiers <adam@spiers.net> -# -# Completions currently based on Perl 5.14.1. + typeset -A opt_args _perl () { _arguments -s \ - '-0-[input record separator ($/)]:$/ in octal or hex (\0, if no argument)' \ + '-0-[input record separator ($/)]:: :_perl_input_seps' \ '-a[autosplit mode with -n or -p (splits $_ into @F)]' \ '-C-[control some unicode features]: :_perl_unicode_flags' \ "-c[check syntax only (runs BEGIN and END blocks)]" \ @@ -24,7 +20,7 @@ _perl () { '-h[list help summary]' \ '-i-[edit <> files in place (make backup if extension supplied)]:backup file extension: ' \ '*-I-[specify @INC/#include directory (may be used more than once)]:include path:_files -/' \ - '-l-[enable line ending processing, specifies line terminator]:output record separator in octal: ' \ + '-l-[enable line ending processing, specifies line terminator]:: :_perl_output_seps' \ \*{-m,-M}"-[module.. executes \`use/no module...' before executing your script]:module:_perl_m_opt" \ "-n[assume 'while (<>) { ... }' loop around your script]" \ "-p[assume loop like -n but print line also like sed]" \ @@ -35,7 +31,7 @@ _perl () { "-u[dump core after parsing script]" \ "-U[allow unsafe operations]" \ "-v[print version, patchlevel and license]" \ - "-V-[print perl configuration information]:configuration keys:_perl_config_vars" \ + "-V-[print perl configuration information]:configuration key:_perl_config_vars" \ '( -W -X)-w[turn warnings on for compilation of your script (recommended)]' \ "(-w -X)-W[enable all warnings (ignores 'no warnings')]" \ "(-w -W )-X[disable all warnings (ignores 'use warnings')]" \ @@ -63,6 +59,27 @@ _perl_m_opt () { fi } +_perl_input_seps() { + if [[ $#PREFIX -eq 1 && $PREFIX != [0-9a-zA-Z] ]]; then + # convert a non-octal or potential option character into octal representation + compadd -i "$IPREFIX" -U $(( [##8] ##$PREFIX )) + else + _describe -x -t separators "input record separator, $/ in octal or hex (\0, if no argument) [\n]" '( + 0:paragraph\ mode + 777:slurp\ whole\ input\ files + )' || _comp_mesg=yes + fi +} + +_perl_output_seps() { + if [[ $#PREFIX -eq 1 && $PREFIX != [0-9a-zA-Z] ]]; then + # convert a non-octal or potential option character into octal representation + compadd -i "$IPREFIX" -U $(( [##8] ##$PREFIX )) + else + _message -e separators "output record separator, $\\ in octal or hex [$/]" + fi +} + _perl_config_vars () { if (( ! $+_perl_config_vars )); then _perl_config_vars=( $(perl -MConfig -e 'print join("\n", keys %Config);') ) @@ -79,45 +96,49 @@ _perl_config_vars () { } _perl_unicode_flags () { - _values -s '' 'unicode bitmask or flags' \ - 'I[ 1 STDIN is assumed to be in UTF-8]' \ - 'O[ 2 STDOUT will be in UTF-8]' \ - 'E[ 4 STDERR will be in UTF-8]' \ - 'S[ 7 I + O + E]' \ - 'i[ 8 UTF-8 is the default PerlIO layer for input streams]' \ - 'o[ 16 UTF-8 is the default PerlIO layer for output streams]' \ - 'D[ 24 i + o]' \ + _values -s '' 'unicode bitmask or flag' \ + '(S)I[ 1 STDIN is assumed to be in UTF-8]' \ + '(S)O[ 2 STDOUT will be in UTF-8]' \ + '(S)E[ 4 STDERR will be in UTF-8]' \ + '(I O E)S[ 7 I + O + E]' \ + '(D)i[ 8 UTF-8 is the default PerlIO layer for input streams]' \ + '(D)o[ 16 UTF-8 is the default PerlIO layer for output streams]' \ + '(i o)D[ 24 i + o]' \ 'A[ 32 the @ARGV elements are expected to be strings encoded in UTF-8]' \ 'L[ 64 make "IOEioA" conditional on the locale environment variables]' \ 'a[256 set ${^UTF8CACHE} to -1, used for debugging]' \ } _perl_debugging_flags () { - _values -s '' 'debugging bitmask or flags' \ - 'p[ 1 Tokenizing and parsing (with v, displays parse stack)]' \ - 's[ 2 Stack snapshots (with v, displays all stacks)]' \ - 'l[ 4 Context (loop) stack processing]' \ - 't[ 8 Trace execution]' \ - 'o[ 16 Method and overloading resolution]' \ - 'c[ 32 String/numeric conversions]' \ - 'P[ 64 Print profiling info, preprocessor command for -P, source file input state]' \ - 'm[ 128 Memory and SV allocation]' \ - 'f[ 256 Format processing]' \ - 'r[ 512 Regular expression parsing and execution]' \ - 'x[ 1024 Syntax tree dump]' \ - 'u[ 2048 Tainting checks]' \ - 'U[ 4096 Unofficial, User hacking (reserved for private, unreleased use)]' \ - 'H[ 8192 Hash dump -- usurps values()]' \ - 'X[ 16384 Scratchpad allocation]' \ - 'D[ 32768 Cleaning up]' \ - 'S[ 66536 Thread synchronization]' \ - 'T[ 131072 Tokenising]' \ - 'R[ 262144 Include reference counts of dumped variables (eg when using -Ds)]' \ - 'J[ 524288 Do not s,t,P-debug (Jump over) opcodes within package DB]' \ - 'v[1048576 Verbose: use in conjunction with other flags]' \ - 'C[2097152 Copy On Write]' \ - 'A[4194304 Consistency checks on internal structures]' \ - 'q[8388608 quiet - currently only suppresses the "EXECUTING" message]' \ + _values -s '' 'debug flag or bitmask' \ + 'p[ 1 tokenizing and parsing (with v, display parse stack)]' \ + 's[ 2 stack snapshots (with v, display all stacks)]' \ + 'l[ 4 context (loop) stack processing]' \ + 't[ 8 trace execution]' \ + 'o[ 16 method and overload resolution]' \ + 'c[ 32 string/numeric conversions]' \ + 'P[ 64 print profiling info, source file input state]' \ + 'm[ 128 memory and SV allocation]' \ + 'f[ 256 format processing]' \ + 'r[ 512 regular expression parsing and execution]' \ + 'x[ 1024 syntax tree dump]' \ + 'u[ 2048 tainting checks]' \ + 'U[ 4096 unofficial, user hacking (reserved for private, unreleased use)]' \ + 'X[ 16384 scratchpad allocation]' \ + 'D[ 32768 cleaning up]' \ + 'S[ 66536 Op slab allocation]' \ + 'T[ 131072 tokenising]' \ + 'R[ 262144 include reference counts of dumped variables (e.g. when using -Ds)]' \ + "J[ 524288 show s,t,P-debug (don't jump over) on opcodes within package DB]" \ + 'v[ 1048576 verbose: use in conjunction with other flags]' \ + 'C[ 2097152 copy-on-write]' \ + 'A[ 4194304 consistency checks on internal structures]' \ + 'q[ 8388608 quiet - currently only suppresses the "EXECUTING" message]' \ + 'M[ 16777216 trace smart match resolution]' \ + 'B[ 33554432 dump subroutine definitions, including special blocks like BEGIN]' \ + 'L[ 67108864 trace locale-related info]' \ + 'i[134217728 trace PerlIO layer processing]' \ + 'y[268435456 trace y///, tr/// compilation and execution]' } _perl "$@" diff --git a/Completion/Unix/Command/_perldoc b/Completion/Unix/Command/_perldoc index 3e58d5a50..b724d74ee 100644 --- a/Completion/Unix/Command/_perldoc +++ b/Completion/Unix/Command/_perldoc @@ -3,7 +3,7 @@ local curcontext="$curcontext" state line expl args ret=1 typeset -A opt_args -args=( '*:Perl pod pages:->perl-pods' ) +args=( '*:Perl pod page:->perl-pods' ) if [[ $service = *PERLDOC* ]]; then compset -q @@ -46,7 +46,7 @@ case $state in perl-pods) if (( $+opt_args[-F] )); then - _wanted files expl 'Perl modules and .pods' \ + _wanted files expl 'Perl module or .pod' \ _files -g "*.(pod|pm)(-.)" && ret=0 else _alternative \ diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 3b4d082a7..9c3ddf039 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -5,8 +5,6 @@ # (which changed the behaviour of -f and added -a) # - We don't really need to keep pgopts and pkopts separate, but it seems like # it should make things a bit easier to follow -# - @todo We could complete log-in classes given to -c -# - @todo We could complete routing tables given to -T local curcontext="$curcontext" state line ret=1 expl pgopts pkopts no typeset -A opt_args @@ -18,7 +16,7 @@ typeset -a arguments sig_arguments aopts # overridden below arguments=( '-a[include process ancestors in match list]' - '-c+[match only on specified login class]:login class' + '-c+[match only on specified login class]:login class:_login_classes' '(-F --pidfile)'{-F+,--pidfile=}'[match only processes in specified PID file]:PID file:_files' '(-f --full)'{-f,--full}'[match against full command line]' '(-G --group)'{-G+,--group=}'[match only on specified real group IDs]: :_sequence _groups' @@ -32,13 +30,15 @@ arguments=( '(-M)-N+[extract name list from specified system]:system file:_files' '(-o -n --oldest --newest)'{-n,--newest}'[match newest process]' '(-o -n --oldest --newest)'{-o,--oldest}'[match oldest process]' + '(-O --older)'{-O+,--older=}'[select where older than specified age]:age (seconds)' '(-P --parent)'{-P+,--parent=}'[match only on specified parent process IDs]: :->ppid' '(-l)-q[suppress normal output]' + '(-r --runstates)'{-r+,--runstates}'[match runstates]:run state:compadd -S "" D I R S T t W X Z' '-S[search also in system processes (kernel threads)]' '(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid' # _signals is OK here - we do it differently below '(ss)--signal=[specify signal to send to process]: :_signals -s' - '-T+[match only on specified routing table]:routing table' + '-T+[match only on specified routing table]:routing table:_routing_tables' '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do' '(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users' '(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users' @@ -62,8 +62,8 @@ arguments=( case $OSTYPE in linux*) # Note: We deliberately exclude -v but not --inverse from pkill - pgopts=acdFfGghLlnoPstUuVvwx- - pkopts=ceFfGghLnoPstUuVx- + pgopts=acdFfGghLlnoOPrstUuVvwx- + pkopts=ceFfGghLnoOPstUuVx- arguments=( ${arguments:#((#s)|*\))(\*|)-[acl]*} '(-c --count)'{-c,--count}'[display count of matching processes]' @@ -125,6 +125,10 @@ else fi fi +if [[ $OSTYPE = dragonfly* ]]; then + arguments+=( '(-t)-T[match only processes associated with the current terminal]' ) +fi + arguments+=( $sig_arguments + o '*: :->pname' ) [[ $OSTYPE == linux* ]] || aopts+=( -A '*-' ) @@ -149,7 +153,7 @@ case $state in _pgrep_sequence ppids 'parent process ID' ppid ;; (pgid) - _pgrep_sequence pgids 'process group ID' pgid + _sequence _pgids ;; (projid) _pgrep_sequence project-ids 'project ID' project @@ -163,11 +167,21 @@ case $state in (pname) local ispat="pattern matching " if (( ${+opt_args[-x]} )); then - ispat="" + ispat+="full " fi if (( ${+opt_args[-f]} )); then - _wanted process-args expl $ispat'process command line' \ - compadd ${${(f)"$(_call_program process-args ps -A -o args=)"}% *} + local -a opts=( -lf ) + [[ $OSTYPE == linux* ]] && opts=( -a ) + local -a matches=( ${(f)"$( + _call_program process-args pgrep ${(@q)opts} -- \ + ${(q)${${:-$PREFIX$SUFFIX}:-.\*}} + )"} ) + local -a displ=( "${${matches[@]//:/\:}[@]/ /:}" ) + matches=( "${matches[@]##<-> }" ) + + local desc=$ispat'process command line' + _description process-args expl "$desc" + _describe -t process-args "$desc" displ matches "$@" -U "$expl[@]" else _wanted processes-names expl $ispat'process name' _process_names -a -t fi diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php index c4c4ab3e2..9a8f519b1 100644 --- a/Completion/Unix/Command/_php +++ b/Completion/Unix/Command/_php @@ -93,7 +93,7 @@ _php() { + '(hv)' # Help/version options; kept separate by convention '(- 1 *)'{-h,--help}'[display help information]' '(- 1 *)'{-v,--version}'[display version information]' - '!(- 1 *)'{-\?,-\\\?,--usage} + '!(- 1 *)'{-\?,--usage} + '(im)' # Info/module options (exclusive with everything but -c/-n) '(fi mc pb pf rf rn sc sv *)'{-i,--info}'[display configuration information (phpinfo())]' diff --git a/Completion/Unix/Command/_ping b/Completion/Unix/Command/_ping index 274204264..d36a0f3a9 100644 --- a/Completion/Unix/Command/_ping +++ b/Completion/Unix/Command/_ping @@ -11,7 +11,6 @@ case ${variant}:${${service#ping}:-4} in args+=( '-d[set SO_DEBUG on the socket]' '-n[show network addresses as numbers]' - '-M+[define mtu discovery]:mtu discovery:(do dont want)' '-v[verbose output]' ) ;| @@ -35,7 +34,7 @@ case ${variant}:${${service#ping}:-4} in iputils:*|solaris:*|((free|net)bsd|darwin|dragonfly)*:4) args+=( '-r[bypass normal routing tables]' ) ;| - iputils:*|((free|net)bsd|darwin|dragonfly)*:4) + (iputils|freebsd<13->.*):*|(freebsd<-12>.|netbsd|darwin|dragonfly)*:4) args+=( '-a[audible bell for each packet]' ) ;| iputils:*|netbsd*:4|openbsd*) @@ -49,6 +48,9 @@ case ${variant}:${${service#ping}:-4} in (*bsd|darwin|dragonfly)*) args+=( '-I+[specify source interface for multicast packets]:interface:_net_interfaces' ) ;| + freebsd<13->.*|openbsd*) + args+=( '-H[try reverse-lookups of addresses]' ) + ;| freebsd*|darwin*|dragonfly*|netbsd*:6) args+=( '-S+[specify source address]:source address' ) ;| @@ -58,10 +60,13 @@ case ${variant}:${${service#ping}:-4} in (*bsd|darwin|dragonfly)*:4) args+=( "-D[set the don't fragment bit]" ) ;| + (freebsd|openbsd|darwin)*:6) + args+=( '-D[disable IPv6 fragmentation]' ) + ;| ((free|net)bsd|darwin|dragonfly)*:4) args+=( '-Q[somewhat quiet]') ;| - freebsd*:6|darwin*:6|solaris*|netbsd*) + freebsd<-12>.*:6|darwin*:6|solaris*|netbsd*) args+=( '*-g+[specify gateway to use as the next hop to the destination]:gateway:_hosts' ) @@ -71,10 +76,14 @@ case ${variant}:${${service#ping}:-4} in ;| ((free|net)bsd|darwin|dragonfly)*:6) args+=( - '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' '-b+[set socket buffer size]:buffer size' - '-H[try reverse-lookups of IPv6 addresses]' '-N[probe node information multicast group address]' + ) + ;| + (freebsd<-12>.|netbsd|darwin|dragonfly)*:6) + args+=( + '-a+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' + '-H[try reverse-lookups of IPv6 addresses]' '(-s)-t[generate ICMPv6 Node Information supported query types query]' '(-s)-w[generate ICMPv6 Node Information DNS Name query]' '!(-s)-W' ) @@ -91,30 +100,54 @@ case ${variant}:${${service#ping}:-4} in '-N+[specify a next-hop router that the probe packet should go through]:router:_hosts' ) ;| - (freebsd|darwin|dragonfly)*:4) + freebsd<13->.*:6|(freebsd|darwin|dragonfly)*:4) args+=( '-A[audible bell for no packet]' + '-t+[specify timeout after which ping exits]:deadline (seconds)' + '-W+[specify time to wait for a response]:wait time (ms)' + ) + ;| + (freebsd|darwin|dragonfly)*:4) + args+=( '-G+[specify maximum size for ICMP payload for sweeping pings]:size' '-g+[specify minimum size for ICMP payload for sweeping pings]:size [0]' '-h+[specify size increment for ICMP payload for sweeping pings]:size [1]' '-M+[use ICMP_MASKREQ or ICMP_TSTAMP instead of ICMP_ECHO]:ICMP:(mask time)' '-m+[set IP Time to Live for outgoing packets]:ttl' '-T+[set IP Time to Live for multicasted packets]:ttl' - '-t+[specify timeout after which ping exits]:deadline (seconds)' - '-W+[specify time to wait for a response]:wait time (ms)' '-z+[specify type of service]:type of service' ) ;| - (freebsd|openbsd|darwin)*:6) - args+=( '-D[disable IPv6 fragmentation]' ) - ;| - (freebsd|darwin)*:6) + (freebsd<-12>.*|darwin*):6) args+=( '-R[audible bell for no packet]' '-r[audible bell for each packet]' ) ;| - freebsd*:6) + (iputils|freebsd<13->.*):4) + args+=( + '(-F -N)-4[use IPv4 only]' + '-6[use IPv6 only]' + ) + ;| + freebsd<13->.*:4) + args+=( + '-C+[add an 802.1p Ethernet Priority Code Point when sending a packet]:pcp:(-1 0 1 2 3 4 5 6 7)' + ) + ;| + freebsd<13->.*:6) + args+=( + '*-e+[specify gateway to use as the next hop to the destination]:gateway:_hosts' + '-k+[generate ICMPv6 Node Information Node Addresses query]:address type:(a c g s l A)' + '(-s)-O[generate ICMPv6 Node Information supported query types query]' + '*-u[suppress fragmentation to minimum MTU]' + '(-s)-Y[generate ICMPv6 Node Information DNS Name query with old packet format]' + '(-s)-y[generate ICMPv6 Node Information DNS Name query]' + '-E[enable transport-mode IPsec encapsulated security payload]' + '-Z[enables transport-mode IPsec authentication header]' + ) + ;| + freebsd<-12>.*:6) args+=( '-x+[specify time to wait for a response]:wait time (ms)' '-X+[specify timeout after which ping exits]:deadline (seconds)' @@ -154,19 +187,13 @@ case ${variant}:${${service#ping}:-4} in ;; openbsd*) args+=( - '-H[try reverse-lookups of addresses]' '-E[audible bell for no packet]' '-e[audible bell for each packet]' + '-g[provide a visual display of packets received and lost]' '-T+[change TOS value]:TOS value:(critical inetcontrol lowdelay netcontrol throughput reliability ef af cs)' - '-V+[specify routing table to be used]:routing table' + '-V+[specify routing table to be used]:routing table:_routing_tables' ) ;; - iputils:4) - args+=( - '(-F -N)-4[use IPv4 only]' - '-6[use IPv6 only]' - ) - ;| iputils:*) args+=( '-A[adaptive]' diff --git a/Completion/Unix/Command/_pip b/Completion/Unix/Command/_pip new file mode 100644 index 000000000..bafc7f9e9 --- /dev/null +++ b/Completion/Unix/Command/_pip @@ -0,0 +1,213 @@ +#compdef -P pip[0-9.]# + +# To get completion of installable packages, do: +# pip install pip-cache +# and then run: +# pip-cache update + +local curcontext="$curcontext" ret=1 +local -a state state_descr line +local -A opt_args +local python pip +local -a args subcommands packages + +pip=${words[1]} +python=${${pip}/pip/python} +[[ $python == $pip ]] && python=python + +args=( + '(* : -)'{-h,--help}'[display usage information]' + '--isolated[ignore environment variables and user configuration]' + \*{-v,--verbose}'[give more output]' + \*{-q,--quiet}"[give less output]" + '--log=[specify log file where a complete record will be kept]:file:_files' + '--proxy=[specify a proxy]:proxy ([user\:passwd@]proxy.server\:port)' + '--retries=[specify maximum number of retries each connection should attempt]:retries [5]' + '--timeout=[set the socket timeout]:timeout (seconds) [15]' + '--exists-action=[specify action when a path already exists]:action:((s\:switch i\:ignore w\:wipe b\:backup a\:abort))' + '--cert=[specify path to alternate CA bundle]:path:_files' + '--client-cert=[specify path to SSL client certificate]:certificate file:_files' + '(--no-cache-dir)--cache-dir=[specify location to store the cache data]: :_directories' + '(--cache-dir)--no-cache-dir[disable the cache]' + "--disable-pip-version-check[don't check whether a new version of pip is available]" +) + +subcommands=( + 'install:install packages' + 'download:download packages' + 'uninstall:uninstall packages' + 'freeze:output installed packages in requirements format' + 'list:list installed packages' + 'show:show information about installed packages' + 'check:verify installed packages have compatible dependencies' + 'search:search PyPI for packages' + 'wheel:build wheels from your requirements' + 'hash:compute hashes of package archives' + 'help:show available commands' +) + +_arguments -C $args \ + '(* : -)'{-V,--version}'[display version information]' \ + ':subcommand:->subcommand' \ + '*::options:->options' && ret=0 + +case $state in + subcommand) + _describe -t subcommands 'pip subcommand' subcommands && ret=0 + ;; + + options) + curcontext="${curcontext%:*}-$words[2]:" + + case $words[1] in + download|install|list|wheel) + args+=( + '--pre[include pre-release and development versions]' + '(-i --index-url)'{-i+,--index-url=}'[base URL of Python Package Index]:url:_urls' + '--extra-index-url=[extra URLs of package indexes to use in addition to --index-url]:url:_urls' + '--no-index[ignore package index (only looking at --find-links URLs instead)]' + '(-f --find-links)'{-f+,--find-links=}'[parse specified URL or HTML file for links to packages]:URL or file:_files -g "*.htm(|l)(-.)"' + '--process-dependency-links[enable the processing of dependency links]' + ) + ;| + download|(un|)install|freeze|wheel) + args+=( + '(-r --requirement)'{-r+,--requirement=}'[all the packages listed in the given requirements file]:requirements file:_files -g "(requirement*|*.txt)(-.)"' + ) + ;| + download|install|wheel) + args+=( + '!--use-wheel' '!--no-use-wheel' + "*--no-binary=[don't use binary packages]: :->package_list" + "*--only-binary=[don't use source packages]: :->package_list" + \*{-c+,--constraint=}'[constrain versions using the given constraints file]:constraints file:_files' + '(-e --editable)'{-e+,--editable=}'[install a package directly from a checkout]:directory or VCS+REPOS_URL[@REV]#egg=PACKAGE:_files -/' + '--src=[check out --editable packages into given directory]: :_directories' + '--ignore-requires-python[ignore the Requires-Python information]' + "--no-deps[don't install package dependencies]" + '(-b --build)'{-https://cloud.kiddleb+,--build=}'[specify directory to unpack packages into]: :_directories' + '--global-option=[extra global options to be supplied to the setup.py call before the install command]:options' + "--no-clean[don't clean up build directories]" + '--require-hashes[require a hash to check each requirement against]' + ) + ;| + + download) + args+=( + '(-d --dest)'{-d+,--dest=}'[download packages into given directory]: :_directories' + '--platform=[only download wheels compatible with platform]::platform' + '--python-version=[only download wheels compatible with specified Python interpreter version]:version' + '--implementation=[only download wheels compatible with specified Python implementation]:implementation:(pp jy cp ip py)' + ) + ;; + + install) + args+=( + '(-t --target)'{-t+,--target=}'[specify directory to install packages into]: :_directories' + '(-d --download)'{-d+,--download=}'[download packages into directory instead of installing them]: :_directories' + '(-U --upgrade)'{-U,--upgrade}'[upgrade all packages to the newest available version]' + '--upgrade-strategy=[determine how dependency upgrading should be handled]:strategy:(eager only-if-needed)' + '--force-reinstall[when upgrading, reinstall all packages even if they are already up-to-date]' + '(-I --ignore-installed)'{-I,--ignore-installed}'[ignore installed packages]' + "--no-install[download and unpack all packages, but don't actually install them]" + "--no-download[don't download any packages, just install the ones already downloaded]" + '--install-option=[extra arguments to be supplied to the setup.py install command]:options' + '--user[install to the user install directory, typically ~/.local]' + '--egg[install as self contained egg file, like easy_install does]' + '--root=[install everything relative to this alternate root directory]: :_directories' + '--strip-file-prefix=[strip given prefix from script paths in wheel RECORD]:prefix' + '--prefix=[specify installation prefix where lib, bin and other top-level folders are placed]: :_directories' + '(--no-compile)--compile[compile py files to pyc]' + "(--compile)--no-compile[don't compile py files to pyc]" + '*:package name:->packages_or_dirs' + ) + ;; + + uninstall) + args+=( + '(-y --yes)'{-y,--yes}"[don't ask for confirmation of uninstall deletions]" + ':installed package:->installed_packages' + ) + ;; + + freeze) + args+=( + '(-f --find-links)'{-f+,--find-links=}'[specify URL to look for packages at]:url:_urls' + '(-l --local)'{-l,--local}"[if in a virtualenv that has global access, don't list globally-installed packages]" + '--user[only output packages installed in user-site]' + '--all[include pip, setuptools, distribute and wheel in output]' + ) + ;; + + hash) + args+=( + '(-a --algorithm)'{-a+,--algorithm=}'[specify hash algorithm]:algorithm:(sha256 sha384 sha512)' + '*: :_files' + ) + ;; + + list) + args+=( + '(-o --outdated -u --uptodate)'{-o,--outdated}'[list outdated packages (excluding editables)]' + '(-u --uptodate -o --outdated)'{-u,--uptodate}'[list uptodated packages (excluding editables)]' + '(-e --editable)'{-e,--editable}'[list editable projects]' + '(-l --local)'{-l,--local}"[if in a virtualenv that has global access, don't list globally-installed packages]" + '--user[only output packages installed in user-site]' + '--format=[select the output format]:format [legacy]:(legacy columns freeze json)' + '--not-required[list packages that are not dependencies of installed packages]' + ) + ;; + + show) + args+=( + '(-f --files)'{-f,--files}'[show the full list of installed files for each package]' + ':installed package:->installed_packages' + ) + ;; + + search) + args+=( + '(-i --index)'{-i+,--index=}'[specify base URL of Python Package Index]:URL:_urls' + ) + ;; + + wheel) + args+=( + '(-w --wheel-dir)'{-w+,--wheel-dir=}"[build wheels into given directory]: :_directories" + "--build-option=[extra arguments to be supplied to 'setup.py bdist_wheel']:options" + ) + ;; + + help) + _describe -t subcommands 'pip subcommand' subcommands + return + ;; + + *) args+=( '*: :_default' ) ;; + esac + + _arguments -s -S $args && ret=0 + + case $state in + package_list) + packages=( ${(f)"$(_call_program packages pip-cache pkgnames)"} ) + _sequence _wanted packages expl package compadd - -a packages && ret=0 + ;; + + packages_or_dirs) + [[ -prefix - ]] || packages=( ${(f)"$(_call_program packages pip-cache pkgnames)"} ) + _alternative \ + 'all-packages:package:compadd -a packages' \ + 'directories:directory with setup.py:_directories' && ret=0 + ;; + + installed_packages) + packages=( $(_call_program fetch-installed \ + "env COMP_WORDS='pip uninstall' COMP_CWORD=2 PIP_AUTO_COMPLETE=1 $pip") ) + _wanted installed-packages expl 'installed package' compadd -a packages && ret=0 + ;; + esac + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_pkginfo b/Completion/Unix/Command/_pkginfo index 6c71082ef..eca9e057e 100644 --- a/Completion/Unix/Command/_pkginfo +++ b/Completion/Unix/Command/_pkginfo @@ -1,22 +1,18 @@ #compdef pkginfo -_pkginfo() { - _arguments -s \ - '(-q -r -x)-l[long listing]' \ - '(-l -r -x)-q[quiet mode]' \ - '(-l -q -x)-r[relocation base]' \ - '(-l -q -r)-x[extracted listing]' \ - '-c[category]:category: ' \ - '-a[architecture]:architecture: ' \ - '-v[version]:version: ' \ - - set1 \ - '(-p)-i[select completely installed packages]' \ - '(-i)-p[select partially installed packages]' \ - '-R[root path]:root path:_files -/' \ - '*:package instance:_pkg_instance --_opts installed:set1--R' \ - - set2 \ - '-d[device]:device file:_files' \ - '*:package instance:_pkg_instance --_opts uninstalled:set2--d' -} - -_pkginfo "$@" +_arguments -s \ + '(-q -r -x)-l[long listing]' \ + '(-l -r -x)-q[quiet mode]' \ + '(-l -q -x)-r[relocation base]' \ + '(-l -q -r)-x[extracted listing]' \ + '-c[category]:category' \ + '-a[architecture]:architecture' \ + '-v[version]:version' \ + - set1 \ + '(-p)-i[select completely installed packages]' \ + '(-i)-p[select partially installed packages]' \ + '-R[root path]:root path:_files -/' \ + '*:package instance:_pkg_instance --_opts installed:set1--R' \ + - set2 \ + '-d[device]:device file:_files' \ + '*:package instance:_pkg_instance --_opts uninstalled:set2--d' diff --git a/Completion/Unix/Command/_pkgrm b/Completion/Unix/Command/_pkgrm index 25a950221..1191a2d1f 100644 --- a/Completion/Unix/Command/_pkgrm +++ b/Completion/Unix/Command/_pkgrm @@ -1,20 +1,16 @@ #compdef pkgrm -_pkgrm() { - _arguments -s \ - '-Y[select packages by category]:category: ' \ - - set1 \ - '-n[non-interactive mode]' \ - '-v[trace all scripts]' \ - '-a[admin file]:admin file:_files' \ - "-A[force removal of all files]" \ - "-M[don't use vfstab file]" \ - '-R[root path]:root path:_files -/' \ - '-V[alternate vfstab file]:vfstab file:_files' \ - '*:package instance:_pkg_instance --_opts installed:set1--R' \ - - set2 \ - '-s[spool package]:spool directory:_files -/' \ - '*:package instance:_pkg_instance --_opts spooled:set2--s' -} - -_pkgrm "$@" +_arguments -s \ + '-Y[select packages by category]:category' \ + - set1 \ + '-n[non-interactive mode]' \ + '-v[trace all scripts]' \ + '-a[admin file]:admin file:_files' \ + "-A[force removal of all files]" \ + "-M[don't use vfstab file]" \ + '-R[root path]:root path:_files -/' \ + '-V[alternate vfstab file]:vfstab file:_files' \ + '*:package instance:_pkg_instance --_opts installed:set1--R' \ + - set2 \ + '-s[spool package]:spool directory:_files -/' \ + '*:package instance:_pkg_instance --_opts spooled:set2--s' diff --git a/Completion/Unix/Command/_pr b/Completion/Unix/Command/_pr new file mode 100644 index 000000000..2aeeb13b3 --- /dev/null +++ b/Completion/Unix/Command/_pr @@ -0,0 +1,103 @@ +#compdef pr + +local curcontext=$curcontext variant msg ret=1 +local -a state state_descr line specs optA +typeset -A opt_args + +# take care of '+FIRST_PAGE[:LAST_PAGE]' (GNU) or '+FIRST_PAGE' (POSIX) +if _pick_variant -r variant gnu=GNU $OSTYPE --version; then + msg='FIRST_PAGE[:LAST_PAGE]' +else + msg='first page' +fi + +if [[ $words[CURRENT] = +* ]]; then + _message "$msg" && return +fi + +if (( ! ${words[(I)+[0-9]*]} )); then + # if +number is not on the command line + specs=( '(hv)--pages=[specify first and last page numbers]: : _message $msg' ) +fi + +# common specs +specs+=( + '(hv -a --across)'{-a,--across}'[with multi-column output, print columns across rather than down]' + '(hv -d --double-space)'{-d,--double-space}'[double space the output]' + '(hv -e --expand-tabs)'{-e-,--expand-tabs=-}'[expand tab (or specified char) with specified number of spaces]::number of spaces [8]:->char_number' + '(hv -h --header -t --omit-header)'{-h+,--header=}'[specify text used in header]:header: ' + '(hv -i --output-tabs)'{-i-,--output-tabs=-}'[replace specified number of spaces with tab (or specified char)]::number of spaces [8]:->char_number' + '(hv -l --length)'{-l+,--length=}'[specify the page length]:number of lines [66]: ' + '(hv -m --merge)'{-m,--merge}'[print all files in parallel, one in each column]' + '(hv -n --number-lines)'{-n-,--number-lines=-}'[number lines with specified separator and width]::number of digits [5]:->char_number' + '(hv -o --indent)'{-o+,--indent=}'[specify left margin]:margin [0]: ' + '(hv -r -no-file-warnings)'{-r,--no-file-warnings}'[omit warning when a file cannot be opened]' + '(hv -s --separator)'{-s-,--separator=-}'[specify column separator character]:character [tab]: ' + '(hv -t --omit-header -h --header)'{-t,--omit-header}'[omit page headers and trailers]' + '(hv -w --width)'{-w+,--width=}'[specify page width for multi-column output]:number of characters [72]: ' + '(hv)*: :_files' +) +# XXX: pr accepts -2 -3 -4 ... for specifying the number of columns. +# Here we offer only -2 and -3, and do so only if there is no +# -2 -3 -4 ... or --columns on the command line. +if (( ! ${words[(I)-([0-9]##*|-columns*)]} )); then + specs+=( {-2,-3}'[specify number of columns]' ) +fi + +if [[ $variant = gnu ]]; then + # GNU coreutils 8.32 + specs+=( + '(hv -c --show-control-chars)'{-c,--show-control-chars}'[use hat (^G) and octal backslash notation]' + '(hv -D --date-format)'{-D+,--date-format=}'[specify format for the header date]: :_date_formats' + '(hv -f -F --form-feed)'{-f,-F,--form-feed}'[use form feeds instead of newlines to separate pages]' + '(hv -J --join-lines)'{-J,--join-lines}'[merge full lines in multi-column output]' + '(hv -N --first-line-number)'{-N+,--first-line-number=}'[specify the line number of the 1st line]:number: ' + '(hv -S --sep-string)'{-S-,--sep-string=-}'[specify column separator string]:string: ' + '(hv -T --omit-pagination)'{-T,--omit-pagination}'[omit page headers and trailers, eliminate any pagination]' + '(hv -v --show-nonprinting)'{-v,--show-nonprinting}'[use octal backslash notation]' + '(hv -W --page-width)'{-W+,--page-width=}'[specify page width always]:number of characters [72]: ' + ) + if (( ! ${words[(I)-[0-9]##*]} )); then + # if -2 -3 -4 ... are not on the command line + specs+=( + '(hv)--columns=[specify number of columns]:number of columns: ' + + hv + '(- *)--help[display help and exit]' + '(- *)--version[output version information and exit]' + ) + fi +else + specs=( ${specs:#(|*\))--*} ) # remove long options + case $variant in + freebsd*|dragonfly*|darwin*|netbsd*) + specs+=( + '(-f)-F[use form feeds instead of newlines to separate pages]' + '(-F)-f[same as -F but pause before the 1st page if stdout is terminal]' + '-p[pause before each page if stdout is terminal]' + ) + ;| + freebsd*|dragonfly*|darwin*) + specs+=( '-L+[specify locale to use]: :_locales' ) + ;; + openbsd*) + specs+=( '(-f -F)'{-f,-F}'[use form feeds instead of newlines to separate pages]' ) + ;; + esac + optA=( -A '[-+]?*' ) # a single '-' is a valid file name (stdin) +fi + +_arguments -C -s -S $optA : $specs && ret=0 + +case $state in + char_number) + # argument for option -e (and -i, -n) can be -e. -e10 or -e.10 + # where . is any non-digit character + if compset -p 1; then + _message "$state_descr" && ret=0 + else + _message "a character [tab] (optional), and $state_descr" && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps index 98dcd1cd0..9b54cbcc6 100644 --- a/Completion/Unix/Command/_ps +++ b/Completion/Unix/Command/_ps @@ -236,8 +236,8 @@ else [[ -z "$state" ]] && return ret fi -_values -s '' -S ' ' 'options' $bsd && ret=0 -_values -S ' ' 'options' $bsdarg && ret=0 +_values -s '' -S ' ' 'option' $bsd && ret=0 +_values -S ' ' 'option' $bsdarg && ret=0 if [[ -z $pids ]]; then _pids && ret=0 fi diff --git a/Completion/Unix/Command/_ptx b/Completion/Unix/Command/_ptx new file mode 100644 index 000000000..12f1d2c9a --- /dev/null +++ b/Completion/Unix/Command/_ptx @@ -0,0 +1,54 @@ +#compdef ptx + +local -a specs optA + +# common specs +specs=( + '(hv -b --break-file)'{-b+,--break-file=}'[use characters in specified file as word separators]:break file:_files' + '(hv -f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case for sorting]' + '(hv -g --gap-size)'{-g+,--gap-size=}'[specify gap size between output fields]:number of chars [3]: ' + '(hv -i --ignore-file)'{-i+,--ignore-file=}'[ignore keywords listed in specified file]:ignore file:_files' + '(hv -o --only-file)'{-o+,--only-file=}'[use only the keywords listed in specified file]:only file:_files' + '(hv -r --references)'{-r,--references}'[first field of each line is a reference]' + '(hv -w --width)'{-w+,--width=}'[specify page width, reference excluded]:number of characters [72]: ' +) + +if _pick_variant gnu=GNU unix --version; then + # GNU coreutils 8.32 + specs+=( + '(hv -A --auto-reference)'{-A,--auto-reference}'[output automatically generated references]' + '(hv -G --traditional)'{-G,--traditional}"[behave more like System V 'ptx']" + '(hv -F --flag-truncation)'{-F+,--flag-truncation=}'[specify string for flagging line truncations]:string [/]: ' + '(hv -M --macro-name)'{-M+,--macro-name=}"[specify macro name to use instead of 'xx']:macro name: " + '(hv)-O[generate output as roff directives]' + '(hv -R --right-side-refs)'{-R,--right-side-refs}'[put references at right, not counted in -w]' + '(hv -S --sentence-regexp)'{-S+,--sentence-regexp=}'[specify regexp for end of lines/sentences]:regexp: ' + '(hv)-T[generate output as TeX directives]' + '(hv -W --word-regexp -b --break-file)'{-W+,--word-regexp=}'[specify regexp to match each keyword]:regexp: ' + '(hv)--format=[specify the output format]:format:(roff tex)' + !{-t,--typeset-mode}'[not implemented]' + + hv + '(: * -)--help[display help and exit]' + '(: * -)--version[output version information and exit]' + ) + if (( $words[(I)(-G|--traditional)] )); then + specs+=( + arg '1:input file:_files' '2:output file:_files' ) + else + specs+=( + arg '(-G --traditional)*:input file:_files' ) + fi +else + # The only non-GNU implementation I can find is the one in + # heirloom-doctools. FreeBSD has a package for this. + specs=( ${specs:#(|*\))--*} ) # remove long options + # remove '+' from -b+ -g+ -i+ -o+ -w+ + local MATCH MBEGIN MEND + specs=( ${specs/(#m)-[bgiow]+/$MATCH[1,-2]} ) + specs+=( + '-t[prepare output for typesetter]' + '1:input file:_files' + '2:output file:_files' + ) + optA=( -A '-?*' ) # a single '-' is a valid file name (stdin) +fi + +_arguments -s -S $optA : $specs diff --git a/Completion/Unix/Command/_pv b/Completion/Unix/Command/_pv index 68f8e8586..d02d3a35d 100644 --- a/Completion/Unix/Command/_pv +++ b/Completion/Unix/Command/_pv @@ -25,7 +25,7 @@ _arguments -s -S $args \ '(-q --quiet)'{-q,--quiet}"[don't output any transfer information at all, useful with -L]" \ '(-W --wait)'{-W,--wait}'[display nothing until first byte transferred]' \ '(-D --delay-start -R --remote)'{-D+,--delay-start=}'[display nothing until delay has passed]:delay (seconds)' \ - '(-s --size)'{-s+,--size=}'[set estimated data size]:size (bytes):->size-unit' \ + '(-s --size)'{-s+,--size=}'[set estimated data size]: :_numbers -u bytes size K M G T' \ '(-l --line-mode -R --remote)'{-l,--line-mode}'[count lines instead of bytes]' \ '(-0 --null -l --line-mode)'{-0,--null}'[lines are null-terminated]' \ '(-i --interval)'{-i+,--interval=}'[update every after specified interval]:interval (seconds) [1]' \ @@ -34,8 +34,8 @@ _arguments -s -S $args \ '(-N --name)'{-N+,--name=}'[prefix visual information with given name]:name' \ '(-f --force -R --remote)'{-f,--force}'[output even if standard error is not a terminal]' \ '(-c --cursor -R --remote)'{-c,--cursor}'[use cursor positioning escape sequences]' \ - '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]:rate (bytes per second):->size-unit' \ - '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]:size (bytes):->size-unit' \ + '(-L --rate-limit)'{-L+,--rate-limit=}'[limit transfer rate]: :_numbers -u "bytes per second" rate K M G T' \ + '(-B --buffer-size)'{-B+,--buffer-size=}'[use a buffer size of given size]: :_numbers -u bytes size K M G T' \ '(-C --no-splice)'{-C,--no-splice}'[never use splice(), always use read/write]' \ '(-R --remote)*'{-E,--skip-errors}"[skip read errors in input${Edesc}]" \ '(-S --stop-at-size -R --remote)'{-S,--stop-at-size}'[stop after --size bytes have been transferred]' \ @@ -70,18 +70,6 @@ case $state in _pids $suf && ret=0 fi ;; - size-unit) - if compset -P '<->'; then - _tags values units - else - _tags values - fi - while _tags; do - _requested values && _message -e values "$state_descr" && ret=0 - _requested units expl unit compadd -o nosort - K M G T && ret=0 - (( ret )) || break - done - ;; esac return ret diff --git a/Completion/Unix/Command/_python b/Completion/Unix/Command/_python index f10106f9b..e5bac18bb 100644 --- a/Completion/Unix/Command/_python +++ b/Completion/Unix/Command/_python @@ -1,7 +1,7 @@ #compdef -P python[0-9.]# # Python 2.7 -# Python 3.4 +# Python 3.9 local curcontext="$curcontext" state state_descr line typeset -A opt_args @@ -11,7 +11,9 @@ if _pick_variant python3=Python\ 3 python2 --version; then args=( '(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' '(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]' + '--check-hash-based-pycs[configure how Python evaluates up-to-dateness of hash-based .pyc files]:mode:(always default never)' "-I[isolate Python from the user's environment]" + '-q[do not print version and copyright messages]' '-X[set implementation-specific option]:option' ) else @@ -37,7 +39,8 @@ _arguments -C -s -S "$args[@]" \ "-s[don't add user site directory to sys.path]" \ "-S[don't imply 'import site' on initialization]" \ '-u[unbuffered binary stdout and stderr]' \ - '-v[verbose (trace import statements)]' \ + '(-vv)-v[trace module initialization and cleanup]' \ + '(-v)-vv[in addition to -v, trace all files checked when searching for a module]' \ '(1 * -)-V[display version information]' \ '-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \ '-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \ diff --git a/Completion/Unix/Command/_qemu b/Completion/Unix/Command/_qemu index 3c21c3e74..7bc02c30c 100644 --- a/Completion/Unix/Command/_qemu +++ b/Completion/Unix/Command/_qemu @@ -6,7 +6,7 @@ _qemu_log_items () { [[ $hline[1] = Log ]] && continue opts=($opts "${hline[1]}[${hline[2,-1]}]") done - _values -s , 'log items' $opts + _values -s , 'log item' $opts } local _qemu_machines @@ -19,8 +19,8 @@ _arguments \ '-boot[specify which image to boot from]:boot device:((a\:floppy\ image\ a c\:hard\ disk d\:cdrom))' \ '-snapshot[write to temporary files instead of disk image files]' \ '-no-fd-bootchk[disable boot sig checking for floppies in Bochs BIOS]' \ - '-m[virtual RAM size (default=128)]:megs:' \ - '-smp[set the number of CPUs (default=1)]:number of CPUs:' \ + '-m[specify virtual RAM size]:size (MB) [128]' \ + '-smp[set the number of CPUs]:number of CPUs [1]' \ '-nographic[disable graphical output]' \ '-vnc[listen on VNC display]:display:' \ '-k[use keyboard layout]:keyboard layout language:(ar de-ch es fo fr-ca hu ja mk no pt-br sv da en-gb et fr fr-ch is lt nl pl ru th de en-us fi fr-be hr it lv nl-be pt sl tr)' \ @@ -45,7 +45,7 @@ _arguments \ '-s[wait gdb connection to port 1234]' \ '-p[change gdb connection port]:port:_ports' \ '-S[do not start CPU at startup]' \ - '-d[output log in /tmp/qemu.log]:log items:_qemu_log_items' \ + '-d[output log in /tmp/qemu.log]:log item:_qemu_log_items' \ '-hdachs[force hard disk 0 geometry (usually qemu can guess it)]:hd0 geometry c,h,s:' \ '-vga[select video card type]:card type:(std cirrus vmware qxl xenfb none)' \ '-no-acpi[disable ACPI]' \ diff --git a/Completion/Unix/Command/_quilt b/Completion/Unix/Command/_quilt index 76dda222f..01f8cfb83 100644 --- a/Completion/Unix/Command/_quilt +++ b/Completion/Unix/Command/_quilt @@ -6,6 +6,8 @@ local verbose='(-h)-v[verbose, more user friendly output]' local color='(-h)--color=[use syntax coloring]:color:(always auto never)' local pstyle='(-h)-p+[select patch style]:patch style:((0\:exclude\ top-level\ directory 1\:use\ .orig\ on\ top-level\ directory ab\:use\ a\ or\ b\ as\ top-level\ directory))' local -a pform rcfile +local k + pform=( '(-U -c -C -h)-u[create a unified diff]' '(-u -c -C -h)-U+[create a unified diff with num lines of context]:lines' @@ -34,25 +36,92 @@ _quilt_unapplied() { _arguments $help \ '--trace[run the command in bash trace mode]' \ - '--quiltrc=[use the specified configuration file]:files:_files' \ + '--quiltrc=[use the specified configuration file]:file:_files' \ '--version[print the version number and exit]' \ - ':quilt command:(add annotate applied delete diff edit files fold fork graph - grep header import mail new next patches pop previous push refresh remove - rename revert series setup snapshot top unapplied upgrade)' \ + ':quilt command:->cmd' \ '*:: :->subcmd' && return -[[ -z $state ]] && return 1 +case $state in + ('') + return 1 + ;; + + (cmd) + # Divide the subcommands to categories. The categorization is our own; + # it's not based on any preexisting categorization in the quilt docs. + local -a manip=( + add:'add files to a patch' + delete:'remove a patch from the series' + edit:'add files to the topmost patch and open them in $EDITOR' + fold:'integrate an external patch into the topmost patch' + fork:'replace the topmost patch with a copy' + import:'add external patches to the series' + new:'add an empty patch to the series' + refresh:'update a patch with in-tree edits' + remove:'remove files from a given patch' + rename:"change a patch's name" + ) + local -a tree=( + pop:'unapply a patch to the tree' + push:'apply a patch to the tree' + revert:'discard in-tree changes to files in a given patch' + ) + local -a other=( + grep:'print file lines matching pattern' + header:"print or change a patch's prologue" + mail:'send patches by email' + setup:'initialize a source tree' + snapshot:'save a snapshot of the tree to diff against' + upgrade:'upgrade quilt metadata' + ) + local -a interrogate=( + annotate:'show which patches modify which lines' + applied:'print the list of patches up to a given patch' + diff:'print differences between files' + files:'print the list of files that a given patch changes' + graph:'generate a patches dependency graph' + next:'print the name of the patch that follows a given patch' + patches:'print the list of patches that touch a given file' + previous:'print the name of the patch that precedes a given patch' + series:'print the list of all patches' + top:'print the name of the last applied patch' + unapplied:'print the list of patches following a given patch' + ) + local -A cmdtypes=( + [manip]='series manipulator commands' + [tree]='tree manipulator commands' + [other]='other commands' + [interrogate]='series interrogator commands' + ) + local ret=1 + _tags ${cmdtypes// /-} + while _tags; do + for k in ${(ok)cmdtypes}; do + if _requested ${cmdtypes[$k]// /-} + then + _describe -t ${cmdtypes[$k]// /-} ${cmdtypes[$k]} $k && + ret=0 + fi + done + done + return ret + ;; + + (subcmd) + ;; +esac + rcfile=( ${opt_args[--quiltrc]:+--quiltrc=${opt_args[--quiltrc]}} ) case $words[1] in add) _arguments -S $help \ '-P+[specify patch to add files to]:patch:_quilt_applied' \ - '*:files:_files' && return + '*:file:_files' && return ;; annotate) _arguments $help \ '-P[stop checking for changes at the specified rather than the topmost patch]:patch:_quilt_series' \ - ':files:_files' && return + ':file:_files' && return ;; applied) _arguments $help ':quilt series:_quilt_series' && return ;; delete) @@ -73,9 +142,9 @@ case $words[1] in '(-P -z)--snapshot[diff against snapshot]' \ '--diff=[use the specified utility for generating the diff]:diff utility:_command_names -e' \ '--sort[sort files by name]' \ - '*:files:_files' && return + '*:file:_files' && return ;; - edit) _arguments $help '*:files:_files' && return ;; + edit) _arguments $help '*:file:_files' && return ;; files) _arguments -s $help $verbose \ '-a[list all files in all applied patches]' \ @@ -118,14 +187,14 @@ case $words[1] in '-P+[patch filename to use inside quilt]:quilt select patch filename: ' \ '-f[overwrite/update existing patches]' \ '-d+[header resolution when overwriting in existing patch]:resolution:((a\:all\ headers n\:new\ headers o\:old\ headers))' \ - '*:files:_files' && return + '*:file:_files' && return ;; mail) _arguments $help \ '(-h -M)-m[introduction text to use]:introduction text' \ '(-h -m)-M[read introduction text from file]:file:_files' \ '--prefix=[use an alternate prefix in the bracketed part of the subjects generated]:quilt select prefix: ' \ - '--mbox=[store all messages in the specified file in mbox format]:files:_files' \ + '--mbox=[store all messages in the specified file in mbox format]:file:_files' \ '--send[send the messages directly]' \ '--sender=[specify envelope sender address to use]:sender:_email_addresses -c' \ '--from=[from header]:address:_email_addresses' \ @@ -133,13 +202,13 @@ case $words[1] in '*--to=[append a recipient to the To header]:recipient:_email_addresses' \ '*--cc=[append a recipient to the Cc header]:recipient:_email_addresses' \ '*--bcc=[append a recipient to the Bcc header]:recipient:_email_addresses' \ - '--signature=[append specified signature file to messages]:files:_files' \ + '--signature=[append specified signature file to messages]:file:_files' \ '--reply-to=[add reply address to message]:address:_email_addresses' \ '*:patch:_quilt_series' && return ;; new) _arguments $help $pstyle ':patch name' && return ;; next) _arguments $help ':patch:_quilt_series' && return ;; - patches) _arguments -S $help $verbose $color '*:files:_files' && return ;; + patches) _arguments -S $help $verbose $color '*:file:_files' && return ;; pop) _arguments -s $help $verbose \ '-a[remove all applied patches]' \ @@ -184,7 +253,7 @@ case $words[1] in revert) _arguments $help \ '-P[revert changes in the named patch]:patch:_quilt_series' \ - '*:files:_files' && return + '*:file:_files' && return ;; series) _arguments $help $verbose $color && return ;; setup) @@ -192,7 +261,9 @@ case $words[1] in '-d[specify path prefix for resulting source tree]:prefix:_files -W / -P /' \ '--sourcedir[specify location of package sources]:directory:_directories' \ '--fuzz=[set the maximum fuzz factor]:factor' \ - ':files:_files' && return + '(--fast)--slow[use the original, slow method to process the spec file]' \ + '(--slow)--fast[use an alternative, faster method to process the spec file]' \ + ':file:_files' && return ;; snapshot) _arguments $help '-d[only remove current snapshot]' && return ;; unapplied) _arguments $help ':patch:_quilt_series' && return ;; diff --git a/Completion/Unix/Command/_rake b/Completion/Unix/Command/_rake index 8814edaa5..10d621991 100644 --- a/Completion/Unix/Command/_rake +++ b/Completion/Unix/Command/_rake @@ -37,7 +37,9 @@ case "$state" in ;; target) local -a targets - targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} ) + local all + zstyle -t ":completion:${curcontext}:targets" extended && all=-A + targets=( ${${(f)"$(_call_program targets $words[1] $all -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} ) if (( ! ${targets[(I)rake aborted!]} )) then _describe -t targets 'rake target' targets && ret=0 else diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar index 68982be60..d1d381974 100644 --- a/Completion/Unix/Command/_rar +++ b/Completion/Unix/Command/_rar @@ -4,6 +4,8 @@ local common expl common=( '-ad[append archive name to destination path]' + '-ad1[create a separate folder for files unpacked from each archive]' + "-ad2[like -ad1 but use archives' own folders]" '-ap[set path inside archive]' '-av\-[disable authenticity verification check]' '-c\-[disable comments show]' @@ -13,6 +15,7 @@ common=( '-dh[open shared files]' '-ep[exclude paths from name]' '-f[freshen files]' + '-idn[hide archived names]' '-idp[disable percentage display]' '-ierr[send all messages to stderr]' '-inul[disable all messages]' @@ -27,6 +30,7 @@ common=( '-tb+[process files modified before a date]:date (YYYYMMDDHHMMSS)' '-tn+[process files newer than a specified time]:time' '-to+[process files older than a specified time]:time' + '-ts-[save or restore time]:time:((m\:modification c\:change a\:access p\:preserve))' '-u[update files]' '-v[create volumes with size autodetection or list all volumes]' '-ver[file version control]' diff --git a/Completion/Unix/Command/_rclone b/Completion/Unix/Command/_rclone index 40f06e0ba..a2e3429f5 100644 --- a/Completion/Unix/Command/_rclone +++ b/Completion/Unix/Command/_rclone @@ -62,7 +62,7 @@ _arguments -C \ '--backup-dir[make backups into hierarchy based at specified directory]:directory:_directories' \ '--bind[specify socal address to bind to for outgoing connections]:IPv4, IPv6 or name' \ '--buffer-size[specify in memory buffer size when reading files for each --transfer]:size [16M]' \ - '--bwlimit[specify bandwidth limit]:BwTimetable (kBytes/s or b|k|M|G suffix)' \ + '--bwlimit[specify bandwidth limit]: :_numbers -u kBytes/s limit b k M G' \ '--cache-dir[specify directory rclone will use for caching]:directory [~/.cache/rclone]:_directories' \ '--checkers[specify number of checkers to run in parallel]:number [8]': \ '(-c --checksum)'{-c,--checksum}'[skip based on checksum & size, not mod-time & size]' \ @@ -79,7 +79,7 @@ _arguments -C \ '--dump-bodies[dump HTTP headers and bodies - may contain sensitive info]' \ '--dump-headers[dump HTTP headers - may contain sensitive info]' \ '--exclude[exclude files matching pattern]:stringArray' \ - '--exclude-from[read exclude patterns from file]:files:_files' \ + '--exclude-from[read exclude patterns from file]:file:_files' \ '--exclude-if-present[exclude directories if filename is present]:string' \ '--fast-list[use recursive list if available]' \ '--files-from[read list of source-file names from file]:file:_files' \ @@ -99,15 +99,15 @@ _arguments -C \ '--log-format[specify comma separated list of log format options]:string ["date,time"]' \ '--log-level[specify log level]:string [NOTICE]:(DEBUG INFO NOTICE ERROR)' \ '--low-level-retries[number of low level retries to do]:int [10]' \ - '--max-age[only transfer files younger than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \ + '--max-age[only transfer files younger than specified age]: :_numbers -u seconds age ms\:milliseconds \:s\:seconds m\:minutes h\:hours d\:days w\:weeks M\:months y\:years' \ '--max-backlog[maximum number of objects in sync or check backlog]:int [10000]' \ '--max-delete[when synchronizing, limit the number of deletes]:delete limit [-1]' \ '--max-depth[limit the recursion depth]:depth [-1]' \ - '--max-size[only transfer files smaller than this in k or suffix b|k|M|G]:int [default off]' \ + '--max-size[only transfer files smaller than specified size]: :_numbers -u kBytes size \:k M G' \ '--max-transfer[maximum size of data to transfer]:int [default off]' \ '--memprofile[write memory profile to file]:file:_files' \ - '--min-age[only transfer files older than this in s or suffix ms|s|m|h|d|w|M|y]:duration [default off]' \ - '--min-size[only transfer files bigger than this in k or suffix b|k|M|G]:int [default off]' \ + '--min-age[only transfer files older than specified age]: :_numbers -u seconds age ms\:milliseconds \:s\:seconds m\:minutes h\:hours d\:days w\:weeks M\:months y\:years' \ + '--min-size[only transfer files bigger than specified size]: :_numbers -u kBytes size \:k M G' \ '--modify-window[specify max time delta to be considered the same]:duration [1ns]' \ '--multi-thread-cutoff[use multi-threaded downloads for files above specified size]:size (250M)' \ '--multi-thread-streams[specify max number of streams to use for multi-threaded downloads]:number (4)' \ @@ -339,8 +339,8 @@ _arguments -C \ if [[ $state == 'files_or_remotes' ]]; then remotes=( $(_call_program rclone-remotes rclone listremotes) ) _alternative \ - "remote:rclone-remotes:compadd -a remotes" \ - "file:files:_files" && ret=0 + "rclone-remotes:remote:compadd -a remotes" \ + "files:file:_files" && ret=0 fi return ret diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 42094742e..fc0fb7ce1 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -18,7 +18,7 @@ args=( '(-c --archive-index)'{-c,--archive-index}'[show symbol/file index in an archive]' \*{-x,--hex-dump=}"[dump contents of specified section as bytes]:section:($sections)" \*{-p,--string-dump=}"[dump contents of specified section as strings]:section:($sections)" - '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o R t U u T g A c k K)' + '-w+[show the contents of DWARF2 debug sections]::debug section:(l L i a p r m f F s o O R t U u T g A c k K)' '--debug-dump=[show the contents of DWARF2 debug sections]::section:(rawline decodedline info abbrev pubnames aranges macro frames frames-interp str loc Ranges pubtypes gdb_index trace_info trace_abbrev trace_aranges addr cu_index links follow-links)' '(-I --histogram)'{-I,--histogram}'[show histogram of bucket list lengths]' '(-W --wide)'{-W,--wide}'[allow output width to exceed 80 characters]' @@ -43,8 +43,19 @@ case $variant in '--dyn-syms[show dynamic symbol table]' ) ;| + elfutils|elftoolchain) + args+=( + '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]' + ) + ;| binutils) args+=( + '!(-C --demangle)--no-demangle' + '(--demangle)-C[decode symbol names]' + '(-C)--demangle=-[decode symbol names]::style [auto]:(auto gnu lucid arm hp edg gnu-v3 java gnat)' + '!(--no-recurse-limit)--recurse-limit' + '--no-recurse-limit[disable demangling recursion limit]' + '(-L --lint --enable-checks)'{-L,--lint,--enable-checks}'[display warning messages for possible problems]' \*{-R,--relocated-dump=}"[dump contents of specified section as relocated bytes]:section:($sections)" "--dwarf-depth=[don't show DIEs at greater than specified depth]:depth" '--dwarf-start=[show DIEs starting at specified depth or deeper]:depth' @@ -52,6 +63,7 @@ case $variant in '--ctf-parent=[use specified section as the CTF parent]:section' '--ctf-symbols=[use specified section as the CTF external symbol table]:section' '--ctf-strings=[use specified section as the CTF external string table]:section' + '(-T --silent-truncation)'{-T,--silent-truncation}"[if a symbol name is truncated, don't add ... suffix]" ) ;; elfutils) @@ -60,7 +72,6 @@ case $variant in '--elf-section[used specified section as ELF input data]::section' '(-e --exception)'{-e,--exception}'[show sections for exception handling]' '(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]" - '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]' '(--symbols)-s[show symbol table]' '(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)' '(--notes)-n[show core notes (if present)]' diff --git a/Completion/Unix/Command/_renice b/Completion/Unix/Command/_renice index cbdac8cae..3b0457348 100644 --- a/Completion/Unix/Command/_renice +++ b/Completion/Unix/Command/_renice @@ -12,7 +12,7 @@ else _describe -o option opts && ret=0 case ${(v)words[(I)-?]} in - -g) _message -e pgids 'process group ID' && ret=0 ;; + -g) _pgids && ret=0 ;; -u) _users && ret=0 ;; *) _pids && ret=0;; esac diff --git a/Completion/Unix/Command/_ri b/Completion/Unix/Command/_ri index 070f46ac2..4d5a72985 100644 --- a/Completion/Unix/Command/_ri +++ b/Completion/Unix/Command/_ri @@ -6,26 +6,29 @@ typeset -A opt_args _arguments -C \ '(- *)'{-h,--help}'[print help information and exit]' \ '(- *)'{-v,--version}'[display the version of ri]' \ - '*'{-d,--doc-dir}'[directory to search for documentation]:ri doc directory:_files -/' \ - '(-f --fmt --format)'{-f,--fmt,--format}'[format to use when displaying output]:output format:(ansi bs html plain simple)' \ + '*'{-d+,--doc-dir=}'[directory to search for documentation]:ri doc directory:_directories' \ + '(-f --format)'{-f+,--format=}'[format to use when displaying output]:output format [bs]:(ansi bs markdown rdoc)' \ '(-T --no-pager)'{-T,--no-pager}'[send output directly to stdout]' \ - '(-i, --interactive)'{-i,--interactive}'[interactive mode]' \ + '(-i --interactive)'{-i,--interactive}'[interactive mode]' \ + '(-a --all)'{-a,--all}'[show all documentation for a class or module]' \ + '(-l --list)'{-l,--list}'[list classes ri knows about]' \ '--list-doc-dirs[list the directories from which ri will source documentation]' \ - '(-w --width)'{-w,--width}'[set the width of the output]:output width:' \ - '--no-standard-docs[do not include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]' \ - '(--no-use-cache --use-cache)--'{no-,}'use-cache[whether or not to use ri'\''s cache]' \ - '(--no-system --system)--'{no-,}'system[include documentation from Ruby'\''s standard library]' \ + '(-w --width)'{-w+,--width=}'[set the width of the output]:output width [72]' \ + '(-l --list)--server=-[run RDoc server on the given port]::port [8214]:_ports' \ + "--no-standard-docs[don't include documentation from the Ruby standard library, site_lib, installed gems, or ~/.rdoc]" \ + '(--no-use-cache --use-cache)--'{no-,}"use-cache[whether or not to use ri's cache]" \ + '(--no-system --system)--'{no-,}"system[include documentation from Ruby's standard library]" \ '(--no-site --site)--'{no-,}'site[include documentation from libraries installed in site_lib]' \ '(--no-gems --gems)--'{no-,}'gems[include documentation from RubyGems]' \ '(--no-home --home)--'{no-,}'home[include documentation stored in ~/.rdoc]' \ - '*:ri name:->ri-name' && ret=0 + '--profile[run with the Ruby profiler]' \ + '--dump=[dump data from an ri cache or data file]:cache:_files' \ + '*:ri name:->ri-name' && return if [[ "$state" = ri-name ]]; then local -a ri_dirs ri_ext ri_names ri_wants ri_names local class_dir esc_name dir curtag tag descr expl - ret=1 - if "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e 1 >/dev/null 2>&1; then # Old-style Ruby 1.8.x RI ri_dirs=( ${(f)"$(_call_program ri-names "ruby${words[1]#ri}" -rrdoc/ri/ri_options -e '"o = RI::Options.instance; o.parse(ARGV); o.path.each { |p| puts p }"' -- ${(kv)opt_args[(I)-d|--doc-dir|--(system|site|gems|home)]})"} ) diff --git a/Completion/Unix/Command/_rm b/Completion/Unix/Command/_rm index ea9190de2..e66b77fa4 100644 --- a/Completion/Unix/Command/_rm +++ b/Completion/Unix/Command/_rm @@ -69,7 +69,7 @@ _arguments -C -s -S $opts \ case $state in (file) - line[CURRENT]=() + (( CURRENT > 0 )) && line[CURRENT]=() line=( ${line//(#m)[\[\]()\\*?#<>~\^\|]/\\$MATCH} ) _files -F line && ret=0 ;; diff --git a/Completion/Unix/Command/_route b/Completion/Unix/Command/_route index 06cca8d99..95df6d936 100644 --- a/Completion/Unix/Command/_route +++ b/Completion/Unix/Command/_route @@ -135,7 +135,7 @@ case $OSTYPE in openbsd*) subcmds+=( exec 'execute a command with alternate routing table' ) args+=( - '-T+[select specified alternate routing table]:table id' + '-T+[select specified alternate routing table]:routing table:_routing_tables' ) modifiers+=( -sa diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync index 56efd7b13..eb906e974 100644 --- a/Completion/Unix/Command/_rsync +++ b/Completion/Unix/Command/_rsync @@ -71,31 +71,41 @@ _rsync_info() { local opts opts=( ${${(M)${(f)"$(_call_program values $words[1] --info=help)"}:#*Mention*}/ ##Me/[me} ) (( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] ) - _values -s , 'info options' $opts ALL NONE HELP + _values -s , 'info option' $opts ALL NONE HELP } _rsync_debug() { local opts opts=( ${${(M)${(f)"$(_call_program values $words[1] --debug=help)"}:#*Debug*}/ ##De/[de} ) (( $#opts )) && opts=( '(ALL NONE HELP)'${^opts}\] ) - _values -s , 'debug options' $opts ALL NONE HELP + _values -s , 'debug option' $opts ALL NONE HELP } _rsync_files() { _alternative "files:file:_files" "remote-files:remote file:_rsync_remote_files" } +_rsync_users_groups() { + local -a suf + if compset -P '*:'; then + _groups + else + compset -S ':*' || suf=( -qS ':' ) + _users $suf + fi +} + _rsync() { _arguments -s \ '*'{-v,--verbose}'[increase verbosity]' \ {--no-v,--no-verbose}'[turn off --verbose]' \ - '--bwlimit=[limit I/O bandwidth]:limit (KiB per second)' \ + '--bwlimit=[limit I/O bandwidth]: :_numbers -f -u "KiB per second" -d 1g limit B K M G T P' \ '--outbuf=[set output buffering]:buffering:(none line block)' \ '--port=[specify alternate port number]:port:(873)' \ '--address=[bind to the specified address]:bind address:_bind_addresses' \ '--log-file-format=[log updates using specified format]:format' \ '--log-file=[log what rsync is doing to the specified file]:file:_files' \ - '(-T --temp-dir)'{-T,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \ + '(-T --temp-dir)'{-T+,--temp-dir=}'[create temporary files in specified directory]:directory:_directories' \ '--sockopts=[specify custom TCP options]' \ '(-4 -6 --ipv4 --ipv6)'{-4,--ipv4}'[prefer IPv4]' \ '(-4 -6 --ipv4 --ipv6)'{-6,--ipv6}'[prefer IPv6]' \ @@ -104,11 +114,12 @@ _rsync() { '--config=[specify alternate rsyncd.conf file]:file:_files' \ '--daemon[run as an rsync daemon]' \ '--detach[detach from the parent]' \ - '(-M --dparam)'{-M,--dparam=}'[override global daemon config parameter]:config parameter' \ + '(-M --dparam)'{-M+,--dparam=}'[override global daemon config parameter]:config parameter' \ '--no-detach[do not detach from the parent]' \ - client \ '(-)--help[display help information]' \ '*: :_rsync_files' \ + '--stderr=[change stderr output mode]:output mode [errors]:(errors all client)' \ '(-q --quiet)'{-q,--quiet}'[suppress non-error messages]' \ '--no-motd[suppress the daemon message-of-the-day output]' \ '(-c --checksum)'{-c,--checksum}'[skip based on checksums, not mod-time & size]' \ @@ -121,7 +132,7 @@ _rsync() { {--no-implied-dirs,--no-i-d}'[do not send implied dirs with --relative]' \ '(-b --backup)'{-b,--backup}'[make backups into hierarchy at indicated directory]' \ '--backup-dir=[make backups into specified directory]:backup directory:_directories' \ - '--suffix=[set backup suffix]:suffix:(\~)' \ + '--suffix=[set backup suffix]:suffix [~]' \ '(-u --update)'{-u,--update}'[skip files that are newer on the receiving side]' \ '--inplace[update destination files in-place]' \ '(--append-verify)--append[append data onto shorter files]' \ @@ -131,6 +142,7 @@ _rsync() { '--fake-super[use xattrs to save all file attributes]' \ '(-d --dirs)'{-d,--dirs}'[transfer directories without recursing]' \ {--no-d,--no-dirs}'[turn off --dirs]' \ + "--mkpath[create the destination's path component]" \ '(-l --links)'{-l,--links}'[copy symlinks as symlinks]' \ {--no-l,--no-links}'[turn off --links]' \ '(-L --copy-links)'{-L,--copy-links}'[transform symlinks into referent file/dir]' \ @@ -142,6 +154,7 @@ _rsync() { '(-K --keep-dirlinks)'{-K,--keep-dirlinks}'[treat symlinked dir on receiver as dir]' \ '(-p --perms -E --executability)'{-p,--perms}'[preserve permissions]' \ {--no-p,--no-perms}'[turn off --perms]' \ + '--fileflags[preserve file-flags (aka chflags)]' \ '(-E --executability)'{-E,--executability}'[preserve executability]' \ '(-o --owner)'{-o,--owner}'[preserve owner]' \ {--no-o,--no-owner}'[turn off --owner]' \ @@ -150,22 +163,25 @@ _rsync() { '(--devices --specials)-D[same as --devices --specials]' \ '(-D)--devices[preserve devices]' \ '--no-devices[turn off --devices]' \ - '--copy-devices[copy device contents as regular file]' \ '(-D)--specials[preserve special files]' \ '--no-specials[turn off --specials]' \ '--no-D[turn off --devices and --specials]' \ - '(-t --times)'{-t,--times}'[preserve times]' \ + '(-t --times)'{-t,--times}'[preserve modification times]' \ {--no-t,--no-times}'[turn off --times]' \ + \*{-U,--atimes}'[preserve access (use) times]' \ + '--open-noatime[avoid changing the atime on opened files]' \ + '(--crtimes -N)'{--crtimes,-N}'[preserve create times (newness)]' \ '(-O --omit-dir-times)'{-O,--omit-dir-times}'[omit directories when preserving times]' \ '(-J --omit-link-times)'{-J,--omit-link-times}'[omit symlinks when preserving times]' \ - '--chmod[change destination permissions]:mods' \ + '--chmod=[change destination permissions]:permissions' \ '(-S --sparse)'{-S,--sparse}'[handle sparse files efficiently]' \ + '--write-devices[write to devices as files (implies --inplace)]' \ '(-n --dry-run)'{-n,--dry-run}'[show what would have been transferred]' \ '(-W --whole-file)'{-W,--whole-file}'[copy files whole (without delta-transfer algorithm)]' \ {--no-W,--no-whole-file}'[turn off --whole-file]' \ - '--checksum-choice=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \ + '(--cc --checksum-choice)'{--cc,--checksum-choice}'=[choose the checksum algorithms]:algorithm:_sequence -n 2 compadd - auto md4 md5 none' \ '(-x --one-file-system)'{-x,--one-file-system}"[don't cross filesystem boundaries]" \ - '(-B --block-size)'{-B,--block-size=}'[force a fixed checksum block-size]:block size' \ + '(-B --block-size)'{-B+,--block-size=}'[force a fixed checksum block-size]: :_numbers -f -u bytes -d 1g "block size" B K M G T P' \ '(-e --rsh)'{-e+,--rsh=}'[specify the remote shell to use]:remote-shell command:(rsh ssh)' \ '--rsync-path=[specify path to rsync on the remote machine]:remote command' \ '--ignore-existing[ignore files that already exist on receiving side]' \ @@ -179,10 +195,14 @@ _rsync() { '(--del --delete-before --delete-during --delete-after)--delete-delay[receiver deletes after transfer]' \ '--delete-excluded[also delete excluded files on the receiving side]' \ '--ignore-errors[delete even if there are I/O errors]' \ - '--force[force deletion of directories even if not empty]' \ - '--max-delete=[do not delete more than NUM files]:number' \ - '--max-size=[do not transfer any file larger than specified size]:number' \ + --force{,-delete}'[force deletion of directories even if not empty]' \ + '--force-change[affect user-/system-immutable files/dirs]' \ + '--force-uchange[affect user-immutable files/dirs]' \ + '--force-schange[affect system-immutable files/dirs]' \ + "--max-delete=[don't delete more than NUM files]: :_numbers -f -u bytes size B K M G T P" \ + "--max-size=[don't transfer any file larger than specified size]: :_numbers -f -u bytes size B K M G T P" \ '--min-size=[do not transfer any file smaller than specified size]:number' \ + '--max-alloc=[set limit to individual memory allocation]: :_numbers -f -u bytes -d 1g size B K M G T P' \ '(-P)--partial[keep partially transferred files]' \ '--no-partial[turn off --partial]' \ '--partial-dir=[put a partially transferred file into specified directory]:directory:_directories' \ @@ -201,10 +221,11 @@ _rsync() { '(--compare-dest --link-dest)*--copy-dest=[like --compare-dest, but also includes copies of unchanged files]:directory:_directories' \ '(--compare-dest --copy-dest)*--link-dest=[hardlink to files in specified directory hierarchy when unchanged]:directory:_directories' \ '(-z --compress)'{-z,--compress}'[compress file data during the transfer]' \ - '--compress-level=[explicitly set compression level]:number' \ + '(--zc --compress-choice)'{--zc,--compress-choice}'=[override the automatic negotiation of the compression algorithm]:algorithm:(zstd lz4 zlibx zlib none)' \ + '(--zl --compress-level)'{--zl,--compress-level}'=[explicitly set compression level]:number' \ '--skip-compress=[skip compressing files with a listed suffix]:suffixes' \ '(-C --cvs-exclude)'{-C,--cvs-exclude}'[auto-ignore files the same way CVS does]' \ - '*'{-f=,--filter=}'[add a file-filtering rule]:rule' \ + '*'{-f+,--filter=}'[add a file-filtering rule]:rule' \ '*-F[same as --filter="dir-merge /.rsync-filter", repeated: --filter="- .rsync-filter"]' \ '--exclude-from=[read exclude patterns from specified file]:file:_files' \ '*--exclude=[exclude files matching pattern]:pattern' \ @@ -213,6 +234,7 @@ _rsync() { '--files-from=[read list of source-file names from specified file]:file:_files' \ '(-0 --from0)'{-0,--from0}'[all *-from file lists are delimited by nulls]' \ '(-s --protect-args)'{-s,--protect-args}'[no space-splitting; only wildcard special-chars]' \ + '--copy-as=[specify user & optional group for the copy]:user:_rsync_users_groups' \ '--version[print version number]' \ '*'{-h,--human-readable}'[output numbers in a human-readable format]' \ '--blocking-io[use blocking I/O for the remote shell]' \ @@ -227,23 +249,24 @@ _rsync() { '--out-format=[output updates using specified format]:format' \ '--password-file=[read daemon-access password from file]:file:_files' \ '--list-only[list the files instead of copying them]' \ + '--stop-after=[stop copying after specified time has elapsed]:time (minutes)' \ + '--stop-at=[stop copying when specified point in time is reached]:date/time (YYYY-MM-DDTHH\:MM):_dates -F -S "T"' \ '(--only-write-batch)--write-batch=[write a batched update to the specified file]:file:_files' \ '(--write-batch)--only-write-batch=[like --write-batch but w/o updating destination]:file:_files' \ '--protocol=[force an older protocol version to be used]:number' \ '--info=[fine-grained informational verbosity]:info option:_rsync_info' \ '--debug=[fine-grained debug verbosity]:debug option:_rsync_debug' \ - '--msgs2stderr[special output handling for debugging]' \ + '!(--stderr)--msgs2stderr' \ '--munge-links[munge symlinks to make them safer, but unusable]' \ '--ignore-missing-args[ignore missing source args without error]' \ '--delete-missing-args[delete missing source args from destination]' \ '(--usermap --chown)--usermap=[custom username mapping]:comma-separated mappings' \ '(--groupmap --chown)--groupmap=[custom groupname mapping]:comma-separated mappings' \ - '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group' \ - '*'{-M=,--remote-option=}'[send option to the remote side only]:option string' \ + '(--usermap --groupmap --chown)--chown=[simple username/groupname mapping]:user and/or group:_rsync_users_groups' \ + '*'{-M+,--remote-option=}'[send option to the remote side only]:option string' \ '--preallocate[preallocate the full length of new files]' \ '--iconv=[request charset conversion of filenames]:number' \ '--checksum-seed=:number' \ - "--noatime[don't alter atime when opening source files]" \ '--read-batch=[read a batched update from the specified file]:file:_files' } diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 3ed25a3f0..0e1f5dbc0 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -15,13 +15,13 @@ all=( common=( '*-I+[specify $LOAD_PATH directory (may be used more than once)]:library directory:_files -/' '-w[turn warnings on for your script]' - '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose))' + '-W-[set warning level]:warning level:((0\:silent 1\:medium 2\:verbose \\\:deprecated \\\:experimental))' '(-)1:ruby script:_files -g "*.rb(-.)"' '*::script argument:= ->normal' ) opts=( - '-0-[specify record separator]:input record separator in octal [default \0]' + '-0-[specify record separator]:input record separator in octal [\0]' '-a[autosplit mode with -n or -p (splits $_ into $F)]' '-c[check syntax only]' '-C+[cd to directory before executing your script]:directory:_files -/' @@ -35,7 +35,7 @@ opts=( '(-n)-p[assume loop like -n but print line also like sed]' '-s[enable some switch parsing for switches after script name]' '-S[look for the script using PATH environment variable]' - '-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' + '!-T-[turn on tainting checks]::taint level [1]:((0\:strings\ from\ streams/environment/ARGV\ are\ tainted 1\:no\ dangerous\ operation\ by\ tainted\ value 2\:process/file\ operations\ prohibited 3\:all\ generated\ objects\ are\ tainted 4\:no\ global\ \(non-tainted\)\ variable\ modification/no\ direct\ output))' '(--verbose)-v[print version number, then turn on verbose mode]' '(-v)--verbose[turn on verbose mode and disable script from stdin]' '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' @@ -49,11 +49,11 @@ opts=( '--jit[enable jit with default options]' '--jit-warnings[enable printing JIT warnings]' '--jit-debug[enable JIT debugging (very slow)]' - '--jit-wait[wait until JIT compilation is finished every time (for testing)]' + '--jit-wait[wait until JIT compilation finishes every time (for testing)]' '--jit-save-temps[save JIT temporary files]' '--jit-verbose=-[print JIT logs of level num or less to stderr]:maximum log level [0]' - '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [1000]' - '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [5]' + '--jit-max-cache=-[specify max number of methods to be JIT-ed in a cache]:number [100]' + '--jit-min-calls=-[specify number of calls to trigger JIT]:calls [10000]' ) irb=( diff --git a/Completion/Unix/Command/_runit b/Completion/Unix/Command/_runit index 81ba26a44..5c22cc54e 100644 --- a/Completion/Unix/Command/_runit +++ b/Completion/Unix/Command/_runit @@ -19,7 +19,7 @@ _sv_commands() { 'kill':'send SIGKILL if service is running' 'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.' ) - _describe -t commands "sv commands" sv_ary -V sv_commands + _describe -t commands "sv command" sv_ary -V sv_commands } _sv_lsb() { @@ -41,7 +41,7 @@ _sv_lsb() { } _sv_additional() { - _describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm + _describe -t additional-commands "sv additional command" '("check:check status of service")' -V sv_addl_comm } local curcontext="$curcontext" state line @@ -68,6 +68,6 @@ case $state in ) sv_services=( ${sv_services#$svdir/} ) - _describe -t services "sv services" sv_services + _describe -t services "sv service" sv_services ;; esac diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba index 775543794..6c7a64e18 100644 --- a/Completion/Unix/Command/_samba +++ b/Completion/Unix/Command/_samba @@ -96,7 +96,7 @@ case $service in smbstatus) _arguments -s -S $args \ {-b,--brief}'[brief output]' \ - '(-v --verbose)'(-v,--verbose)'[be verbose]' \ + '(-v --verbose)'{-v,--verbose}'[be verbose]' \ '(-d --debuglevel)'{-d+,--debuglevel=}'[specify debug level]:debug level:(0 1 2 3 4 5 6 7 8 9 10)' \ '(-u --user)'{-u+,--user=}'[specify user to restrict information to]:user:_users' \ '(-B --byterange)'{-B,--byterange}'[include byte range locks]' \ diff --git a/Completion/Unix/Command/_scons b/Completion/Unix/Command/_scons index 2c620cc1a..77fe6dfb0 100644 --- a/Completion/Unix/Command/_scons +++ b/Completion/Unix/Command/_scons @@ -19,7 +19,7 @@ _arguments -s -S \ '(-)-'{h,-help}'[display defined usage information]' \ '(-)-'{H,-help-options}'[display usage information]' \ '(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \ - \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \ + \*{-I,--include-dir=}'[add directory to search Python modules]:directory:_directories' \ '(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \ '(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \ '(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \ diff --git a/Completion/Unix/Command/_script b/Completion/Unix/Command/_script index ac3bf3973..7a3960be0 100644 --- a/Completion/Unix/Command/_script +++ b/Completion/Unix/Command/_script @@ -4,14 +4,19 @@ local args hlp="-h --help -V --version" if [[ $service = scriptreplay ]]; then _arguments -S -s \ - "(1 -t --timing $hlp)"{-t+,--timing=}'[specify file containing timing output]:timing file:_files' \ - "(2 -s --typescript $hlp)"{-s+,--typescript=}'[specify file containing terminal output]:typescript file:_files' \ + "(1 -t --timing -T --log-timing $hlp)"{-t+,-T+,--timing=,--log-timing=}'[specify file containing timing output]:timing file:_files' \ + "(-I --log-in -B --log-io $hlp)"{-I+,--log-in=}'[specify file containing terminal input]:file:_files' \ + "(2 -s --typescript -B --log-io $hlp)"{-s+,-O+,--typescript=,--log-out=}'[specify file containing terminal output]:typescript file:_files' \ + "(-B --log-io -I --log-in -s -O --typescript --log-out $hlp)"{-B,--log-io}'[specify file containing terminal input and output]' \ + "($hlp)--summary[display overview about recorded session and exit]" \ "(3 -d --divisor $hlp)"{-d+,--divisor=}'[speed up replay]:factor' \ "(-m --maxdelay $hlp)"{-m+,--maxdelay=}'[set maximum delay between updates]:delay (seconds)' \ + "(-x --stream $hlp)"{-x+,--stream=}'[specify stream type]:name:(out in signal or info)' \ + "(-c --cr-mode $hlp)"{-c+,--cr-mode=}'[specify CR char mode]:mode:(auto never always)' \ '(- *)'{-h,--help}'[display help information]' \ '(- *)'{-V,--version}'[display version information]' \ "(-t --timing $hlp):timing file:_files" \ - "(-s --typescript $hlp):typescript file:_files" \ + "(-s --typescript -O --log-out $hlp):typescript file:_files" \ "(-d --divisor $hlp): :_guard '[0-9.]#' 'timing divisor'" return fi @@ -19,12 +24,18 @@ fi case $OSTYPE in linux*) args=( -S - "(-a --append $hlp)"{-a,--append}'[append output]' + "(-I --log-in $hlp)"{-I,--log-in}'[log stdin to file]:file:_files' + "(-O --log-out $hlp)"{-O,--log-out}'[log stdout to file]:file:_files' + "(-B --log-io $hlp)"{-B,--log-io}'[log stdin and stdout to file]:file:_files' + "(-T --log-timing -t --timing $hlp)"{-T+,--log-timing=}'[log timing information to file]:file:_files' + "(-m --logging-format $hlp)"{-m+,--logging-format=}'[specify log file format]:format:(classic advanced)' + "(-a --append $hlp)"{-a,--append}'[append to the log file]' "(-c --command $hlp)"{-c,--command=}'[run specified command instead of a shell]:command:_cmdstring' "(-e --return $hlp)"{-e,--return}'[return exit status of the child process]' "(-f --flush $hlp)"{-f,--flush}'[flush output after each write]' + "(-E --echo $hlp)"{-E+,--echo=}'[echo input]:when:(auto always never)' "($hlp)--force[use output file even when it is a link]" - '(-o --output-limit)'{-o+,--output-limit=}'[terminate if output files exceed specified size]:size (bytes)' + "(-o --output-limit $hlp)"{-o+,--output-limit=}'[terminate if output files exceed specified size]:size (bytes)' "(-q --quiet $hlp)"{-q,--quiet}'[be quiet]' "(-t --timing $hlp)"{-t-,--timing=-}'[output timing data]::timing file:_files' '(- 1)'{-h,--help}'[display help information]' diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index 73227901e..79a010c92 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -109,10 +109,10 @@ else ) ;| openbsd*|freebsd*|netbsd*|dragonfly*) args+=( '(-r -E)'-r$extended ) ;| - darwin*|freebsd*|netbsd*|openbsd*) args+=( '-i+'$inplace ) ;| - darwin*|freebsd*|netbsd*) args+=( '-l[make output line buffered]' ) ;| - freebsd*) args+=( '-u[disable data buffering]' ) ;| - freebsd*|netbsd*) + darwin*|freebsd*|netbsd*|openbsd*|dragonfly*) args+=( '-i+'$inplace ) ;| + darwin*|freebsd*|netbsd*|dragonfly*) args+=( '-l[make output line buffered]' ) ;| + freebsd*|dragonfly*) args+=( '-u[disable data buffering]' ) ;| + freebsd*|netbsd*|dragonfly*) args+=( '-I+[edit files in-place, treating all files as a single input stream]:: :_guard "^(*[@/; \\\]*|?(#c6,)|-*)" "suffix for backup"' ) diff --git a/Completion/Unix/Command/_setfacl b/Completion/Unix/Command/_setfacl index 5c573a581..14be49d95 100644 --- a/Completion/Unix/Command/_setfacl +++ b/Completion/Unix/Command/_setfacl @@ -3,11 +3,11 @@ if _pick_variant cygwin=cygwin unix --version; then # cygwin 1.5.25 _arguments -s -S \ - '(-d, --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry:' \ - '(-f, --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \ - '(-m, --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry:' \ - '(-r, --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \ - '(-s, --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry:' \ + '(-d --delete)'{-d,--delete}'[delete one or more specified ACL entries]:ACL entry' \ + '(-f --file)'{-f,--file}'[set ACL entries for FILE to ACL entries read from a ACL_FILE]:ACL file:_files' \ + '(-m --modify)'{-m,--modify}'[modify one or more specified ACL entries]:ACL entry' \ + '(-r --replace)'{-r,--replace}'[replace mask entry with maximum permissions needed for the file group class]' \ + '(-s --substitute)'{-s,--substitute}'[substitute specified ACL entries for the \[ACL of FILE\]]:ACL entry' \ '(- *)'{-h,--help}'[output usage information and exit]' \ '(- *)'{-v,--version}'[output version information and exit]' \ '*: :_files' diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh index 39d299c58..f0f18d4bb 100644 --- a/Completion/Unix/Command/_sh +++ b/Completion/Unix/Command/_sh @@ -1,14 +1,36 @@ #compdef sh ash csh dash ksh ksh88 ksh93 mksh oksh pdksh rc tcsh yash -if (( CURRENT == ${words[(i)-c]} + 1 )); then - _cmdstring -else - local n=${words[(b:2:i)[^-]*]} - if (( n <= CURRENT )); then - compset -n $n - _alternative \ - 'files:file:_files' \ - 'commands:command:_normal' && return 0 - fi - _default -fi +local bourne argv0 +local -a args all_opts=( -{{0..9},{A..Z},{a..z}} ) + +[[ $service == (csh|?csh|fish|rc) ]] || bourne=1 + +# Bourne-style shells support +x variants +# @todo Uncomment when workers/45422 is fixed +# (( bourne )) && all_opts+=( ${all_opts/#-/+} ) +# Bourne-style shells take argv[0] as the second argument to -c +(( bourne )) && argv0=':argv[0]:' + +# All of the recognised shells support at least these arguments +args=( + "(1 -)-c[execute specified command string]: :_cmdstring$argv0" + '-e[exit immediately on non-zero return]' + '-i[act as interactive shell]' + '-l[act as login shell]' + '-x[print command trace]' + '1:script file:_files' + '*:: :_files' +) +# Bourne-style shells support -o/+o option. Not all of them support -ooption in +# the same argument, but we'll allow it here for those that do +(( bourne )) && args+=( + '-o+[set specified option]:option:' + '+o+[unset specified option]:option:' +) +# Since this is a generic function we don't know what other options these shells +# support, but we don't want them to break the ones listed above, so we'll just +# ignore any other single-alphanumeric option. Obviously this doesn't account +# for long options +args+=( '!'${^${all_opts:#(${(~j<|>)${(@M)${(@M)args#(*[\*\)]|)[+-]?}%[+-]?}})}} ) + +_arguments -s -S -A '-*' : $args diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite index 0f03c61c1..7ef3c6daa 100644 --- a/Completion/Unix/Command/_sqlite +++ b/Completion/Unix/Command/_sqlite @@ -22,7 +22,7 @@ options+=( ) output_modes=( column HTML line list ) -(( $+sqlite3 )) && output_modes+=( ascii csv quote ) +(( $+sqlite3 )) && output_modes+=( ascii box csv json markdown quote table tabs ) exclusive=( $^dashes-${^output_modes:l} ) for display_opt in $output_modes ; do # finagle the description to match the way SQLite's -help formats them @@ -54,6 +54,7 @@ options+=( $^dashes'-memtrace[trace all memory allocations and deallocations]' $^dashes'-mmap[set default mmap size]:size' $^dashes'-newline[set output row separator]:separator [\n]' + $^dashes'-nofollow[refuse to open symbolic links to database files]' $^dashes'-pagecache[specify size and number of slots for page cache memory]:size (bytes): :slots' $^dashes'-readonly[open the database read-only]' $^dashes'-stats[print memory stats before each finalize]' diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 0775590e6..2385272f1 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -4,12 +4,13 @@ _ssh () { local curcontext="$curcontext" state line expl suf arg ret=1 - local args sigargs common common_transfer algopt tmp p1 file cmn cmds sdesc tdesc - typeset -A opt_args + local args sigargs common common_transfer options algopt tmp p1 file cmn cmds sdesc tdesc + typeset -A opt_args tsizes common=( '(-6)-4[force ssh to use IPv4 addresses only]' '(-4)-6[force ssh to use IPv6 addresses only]' + '-A[enable forwarding of the authentication agent connection]' '-C[compress data]' '-c+[select encryption cipher]:encryption cipher:->ciphers' '-F+[specify alternate config file]:config file:_files' @@ -32,7 +33,6 @@ _ssh () { ssh) (( $+words[(r)-[^-]#t*] )) && tdesc=' even if there is no controlling tty' _arguments -C -s \ - '(-a)-A[enable forwarding of the authentication agent connection]' \ '(-A)-a[disable forwarding of authentication agent connection]' \ '-B+[bind to specified interface before attempting to connect]:interface:_net_interfaces' \ '(-P)-b+[specify interface to transmit on]:bind address:_bind_addresses' \ @@ -81,9 +81,19 @@ _ssh () { '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 ;; ssh-add) - [[ $OSTYPE == darwin* ]] && args=( - '-A[add identities from keychain]' - '-K[update keychain when adding/removing identities]' + if [[ $OSTYPE != darwin* || $APPLE_SSH_ADD_BEHAVIOR == openssh ]]; then + args=( + '-K[load resident keys from a FIDO authenticator]' + ) + else + [[ ${APPLE_SSH_ADD_BEHAVIOR:-macos} == macos ]] && args=( + '-A[add identities from keychain]' + '-K[update keychain when adding/removing identities]' + ) + fi + [[ $OSTYPE == darwin<20->.* ]] && args+=( + '--apple-load-keychain[add identities from keychain]' + '--apple-use-keychain[update keychain when adding/removing identities]' ) _arguments -s : $args \ '-c[identity is subject to confirmation via SSH_ASKPASS]' \ @@ -92,14 +102,16 @@ _ssh () { $algopt \ '-e+[remove keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ '-k[load plain private keys only and skip certificates]' \ + '-K[load resident keys from a FIDO authenticator]' \ '-L[list public key parameters of all identities in the agent]'\ '-l[list all identities]' \ '-m+[specify minimum remaining signatures before maximum is changed]:number' \ '-M+[specify maximum number of signatures]:number' \ + '-S+[use specified library when adding FIDO authenticator-hosted keys]:library:_files' \ '-s+[add keys provided by the PKCS#11 shared library]:library:_files -g "*.(so|dylib)(|.<->)(-.)"' \ '-t+[set maximum lifetime for identity]:maximum lifetime (in seconds or time format):' \ "-T[test usability of identity files' private keys]:*:public key file:_files -g '*.pub(-.)'" \ - '-v[verbose mode]' \ + '*-v[verbose mode]' \ '-q[be quiet after a successful operation]' \ '-X[unlock the agent]' \ '-x[lock the agent with a password]' \ @@ -125,13 +137,42 @@ _ssh () { # options can be in any order but use ! to limit those shown for the first argument (( CURRENT == 2 )) && p1='!' args=( '!-z:number' ) + options=( + application + 'challenge\:path\:_files' + device + no-touch-required + resident + user + verify-required + 'write-attestation\:path\:_files' + ) sdesc='certify keys with CA key' - (( $+words[(r)-I] )) && args=( '-z[specify serial number]:serial number' ) + if (( $+words[(r)-[IhUDnV]*] )); then + args=( '-z[specify serial number]:serial number' ) + options=( + clear critical\:name extension\:name force-command\:command\:_cmdstring + no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding + permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc + permit-x11-forwarding source-address\:source\ address + ) + fi (( $+words[(r)-[ku]] )) && args=( '-z[specify version number]:version number' ) && sdesc='specify CA public key file' file=key (( $+words[(r)-[FHR]] )) && file=known_hosts - (( $+words[(r)-T] )) && file=input + if (( $+words[(r)-M*] )); then + file=input + args+=( '*:output file:_files' ) + options=( + lines:number + 'start-line\:line number' + checkpoint\:file:_files + 'memory\:size (mbytes)' + 'start\:start point (hex-value)' + generator\:value + ) + fi (( $+words[(r)-A] )) && file='prefix for host key' if (( $+words[(r)-[kIQ]] )); then file=krl @@ -139,8 +180,9 @@ _ssh () { fi if (( arg = $words[(I)-Y*] )); then [[ $words[arg] = -Y?* ]] || (( arg++ )) - case $words[arg] in - check*|verify) + case ${words[arg]#-Y} in + ^find-*) sigargs+=( "$p1-n+[specify namespace]:namespace" ) ;| + check*|find*|verify) sigargs+=( "$p1-s+[specify signature file]:signature file:-files" ) ;| sign) sigargs+=( '*:file:_files' ) ;; @@ -153,51 +195,60 @@ _ssh () { ;; esac fi - cmds=( -p -i -e -y -c -l -B -D -F -H -R -r -G -T -s -L -A -k -Q -Y ) # basic commands - cmn=( -b -P -N -C -l -m -v ) # options common to many basic commands (except -f which is common to most) - cms=( -E -q -t -g -M -S -a -J -j -K -W -I -h -n -O -V -u -U ) # options specific to one basic command + cmds=( -p -i -e -y -c -l -B -D -F -H -K -R -r -M -s -L -A -k -Q -Y ) # basic commands + cmn=( -a -b -P -N -C -l -m -O -v -w -Z ) # options common to many basic commands (except -f which is common to most) + cms=( -E -q -t -g -M -I -h -n -V -u -U ) # options specific to one basic command + tsizes=( + dsa 1024 + ecdsa '256 384 521' # values appear in key names as listed with ssh -Q key - 521 really is correct + rsa '1024 2048 4096' + ) _arguments -s $args \ - "(${${(@)cmds:#-G}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key" \ + "${p1}(${${(@)cmds:#-[pcKAO]}} ${${(@)cms:#-[t]}} -O)-a+[specify number of rounds]:rounds [16]" \ + "(${${(@)cmds:#-M}} -P ${${(@)cms:#-[MS]}})-b+[specify number of bits in key]:bits in key [2048]:"'compadd ${expl\:/-X/-x} ${_comp_mesg\:=-} ${=tsizes[${opt_args[create--t]\:-rsa}]}' \ "$p1(${${(@)cmds:#-[pc]}} -b $cms)-P+[provide old passphrase]:old passphrase" \ "(${${(@)cmds:#-p}} -v ${${(@)cms:#-[qt]}})-N+[provide new passphrase]:new passphrase" \ "(${${(@)cmds:#-c}} -v $cms)-C+[provide new comment]:new comment" \ - "(-D -G -M -S -I -h -n -O -V -A)-f+[$file file]:$file file:_files" \ + "(-D -I -h -n -V -A)-f+[$file file]:$file file:_files" \ "$p1(${${(@)cmds:#-[FE]}} ${${(@)cmn:#-v}} ${${(@)cms:#-E}})-l[show fingerprint of key file]" \ "$p1(${${(@)cmds:#-[iep]}} $cms)-m+[specify conversion format]:format [RFC4716]:(PEM PKCS8 RFC4716)" \ + "$p1*-O+[specify a key/value option]: : _values 'option' $options" \ "(${${(@)cmds:#-[lGT]}} ${${(@)cmn:#-[bv]}} -f)*-v[verbose mode]" \ + "$p1(${${(@)cmds:#-K}} -P ${${(@)cms:#-[qt]}})-w+[specify library used when creating FISO authenticator-hosted keys]:library:_files -g '*.(so|dylib)(|.<->)(-.)'" \ + "$p1(${${(@)cmds:#-p}} -l ${${(@)cms:#-[qt]}})-Z+[specify encryption cipher to use when writing a private key file]:cipher:compadd - $(_call_program ciphers ssh -Q cipher)" \ - '(commands)' \ - "(-b -l -C -v)-p[change passphrase of private key file]" \ - '(-b -l -P -N -C -v)-i[import key to OpenSSH format]' \ - '(-b -l -P -N -C -v)-e[export key to SECSH file format]' \ + "(-b -l -C -O -v -w)-p[change passphrase of private key file]" \ + "(${${(@)cmn:#-m}})-i[import key to OpenSSH format]" \ + "(${${(@)cmn:#-m}})-e[export key to SECSH file format]" \ "($cmn)-y[get public key from private key]" \ - '(-b -l -N -m -v)-c[change comment in private and public key files]' \ + "(${${(@)cmn:#-[aCP]}})-c[change comment in private and public key files]" \ "($cmn)-B[show the bubblebabble digest of key]" \ "(-)-D+[download key stored in smartcard reader]:reader" \ "(${${(@)cmn:#-[lv]}})-F+[search for host in known_hosts file]:host:_ssh_hosts" \ "($cmn)-H[hash names in known_hosts file]" \ + "(${${(@)cmn:#-[aw]}} -f)-K[download resident keys from a FIDO authenticator]" \ "($cmn)-R+[remove host from known_hosts file]:host:_ssh_hosts" \ + "(${${(@)cmn:#-O}})-M+[moduli generation]:action:(( + generate\:generate\ candidates\ for\ DH-GEX\ moduli + screen\:screen\ candidates\ for\ DH-GEX\ moduli + ))" \ "($cmn)-L[print the contents of a certificate]" \ - "($cmn -l)-A[generate host keys for all key types]" \ + "(${${(@)cmn:#-a}})-A[generate host keys for all key types]" \ "($cmn)-Q[test whether keys have been revoked in a KRL]" \ + "($cmn)-Y+[signature action]:action:(( + find-principals\:find\ the\ principal\ associated\ with\ the\ public\ key\ of\ a\ signature + sign\:sign\ a\ file\ using\ SSH\ key + verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option + check-novalidate\:check\ signature\ structure + ))" \ - finger \ "$p1($cmn)$algopt" \ - create \ '(-P -l)-q[silence ssh-keygen]' \ - "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \ + "(-P -l)-t+[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519 ecdsa-sk ed25519-sk)" \ - dns \ "($cmn)-r[print DNS resource record]:hostname:_hosts" \ "$p1($cmn)-g[use generic DNS format]" \ - - primes \ - "(-P -N -C -l -m -f)-G+[generate candidates for DH-GEX moduli]:output file:_files" \ - "$p1(-P -N -C -l -m -f)-M+[specify amount of memory to use for generating DH-GEX moduli]:memory (MB)" \ - "$p1(-P -N -C -l -m -f)-S+[specify start point]:start point (hex)" \ - - screen \ - "(${${(@)cmn:#-v}})-T+[screen candidates for DH-GEX moduli]:output file:_files" \ - "${p1}(${${(@)cmn:#-v}})-a+[specify number of rounds]:rounds" \ - "${p1}(${${(@)cmn:#-v}})-J[exit after screening specified number of lines]" \ - "${p1}(${${(@)cmn:#-v}})-j+[start screening at the specified line number]:line number" \ - "${p1}(${${(@)cmn:#-v}})-K+[write the last line processed to file]:file:_files" \ - "${p1}(${${(@)cmn:#-v}})-W[specify desired generator]:generator" \ - certify \ "($cmn)-s[$sdesc]:CA key:_files" \ "$p1($cmn -f -k -u)-I+[specify key identifier to include in certificate]:key id" \ @@ -205,21 +256,10 @@ _ssh () { "$p1($cmn -f -k -u -D)-U[indicate that CA key is held by ssh-agent]" \ "$p1($cmn -f -k -u -U)-D+[indicate the CA key is stored in a PKCS#11 token]:PKCS11 shared library:_files -g '*.(so|dylib)(|.<->)(-.)'" \ "$p1($cmn -f -k -u)-n+[specify user/host principal names to include in certificate]:principals" \ - "$p1($cmn -f -k -u)*-O+[specify a certificate option]: : _values 'option' - clear critical\:name extension\:name force-command\:command\:_cmdstring - no-agent-forwarding no-port-forwarding no-pty no-user-rc no-x11-forwarding - permit-agent-forwarding permit-port-forwarding permit-pty permit-user-rc - permit-x11-forwarding source-address\:source\ address" \ "$p1($cmn -f -u)-V+[specify certificate validity interval]:interval" \ "($cmn -I -h -n -D -O -U -V)-k[generate a KRL file]" \ "$p1($cmn -I -h -n -D -O -U -V)-u[update a KRL]" \ - signature \ - "($cmn)-Y+[signature action]:action:(( - sign\:sign\ a\ file\ using\ SSH\ key - verify\:verify\ a\ signature\ generated\ using\ the\ sign\ option - check-novalidate\:check\ signature\ structure - ))" \ - "$p1-n+[specify namespace]:namespace" \ $sigargs return ;; @@ -244,6 +284,7 @@ _ssh () { '-b+[specify batch file to read]:batch file:_files' \ '-D+[connect directly to a local sftp server]:sftp server path' \ '-f[request that files be flushed immediately after transfer]' \ + '-N[disable implicit quiet mode set by -b]' \ '-R+[specify number of outstanding requests]:number of requests [64]' \ '-s+[specify SSH2 subsystem or path to sftp server on the remote host]:subsystem/path' \ '1:file:->rfile' '*:file:->file' "$common[@]" "$common_transfer[@]" && ret=0 @@ -269,8 +310,8 @@ _ssh () { if compset -P 1 '*='; then case "${IPREFIX#-o}" in (#i)(ciphers|macs|kexalgorithms|hostkeyalgorithms|pubkeyacceptedkeytypes|hostbasedkeytypes)=) - if ! compset -P +; then - _wanted append expl 'append to default' compadd + && ret=0 + if ! compset -P '[+-]'; then + _wanted prefix expl 'relative to default' compadd - + - && ret=0 fi ;; esac @@ -366,7 +407,7 @@ _ssh () { state=dynforward ;; (#i)kbdinteractivedevices=*) - _values -s , 'keyboard-interactive authentication methods' \ + _values -s , 'keyboard-interactive authentication method' \ 'bsdauth' 'pam' 'skey' && ret=0 ;; (#i)(kexalgorithms|gssapikexalgorithms)=*) @@ -475,7 +516,7 @@ _ssh () { else # old options are after the empty "\"-line _wanted values expl 'configure file option' \ - compadd -M 'm:{a-z}={A-Z}' -q -S '=' - \ + compadd -M 'm:{a-z}={A-Z} r:[^A-Z]||[A-Z]=* r:|=*' -q -S '=' - \ AddKeysToAgent \ AddressFamily \ BatchMode \ diff --git a/Completion/Unix/Command/_stat b/Completion/Unix/Command/_stat index 03b4552de..03abe88a3 100644 --- a/Completion/Unix/Command/_stat +++ b/Completion/Unix/Command/_stat @@ -29,7 +29,7 @@ case $variant in '(-n)-N[never show names of files]' '-o[print file modes in octal rather than decimal]' '-r[print raw data]' - '-s[print mode, UID, GID, and times as strings]' + '(-o)-s[print mode, UID, GID, and times as strings]' '(-T)-t[always show type names]' '(-t)-T[never show type names]' '*: :_files' diff --git a/Completion/Unix/Command/_stdbuf b/Completion/Unix/Command/_stdbuf index a18938ee1..4b7d98ba0 100644 --- a/Completion/Unix/Command/_stdbuf +++ b/Completion/Unix/Command/_stdbuf @@ -7,7 +7,9 @@ short=( -e -i -o ) long=( --error --input --output ) buf=( err in out ) -opt='[set initial buffering for std${buf[i]}]:mode or size:((0\:unbuffered L\:line\ buffered' +opt='[set initial buffering for std${buf[i]}]: : _alternative + "sizes\: \: _numbers -u bytes size k M G" + "modes\:mode\:((0\:unbuffered L\:line\ buffered' if _pick_variant gnu=GNU freebsd --version; then gnu=1 args=( @@ -17,7 +19,7 @@ if _pick_variant gnu=GNU freebsd --version; then else opt+=' B\:fully\ buffered' fi -opt+='))' +opt+='))"' for ((i=1;i<=3;i++)); do args+=( "(${long[i]})${short[i]}+${(e)opt}" ) diff --git a/Completion/Unix/Command/_strings b/Completion/Unix/Command/_strings index af95af52f..685daa286 100644 --- a/Completion/Unix/Command/_strings +++ b/Completion/Unix/Command/_strings @@ -45,7 +45,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu elfutils) args+=( '(- *)--usage[display a short usage message]' - '(- *)-\\?[display help information]' + '(- *)-?[display help information]' ) ;; esac diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index e7f3418d7..3e1a6b698 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -32,6 +32,7 @@ if _pick_variant gnu=GNU solaris --version; then "--no-merge-notes[don't attempt to remove redundant notes]" '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name' '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name' + "*--keep-section=[don't strip given section]:section" '(*)-o+[output file]:output file:_files' '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]' '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]' diff --git a/Completion/Unix/Command/_su b/Completion/Unix/Command/_su index 032f867f4..1af751a17 100644 --- a/Completion/Unix/Command/_su +++ b/Completion/Unix/Command/_su @@ -35,7 +35,7 @@ case $OSTYPE in ;| *bsd*|dragonfly*) args+=( - '-c+[use settings from specified login class]:class' + '-c+[use settings from specified login class]:class:_login_classes' ) ;| freebsd*) args+=( '-s[set the MAC label]' ) ;; @@ -63,6 +63,12 @@ if (( $words[(i)-] < CURRENT )); then norm=2 fi +# This is set so that _command_names will understand that we're completing for +# a privileged command, but _call_program won't actually prepend anything to +# commands if gain-privileges is enabled (which would be undesirable here since +# su always prompts for a password). We delay setting it until this point so it +# doesn't cause issues for the check above +local -a _comp_priv_prefix=( '' ) _arguments $args ${(e)first} "*:shell arguments:= ->rest" && return usr=${${(Q)line[norm]}/--/root} diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index a1e9109de..8fc46a292 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -1,4 +1,4 @@ -#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin +#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin svnliteadmin=svnadmin _svn () { local curcontext="$curcontext" state line expl ret=1 @@ -68,7 +68,6 @@ _svn () { ;; args) local cmd args usage idx - typeset -gHA _cache_svn_status _cache_svn_mtime cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" if (( $#cmd )); then @@ -123,7 +122,7 @@ _svn () { case $cmd in; (add) args+=( - '*:file:_files -g "*(e:_svn_uncontrolled:)"' + '*:file: _svn_modified "addable"' ) ;; (auth) @@ -141,17 +140,17 @@ _svn () { (commit) args=( ${args/(#b)(*--file*):arg:/$match[1]:file:_files} - '*:file:_files -g "*(e:_svn_status:)"' + '*:file: _svn_modified "committable"' ) ;; (delete) args+=( - '*:file:_files -g ".svn(/e:_svn_deletedfiles:)"' + '*:file:_files -g "*(e:_svn_controlled:)"' ) ;; (diff) args+=( - '*: : _alternative "files:file:_files -g \*\(e:_svn_status:\)" "urls:URL:_svn_urls"' + '*: : _alternative "files:file: _svn_modified revertable" "urls:URL:_svn_urls"' ) ;; (help) @@ -201,7 +200,7 @@ _svn () { ;; (revert) args+=( - '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"' + '*:file: _svn_modified "revertable"' ) ;; (x-unshelve) @@ -351,50 +350,76 @@ _svn_controlled() { # because 1.6 has been deprecated for 8 years and EOL for 6 years, we opt to DTRT # for >=1.7. Therefore: - # TODO: Reimplement this function and _svn_uncontrolled for svn>=1.7. + # TODO: Reimplement this function for svn>=1.7. # (Use 'svn st' or 'svn info', not 'svn ls') return 0 } -(( $+functions[_svn_uncontrolled] )) || -_svn_uncontrolled() { - # TODO: See comments in _svn_controlled - return 0 -} - (( $+functions[_svn_conflicts] )) || _svn_conflicts() { - () { (( $# > 0 )) } $REPLY.(mine|r<->)(NY1) + # ### These strings are actually translatable + # + # The asterisks are to support an optional extension; see + # "preserved-conflict-file-exts" in ~/.subversion/config. + () { (( $# > 0 )) } $REPLY.(mine|r<->|working*|merge-left*|merge-right*)(NY1) } -(( $+functions[_svn_deletedfiles] )) || -_svn_deletedfiles() { - # Typical usage would be _files -g '.svn(/e:_svn_deletedfiles:)' - local cont controlled - reply=( ) - [[ $REPLY = (*/|).svn ]] || return - controlled=( $REPLY/text-base/*.svn-base(N:r:t) ) - for cont in ${controlled}; do - [[ -e $REPLY:h/$cont ]] || reply+=( ${REPLY%.svn}$cont ) - done -} +(( $+functions[_svn_modified] )) || +_svn_modified() { + setopt localoptions extendedglob + + local depth dir expl maybe_quiet partial_word space=' ' -(( $+functions[_svn_status] )) || -_svn_status() { - local dir=$REPLY:h - local pat="${1:-([ADMR~]|?M)}" + local svn_context=$1 - zmodload -F zsh/stat b:zstat 2>/dev/null - local key="$(zstat +device $dir):$(zstat +inode $dir)" - local mtime="$(zstat +mtime $dir/.svn/entries)" + local partial_word=${(Q)words[CURRENT]} + if [[ -z $partial_word ]]; then + dir="./" + elif [[ -d $partial_word ]]; then + dir=$partial_word + else + dir=${partial_word:h} + fi - if (( ! $+_cache_svn_status[$key] || _cache_svn_mtime[$key] != mtime )); then - _cache_svn_status[$key]="$(_call_program files svn status -N $dir)" - _cache_svn_mtime[$key]="$mtime" + if zstyle -T ":completion:${curcontext}:${curtag}" verbose; then + depth=infinity + else + depth=immediates fi - (( ${(M)#${(f)_cache_svn_status[$key]}:#(#s)${~pat}*$REPLY} )) + if [[ $svn_context = addable ]]; then + maybe_quiet="" + else + maybe_quiet="-q" + fi + + local -a status_lines + # Run 'status' + status_lines=( ${(f)"$(_call_program modified-files "svn status $maybe_quiet --depth=${(q)depth} -- ${(q)dir}")"} ) + # Filter to only the right set of statuses + case $svn_context in + (committable) + status_lines=( ${(M)status_lines:#(#s)([ADMR]?|?M)${space}???${space}${space}*} ) + ;; + (revertable) + status_lines=( ${(M)status_lines:#(#s)([ACDMR~!]?|?[CM])${space}????${space}*} ) + ;; + (addable) + # The 'D' is just in case there's an unversioned file of the same name as the deleted file + status_lines=( ${(M)status_lines:#(#s)[?ID]${space}${space}???${space}${space}*} ) + ;; + esac + # Strip the 7 status-letter columns and the column of spaces + status_lines=( ${status_lines#????????} ) + # Strip one leading space. This is in case `svn status` ever adds another + # column. If that hasn't happened and you're reading this comment because + # the following line broke your use of filenames that start with a literal + # space, well, nice to meet you! I didn't know you existed. + status_lines=( ${status_lines#${space}} ) + + _wanted svn-modified expl 'modified files in svn' \ + compadd - "${status_lines[@]}" } (( $+functions[_svn_remote_paths] )) || diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index 41e32cbae..29e5e6d75 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -2,9 +2,9 @@ setopt localoptions extended_glob -local environ e cmd -local -a args -local -a _comp_priv_prefix +local environ e cmd cpp +local -a args _comp_priv_prefix +local -A opt_args zstyle -a ":completion:${curcontext}:" environ environ @@ -14,7 +14,9 @@ done args=( '(-A --askpass)'{-A,--askpass}'[use a helper program for password prompting]' + '(-B --bell)'{-B,--bell}'[ring bell when prompting]' '(-C --close-from)'{-C+,--close-from=}'[close file descriptors]:lowest fd to close' + '(-D --chdir)'{-D+,--chdir=}'[change the working directory before running command]:directory:_directories' '(-g --group)'{-g+,--group=}'[run command as the specified group name or ID]:group:_groups' '(-)'{-h,--help}'[display help message and exit]' '(-h --host)'{-h+,--host=}'[run command on host]:host:_hosts' @@ -23,6 +25,7 @@ args=( \*{-l,--list}"[list user's privileges or check a specific command]" '(-n --non-interactive)'{-n,--non-interactive}'[non-interactive mode, no prompts are used]' '(-p --prompt)'{-p+,--prompt=}'[use the specified password prompt]:prompt' + '(-R --chroot)'{-R+,--chroot=}'[change the root directory before running command]:directory:_directories' '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]: :_selinux_roles' '(-S --stdin)'{-S,--stdin}'[read password from standard input]' '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]: :_selinux_types' @@ -42,6 +45,10 @@ if [[ $service = sudoedit ]] || (( $words[(i)-e] < $words[(i)^(*sudo|-[^-]*)] )) args=( -A "-*" $args '!(-V --version -h --help)-e' '*:file:_files' ) else cmd="$words[1]" + cpp='_comp_priv_prefix=( + $cmd -n + ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} + )' args+=( '(-e --edit 1 *)'{-e,--edit}'[edit files instead of running a command]' \ '(-s --shell)'{-s,--shell}'[run shell as the target user; a command may also be specified]' \ @@ -51,8 +58,8 @@ else '(-E -i --login -s --shell -e --edit)--preserve-env=-[preserve user environment when running command]::environment variable:_sequence _parameters -g "*export*"' \ '(-H --set-home -i --login -s --shell -e --edit)'{-H,--set-home}"[set HOME variable to target user's home dir]" \ '(-P --preserve-groups -i -login -s --shell -e --edit)'{-P,--preserve-groups}"[preserve group vector instead of setting to target's]" \ - '(-)1:command: _command_names -e' - '*::arguments:{ _comp_priv_prefix=( $cmd -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }' + "(-)1: :{ $cpp; _command_names -e }" + "*:: :{ $cpp; _normal }" ) fi diff --git a/Completion/Unix/Command/_surfraw b/Completion/Unix/Command/_surfraw index f945f1ca9..d153cd493 100644 --- a/Completion/Unix/Command/_surfraw +++ b/Completion/Unix/Command/_surfraw @@ -20,11 +20,11 @@ case $state in subcmd) args=( '-help[display help information]' - '*:string:_guard "^-*" "search string"' + '*: :_guard "^-*" "search string"' ) case "$words[1]" in ask|cia|cnn|deblogs|excite|filesearching|foldoc|happypenguin|slashdot|slinuxdoc|sundocs|sunsolve|xxx) - _message -e string 'search string' + _message -e strings 'search string' ;; alioth) _arguments $args \ @@ -64,10 +64,10 @@ case $state in '*:search string' && ret=0 ;; ctan) - _arguments $args \ - '-name[search by filename]' \ - '-desc[search descriptions (default)]'\ - '-doc[search documentation]' + _arguments $args \ + '-name[search by filename]' \ + '-desc[search descriptions (default)]'\ + '-doc[search documentation]' ;; currency) _arguments \ @@ -164,8 +164,8 @@ case $state in '-doc[view PTS documentation]' && ret=0 ;; debsec) - _message -e string 'package name, bug number or CVE ID' - ;; + _message -e strings 'package name, bug number or CVE ID' + ;; deja) _arguments $args \ '-results=-:[number of results to return]' \ @@ -183,7 +183,7 @@ case $state in ;; ebay) _arguments $args \ - '-country=-:country:(com de uk fr)' \ + '-country=-:country:(com de uk fr)' \ '-results=-:[number of results to return]:number' && ret=0 ;; etym) @@ -220,7 +220,7 @@ case $state in _deb_packages avail && ret=0 ;; fsfdir) - _arguments $args + _arguments $args ;; google) _arguments $args \ @@ -229,19 +229,19 @@ case $state in '-search=-:topic:(bsd linux mac unclesam)' && ret=0 ;; gutenberg) - _arguments $args \ - '-title[search titles (default)]' - '-author[search authors]' - '-num[search etext numbers]' - ;; + _arguments $args \ + '-title[search titles (default)]' + '-author[search authors]' + '-num[search etext numbers]' + ;; imdb) _arguments $args \ '-category=-:category:(All Titles MyMovies People Characters Quotes Bios Plots)' && ret=0 ;; ixquick) - _arguments $args \ - '-search=-:search type:(web pics)' \ - '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)' + _arguments $args \ + '-search=-:search type:(web pics)' \ + '-lang=-:language:(english dansk deutsch espanol francais italiano nederlands norsk polski portugues suomi svenska turkce jiantizhongwen nihongo fantizhengwen hangul)' ;; jake) _arguments $args \ @@ -261,9 +261,9 @@ case $state in '-head=:display headlines:(on off)' \ '-grid=:show results in grid:(on off)' \ '-spell=:spelling tolerance:(off standard force)' \ - '*:dictionary word:->dictword' && ret=0 + '*:dictionary word:->words' && ret=0 - [[ "$state" = dictword ]] && _wanted words expl 'dictionary word' \ + [[ "$state" = words ]] && _wanted words expl 'dictionary word' \ compadd $(look "${PREFIX}") && ret=0 ;; netbsd|openbsd) @@ -386,20 +386,20 @@ case $state in :URL:_urls && ret=0 ;; wayback) - _arguments $args \ - '-syear=-[start search from this year]:year' \ - '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ - '-sday=-[start search from this day]:number' \ - '-eyear=-[end search in this year]:year' \ - '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ - '-eday=-[end search in this day]:number' \ - '-list[list all pages that match search criteria]' \ - '-dups[show dups]' \ - '-compare[compare pages]' \ - '-pdf[show as PDF]' \ - '-alias=-[how to handle site aliases]:alias:(merge show hide)' \ - '-redir=-[how to handle redirections]:redir:(hide flag show)' \ - '-type=-[file type to search for]:type:(image audio video binary text pdf)' + _arguments $args \ + '-syear=-[start search from this year]:year' \ + '-smonth=-:[start search from this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ + '-sday=-[start search from this day]:number' \ + '-eyear=-[end search in this year]:year' \ + '-emonth=-[end search in this month]:month:(jan feb mar apr may jun jul aug sep oct nov dec)' \ + '-eday=-[end search in this day]:number' \ + '-list[list all pages that match search criteria]' \ + '-dups[show dups]' \ + '-compare[compare pages]' \ + '-pdf[show as PDF]' \ + '-alias=-[how to handle site aliases]:alias:(merge show hide)' \ + '-redir=-[how to handle redirections]:redir:(hide flag show)' \ + '-type=-[file type to search for]:type:(image audio video binary text pdf)' ;; wetandwild) _arguments \ @@ -422,14 +422,32 @@ case $state in '-results=-[specify number of results to return]:number' && ret=0 ;; yubnub) - _message -e command 'Yubnub Command' + _message -e commands 'Yubnub Command' + ;; + *) + _message -e strings 'search string' ;; esac ;; elvi) - _wanted elvi expl elvi compadd \ - ${${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##--*}%:*} && ret=0 + local -UT XDG_CONFIG_DIRS xdg_config_dirs + local it + # list the applets + set -- ${${(f)"$(_call_program elvi surfraw -elvi)"}%%[[:space:]]##-- *} + shift # the first line is a header: remove it + # then list the bookmarks + for it in \ + $^xdg_config_dirs/surfraw/bookmarks(Nr) \ + /etc/xdg/surfraw/bookmarks(Nr) \ + /etc/surfraw.bookmarks(Nr) \ + ${XDG_CONFIG_HOME-$HOME/.config}/surfraw/bookmarks(Nr) \ + $HOME/.surfraw.bookmarks(Nr) + do + read -d'\0' it < $it + set -- "$@" ${${(f)it}%%[[:space:]]*} + done + _wanted elvi expl elvi compadd "$@" && ret=0 ;; -esac +esac return ret diff --git a/Completion/Unix/Command/_tail b/Completion/Unix/Command/_tail index 3bfbe37ca..e54a0b06e 100644 --- a/Completion/Unix/Command/_tail +++ b/Completion/Unix/Command/_tail @@ -43,7 +43,7 @@ else '(-v)-q[never output headers giving file names]' ) ;| - (netbsd*) + (dragonfly*|netbsd*) args+=( '(-q)-v[always output headers giving file names]' ) ;; esac @@ -53,20 +53,14 @@ _arguments -C -s -S $opts : $args '*:file:_files' && return case $state in (number) - local mlt sign digit - mlt='multipliers:multiplier:((b\:512 K\:1024 KB\:1000 M\:1024\^2' - mlt+=' MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4))' - sign='signs:sign:((+\:"start at the specified byte/line"' - sign+=' -\:"output the last specified bytes/lines (default)"))' - digit='digits:digit:(0 1 2 3 4 5 6 7 8 9)' - if compset -P '(-|+|)[0-9]##'; then - _alternative $mlt $digit && ret=0 - elif [[ -z $PREFIX ]]; then - _alternative $sign $digit && ret=0 - elif compset -P '(+|-)'; then - _alternative $digit && ret=0 - fi - ;; + local alts + [[ -z $PREFIX ]] && alts=( + 'sign:sign:((-\:"print all but the last specified bytes/lines" +\:"print the first specified bytes/lines (default)"))' + ) + compset -P '+' + alts+=( 'numbers: :_numbers -N $state_descr b\:512 K\:1024 KB\:1000 M\:1024\^2 MB\:1000\^2 G\:1024\^3 GB\:1000\^3 T\:1024\^4 TB\:1000\^4' ) + _alternative $alts && ret=0 + ;; esac return ret diff --git a/Completion/Unix/Command/_tex b/Completion/Unix/Command/_tex index 9943fe10c..f1428c494 100644 --- a/Completion/Unix/Command/_tex +++ b/Completion/Unix/Command/_tex @@ -26,4 +26,4 @@ _arguments : \ '-8bit[make all characters printable by default]' \ '-help[display this help and exit]' \ '-version[output version information and exit]' \ - '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi)(-.)"' + '*:TeX or LaTeX file:_files -g "*.(tex|TEX|texinfo|texi|dtx)(-.)"' diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index b356ddbe7..2f5d0f91f 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -36,14 +36,14 @@ local -A opt_args infodirs case $service in info) cmd=${words[1]} - _arguments -C -s \ + _arguments -C -s -S \ '(-a --all)'{-a,--all}'[use all matching manuals]' \ '(: -)'{-k+,--apropos=}'[look up string in indices]:search string: ' \ \*{-d+,--directory=}'[add directory to infopath]:info dir:_files -/' \ '--dribble=[record keystrokes]:file with keystrokes:_files' \ - '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles' \ + '(-f --file 1)'{-f+,--file=}'[specify Info manual to visit]:info manual:->infofiles+' \ '(: - -h --help)'{-h,--help}'[display usage]' \ - '(-o --output -O)--index-search=[go directly to node if found]:search string: ' \ + '(-o --output -O)--index-search=[search for matching index entry]:search string:->index-entries' \ '(--index-search -o --output -O)'{-o+,--output=}'[dump selected nodes to filename]:filename:_files -g "*(-.)"' \ '--init-file=[specify initialisation file]:file:_files' \ '(-n --node)'{-n+,--node=}'[specify nodes in first visited Info file]:node:->nodes' \ @@ -289,7 +289,11 @@ if [[ -n $state ]]; then items=( ${${${(M)${(f)"$(_call_program menu-items info -o-)"}:#(#s)\* *: \(*}#??}%%\)*} ) files+=( ${items##*\(} ) tags=( info-files ) - if [[ $state != infofiles ]]; then + if [[ $state = infofiles+ && $PREFIX$SUFFX = */* ]]; then + # local files allowed + tags+=(files) + fi + if [[ $state != infofiles* ]]; then tags+=( menu-items ) items=( ${items%:*} ) fi @@ -301,6 +305,13 @@ if [[ -n $state ]]; then tags+=( info-nodes ) fi items=( ${${${(M)${(f)"$(_call_program menu-items info -o- $file)"}:#(#s)\* *::*}%%::*}#??} ) + elif [[ $state = index-entries ]]; then + if [[ -n $file ]]; then + tags=( index-entries ) + items=( ${${${(M)${(f)"$(_call_program index-entries info -o- --all --index-search= $file)"}:#(#s)\* *:*}%%:*}#??} ) + else + _message -e index-entries $state_descr + fi fi _tags $tags @@ -308,7 +319,9 @@ if [[ -n $state ]]; then while _tags; do _requested info-files expl 'info file' compadd $suf -M 'm:{a-zA-Z}={A-Za-z}' -a files && ret=0 _requested menu-items expl 'menu item' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0 + _requested -x index-entries expl 'index entry' compadd -M 'm:{a-zA-Z}={A-Za-z}' -a items && ret=0 _requested info-nodes expl 'node' compadd -M 'm:{a-zA-Z}={A-Za-z}' ${nodes#*:} && ret=0 + _requested files expl 'file' && _files -g '*.info(|.gz|.bz2)' (( ret )) || break done diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy index 3998ccdb3..35ceb7e51 100644 --- a/Completion/Unix/Command/_tidy +++ b/Completion/Unix/Command/_tidy @@ -12,7 +12,7 @@ opts=( ${(M)opts:#*:*} ) _arguments -s -A "-*" --$^opts \ '(-indent -i)'{-indent,-i}'[indent element content]' \ - '-wrap[wrap text at the specified <column> (default is 68)]:column:' \ + '-wrap[wrap text at the specified column]:column [68]' \ '(-upper -u)'{-upper,-u}'[force tags to upper case (default is lower case)]' \ '(-clean -c)'{-clean,-c}'[replace FONT, NOBR and CENTER tags by CSS]' \ '(-bare -b)'{-bare,-b}'[strip out smart quotes and em dashes, etc.]' \ diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff index da55b541c..ef12777de 100644 --- a/Completion/Unix/Command/_tiff +++ b/Completion/Unix/Command/_tiff @@ -59,6 +59,7 @@ tiff2pdf) '-s+[set document subject, overrides image image description default]:subject' \ '-k+[set document keywords]:keywords' \ '-b[set PDF "Interpolate" user preference]' \ + '-m+[set memory allocation limit]:limit (MiB)' \ '(- :)-h[display usage information]' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' ;; @@ -83,6 +84,7 @@ tiff2ps) '-i+[enable/disable (Nz/0) pixel interpolation]:state [enabled]:((0\:disable 1\:enable))' \ '-l+[set the left margin]:margin (inches)' \ '-m[use "imagemask" operator instead of "image"]' \ + '-M+[set memory allocation limit]:limit (MiB)' \ '-o+[set initial TIFF directory (file offset)]:file offset (bytes)' \ '(-e)-p[generate non-Encapsulated PostScript]' \ '-O+[specify output file]:output file:_files -g "*.(#i)(|e)ps(-.)"' \ @@ -121,6 +123,7 @@ tiffcp) '-i[ignore read errors]' \ '-b+[specify bias (dark) monochrome image to be subtracted from all others]:file:_files' \ '-,=-[specify substitute character for image indices]:character [,]' \ + '-m+[set memory allocation limit]:limit (MiB)' \ '-r+[specify rows per strip]:rows per strip' \ '-w+[specify output tile width]:output tile width' \ '-l+[specify output tile length]:output tile length' \ diff --git a/Completion/Unix/Command/_timeout b/Completion/Unix/Command/_timeout index 5c27bee47..c041283ac 100644 --- a/Completion/Unix/Command/_timeout +++ b/Completion/Unix/Command/_timeout @@ -2,8 +2,8 @@ local args -if [[ $service = g* || $OSTYPE != *bsd* ]]; then - # GNU coreutils as opposed to Free/NetBSD implementation +if [[ $service = g* || $OSTYPE != *(freebsd|netbsd|openbsd)* ]]; then + # GNU coreutils or DFly as opposed to Free/Net/OpenBSD implementation args=( '(-v --verbose)'{-v,--verbose}'[indicate when signal is sent upon timeout]' '(- *)--help[display usage information]' @@ -15,6 +15,6 @@ _arguments -S -A "-" $args \ '--preserve-status[always exit with the same status as command even if it times out]' \ "--foreground[don't propagate timeout to the command children]" \ '(-s --signal)'{-s,--signal}'[specify the signal to send on timeout]:signal:_signals' \ - '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time:time' \ - '1: :_guard "[0-9.]#([smhd]|)" duration' \ + '(-k --kill-after)'{-k,--kill-after}'[followup first signal with SIGKILL if command persists after specified time]:time' \ + '1: :_numbers -f -u seconds duration :s:seconds m:minutes h:hours d:days' \ '*:::command:_normal' diff --git a/Completion/Unix/Command/_tla b/Completion/Unix/Command/_tla index 1e4cdd8d9..ec7e76d44 100644 --- a/Completion/Unix/Command/_tla +++ b/Completion/Unix/Command/_tla @@ -45,8 +45,8 @@ _tla_revisions () { _arch_namespace tla 4 "$argv[@]" } (( $+functions[_tla_local_revisions] )) || _tla_local_revisions () { local expl1 expl2 tree_version=`$TLA tree-version` - _description -V applied-patches expl1 "patches from this version" - _description -V other-patches expl2 "patches from other versions" + _description -V applied-patches expl1 "patch from this version" + _description -V other-patches expl2 "patch from other versions" compadd "$expl1[@]" `$TLA logs` compadd "$expl2[@]" `$TLA logs --full $($TLA log-versions | grep -v $tree_version)` # This is incredibly slow. @@ -73,7 +73,7 @@ _tla_config () { if [[ -d "$root/configs" ]]; then configdir=("$root/configs") - _description files expl '%Bconfig file%b' + _description files expl 'config file' _files -W configdir "$expl[@]" && ret=0 else _message -e messages "No configs/ directory in tree whose root is $root" @@ -90,7 +90,7 @@ _tla_limit () { #presently only does push-mirror style limits if [ $archive ]; then if [[ $PREFIX != *--* ]]; then - _description -V categories expl "categories in $archive" + _description -V categories expl "category in $archive" compadd -q -S -- "$expl[@]" `$TLA categories -A $archive` else _tla_namespace_branches 3 @@ -107,7 +107,7 @@ _tla_tree_or_rev () { _tla_libraries () { local libraries expl libraries=($(_call_program tla $TLA my-revision-library)) - _description -V libraries expl "revision libraries" + _description -V libraries expl "revision library" compadd "$expl[@]" -a libraries } @@ -128,7 +128,7 @@ _tla_log_versions () { else logs=($(_call_program tla $TLA logs)) fi - _description -V versions expl "log versions" + _description -V versions expl "log version" compadd "$expl[@]" -a logs } @@ -278,12 +278,12 @@ methods=( cmd_tagging_method=($cmd_id_tagging_method) local cmd_add cmd_add_id cmd_add_tag -cmd_add=('*:files to add:_files') +cmd_add=('*:file to add:_files') cmd_add_id=($cmd_add) cmd_add_tag=($cmd_add) local cmd_delete cmd_delete_id cmd_delete_tag -cmd_delete=('*:files to delete:_files') +cmd_delete=('*:file to delete:_files') cmd_delete_id=($cmd_delete) cmd_delete_tag=($cmd_delete) @@ -312,7 +312,7 @@ cmd_changeset=( ':ORIG:_files -/' ':MOD:_files -/' ':DEST:_files -/' - '*:files:_files' + '*:file:_files' ) cmd_mkpatch=("$cmd_changeset[@]") @@ -328,7 +328,7 @@ local cmd_make_archive cmd_make_archive=('::name:' ':location:_files -/') local cmd_archive_setup -cmd_archive_setup=('*:versions:_tla_branches --trailing-dashes') +cmd_archive_setup=('*:version:_tla_branches --trailing-dashes') local cmd_make_category cmd_make_category=(':category:_tla_archives -S /') @@ -344,7 +344,7 @@ cmd_import=('::version:_tla_versions') cmd_imprev=($cmd_import) local cmd_commit cmd_cmtrev -cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:files:_files') +cmd_commit=('::version:_tla_versions' ':separator:(--)' '*:file:_files') cmd_cmtrev=($cmd_commit) local cmd_get cmd_getrev @@ -619,7 +619,7 @@ _tla_main () { local -U cmds help=(${(f)"$($TLA help)"}) cmds=(${${${${(M)help:#* :*}/ #: #/:}%% ##}## #}) - arguments=(':commands:(($cmds))') + arguments=(':command:(($cmds))') fi _arguments -S -A '-*' \ {"${hide_short}(: -)-V",'(: -)--version'}'[display version]' \ diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index b564c955d..844af58fc 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -125,7 +125,9 @@ _tmux_aliasmap=( # status line confirm confirm-before + menu display-menu display display-message + popup display-popup # buffers clearhist clear-history @@ -167,17 +169,19 @@ _tmux-attach-session() { _arguments -s \ '-c+[specify working directory for the session]:directory:_directories' \ '-d[detach other clients attached to target session]' \ + '-f+[set client flags]: :_tmux_client_flags' \ '-r[put the client into read-only mode]' \ '-t+[specify target session]:target session: __tmux-sessions-separately' \ - "-E[don't apply update-environment option]" + "-E[don't apply update-environment option]" \ + '-x[with -d, send SIGHUP to the parent of the attached client]' } _tmux-bind-key() { [[ -n ${tmux_describe} ]] && print "bind a key to a command" && return _arguments -s -A "-*" \ - '-c[bind to command mode instead of normal mode]' \ '-n[make the binding work without the need for the prefix key]' \ '-r[the key may repeat]' \ + '-N+[attach a note to the key]:note' \ '-T+[specify key table for the binding]:key table' \ '1:key' \ '*:::template:= _tmux' @@ -186,6 +190,8 @@ _tmux-bind-key() { _tmux-break-pane() { [[ -n ${tmux_describe} ]] && print "break a pane from an existing into a new window" && return _arguments -s \ + '(-b)-a[move window to next index after]' \ + '(-a)-b[move window to next index before]' \ "-d[don't make the new window become the active one]" \ '-F+[specify output format]:format:__tmux-formats' \ '-P[print information of new window after it has been created]' \ @@ -202,7 +208,8 @@ _tmux-capture-pane() { '-C[escape non-printable characters as octal \\ooo]' \ '-e[include escape sequences for attributes etc]' \ '-E[specify last line to capture]:line number (- means last line)' \ - '-J[join wrapped lines and preserve trailing space]' \ + '(-N)-J[join wrapped lines and preserve trailing space]' \ + '(-J)-N[preserve trailing space]' \ '-q[ignore errors when trying to access alternate screen]' \ '(-b)-p[print data to stdout]' \ '-P[only capture beginnings of as-yet incomplete escape sequences]' \ @@ -214,8 +221,11 @@ _tmux-choose-buffer() { [[ -n ${tmux_describe} ]] && print "put a pane into buffer choice mode" && return _arguments -s \ '-N[start without the preview]' \ + '-Z[zoom the pane]' \ + '-r[reverse sort order]' \ '-F+[specify format for each list item]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ + '-K+[specify format for each shortcut key]:format:__tmux-formats' \ '-O+[initial sort order]:order:(time name size)' \ '-t+[specify target window]:session:__tmux-windows' \ '*:::template:= _tmux' @@ -225,8 +235,11 @@ _tmux-choose-client() { [[ -n ${tmux_describe} ]] && print "put a window into client choice mode" && return _arguments -s \ '-N[start without the preview]' \ + '-Z[zoom the pane]' \ + '-r[reverse sort order]' \ '-F+[specify format for each list item]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ + '-K+[specify format for each shortcut key]:format:__tmux-formats' \ '-O+[initial sort order]:order:(time name size)' \ '-t+[specify target window]:session:__tmux-windows' \ '*:::template:= _tmux' @@ -237,8 +250,11 @@ _tmux-choose-tree() { _arguments -s \ '-G[include all sessions in any session groups in the tree rather than only the first]' \ '-N[start without the preview]' \ + '-Z[zoom the pane]' \ + '-r[reverse sort order]' \ '-F+[specify format for each list item]:format:__tmux-formats' \ '-f+[filter items]:filter format:__tmux-formats' \ + '-K+[specify format for each shortcut key]:format:__tmux-formats' \ '-O+[initial sort order]:order:(time name size)' \ '-s[choose among sessions]' \ '-t+[specify target window]:session:__tmux-windows' \ @@ -260,11 +276,14 @@ _tmux-command-prompt() { [[ -n ${tmux_describe} ]] && print "open the tmux command prompt in a client" && return _arguments -s \ '-1[only accept one key press]' \ - '-N' \ + '-k[only accept one key press and translate it to a key name]' \ + '-N[accept only numeric key presses]' \ '-i[execute the command every time the prompt input changes]' \ '-I+[specify list of initial inputs]:initial-text (comma-separated list)' \ '-p+[specify list of prompts]:prompts (comma-separated list)' \ '-t+[specify target client]:client:__tmux-clients' \ + '(-W)-T[prompt is for a target - tab complete as appropriate]' \ + '(-T)-W[prompt is for a window - tab complete as appropriate]' \ '*:::template:= _tmux' } @@ -279,11 +298,25 @@ _tmux-confirm-before() { _tmux-copy-mode() { [[ -n ${tmux_describe} ]] && print "enter copy mode" && return _arguments -s \ + '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify target pane]:pane:__tmux-panes' \ + '-e[scrolling to the bottom should exit copy mode]' \ + '-H[hide the position indicator in the top right]' \ + '-q[cancel copy mode and any other modes]' \ '-u[scroll up one page]' \ '-M[begin a mouse drag]' } +_tmux-customize-mode() { + [[ -n ${tmux_describe} ]] && print "enter customize mode" && return + _arguments -s \ + '-F+[specify format for each item in the tree]:format:__tmux-formats' \ + '-f+[specify initial filter]:filter:__tmux-formats' \ + '-N[start without the option information]' \ + '-t+[specify target pane]:pane:__tmux-panes' \ + '-Z[zoom the pane]' +} + _tmux-delete-buffer() { [[ -n ${tmux_describe} ]] && print "delete a paste buffer" && return _arguments '-b+[specify target buffer name]:buffer:__tmux-buffers' @@ -299,16 +332,48 @@ _tmux-detach-client() { '-t+[specify target client]:client:__tmux-clients' } +_tmux-display-menu() { + [[ -n ${tmux_describe} ]] && print "display a menu" && return + local curcontext="$curcontext" ret=1 + local -a state line expl + _arguments -C -s -S -A "-*" \ + '-c+[specify target client]:client:__tmux-clients' \ + "-O[don't close menu if mouse is released without making a selection]" \ + '-t+[specify target pane]:pane:__tmux-panes' \ + '-T+[specify title]:title' \ + '-x+[specify horizontal position]: : _alternative "columns\: \:_guard \[0-9\]\# column" "positions\:position\:((R\:right P\:bottom M\:mouse W\:window))"' \ + '-y+[specify vertical position]: : _alternative "rows\: \:_guard \[0-9\]\# row" "positions\:position\:((P\:left M\:mouse S\:status\ line))"' \ + '*::: :->options' && ret=0 + + if [[ -n $state ]]; then + case $(( CURRENT % 3 )) in + 1) _message -e menu-options 'menu option' ;; + 2) _message -e keys 'shortcut key' ;; + 0) + compset -q + words=( menu "$words[@]" ) + (( CURRENT++ )) + _tmux && ret=0 + ;; + esac + fi + + return ret +} + _tmux-display-message() { [[ -n ${tmux_describe} ]] && print "display a message in the status line" && return _arguments -s -S -A "-*" \ '(-p -F :)-a[list the format variables and their values]' \ + '-I[forward any input read from stdin to the target pane]' \ + '-N[ignore key presses and only close after the delay]' \ '-c+[specify target client]:client:__tmux-clients' \ + '-d+[time to display message]:delay (milliseconds)' \ '(-a)-p[print message to stdout]' \ '-t+[specify target pane]:pane:__tmux-panes' \ '(-a)-F+[specify output format]:format:__tmux-formats' \ - '(-a)-v[prints verbose logging as the format is parsed]' \ - ':message' + '(-a)-v[print verbose logging as the format is parsed]' \ + ':message:__tmux-formats' } _tmux-display-panes() { @@ -320,9 +385,26 @@ _tmux-display-panes() { '*:::command:= _tmux' } +_tmux-display-popup() { + [[ -n ${tmux_describe} ]] && print "display a popup box over a pane" && return + _arguments -s \ + '-C[close any popup on the client]' \ + '-c+[specify target client]:client:__tmux-clients' \ + '-d+[specify working directory for the command]:directory:_directories' \ + '-E[close the popup when the command exits]' \ + '-w+[specify width]:width' \ + '-h+[specify height]:height' \ + '-t+[specify target pane]:pane:__tmux-panes' \ + '-x+[specify horizontal position]:position' \ + '-y+[specify vertical position]:position' \ + ':shell command:_cmdstring' +} + _tmux-find-window() { [[ -n ${tmux_describe} ]] && print "search for a pattern in windows" && return _arguments -s \ + '-i[ignore case]' \ + '-r[use regular expression matching]' \ '-C[match visible contents]' \ '-N[match window name]' \ '-T[match window title]' \ @@ -354,13 +436,15 @@ _tmux-if-shell() { _tmux-join-pane() { [[ -n ${tmux_describe} ]] && print "split a pane and move an existing one into the new space" && return + # -p removed from documentation but still works, or use -l and append % _arguments -s \ '-b[join source pane left of or above target pane]' \ "-d[don't make the new window become the active one]" \ + '(-l)-f[span the full size]' \ '-h[split horizontally]' \ '-v[split vertically]' \ - "-l+[define new pane's size]: :_guard '[0-9]#' 'numeric value'" \ - "-p+[define new pane's size in percent]: :_guard '[0-9]#' 'numeric value'" \ + "(-p)-l[define new pane's size]:size" \ + "!(-f -l)-p+:size (percentage)" \ '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify target pane]:pane:__tmux-panes' } @@ -397,6 +481,7 @@ _tmux-last-pane() { _arguments -s \ '-d[disable input to the pane]' \ '-e[enable input to the pane]' \ + '-Z[keep window zoomed if it was zoomed]' \ '-t+[specify session]:session:__tmux-sessions' } @@ -408,6 +493,8 @@ _tmux-last-window() { _tmux-link-window() { [[ -n ${tmux_describe} ]] && print "link a window to another" && return _arguments -s \ + '(-b)-a[move window to next index after destination window]' \ + '(-a)-b[move window to next index before destination window]' \ "-d[don't make the new window become the active one]" \ '-k[kill the target window if it exists]' \ '-s+[specify source window]:window:__tmux-windows' \ @@ -416,7 +503,9 @@ _tmux-link-window() { _tmux-list-buffers() { [[ -n ${tmux_describe} ]] && print "list paste buffers of a session" && return - _arguments '-F+[specify output format]:format:__tmux-formats' + _arguments \ + '-F+[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' } _tmux-list-clients() { @@ -428,12 +517,16 @@ _tmux-list-clients() { _tmux-list-commands() { [[ -n ${tmux_describe} ]] && print "list supported sub-commands" && return - _arguments '-F+[specify format]:format' + _arguments '-F+[specify format]:format:__tmux-formats' '1:sub-command:_tmux' } _tmux-list-keys() { [[ -n ${tmux_describe} ]] && print "list all key-bindings" && return _arguments -s \ + '-1[list only the first matching key]' \ + '-a[list the command for keys that do have a note]' \ + '-N[list only keys with attached notes]' \ + '-P+[specify a prefix to print before each key]:prefix' \ '-T+[specify key table]:key table' } @@ -448,12 +541,15 @@ _tmux-list-panes() { _arguments -s $args \ '-a[list all panes the server possesses]' \ '-F+[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ '-s[if specified, -t chooses a session]' } _tmux-list-sessions() { [[ -n ${tmux_describe} ]] && print "list sessions managed by server" && return - _arguments '-F+[specify output format]:format:__tmux-formats' + _arguments \ + '-F+[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' } _tmux-list-windows() { @@ -461,6 +557,7 @@ _tmux-list-windows() { _arguments -s \ '-a[list all windows the tmux server possesses]' \ '-F[specify output format]:format:__tmux-formats' \ + '-f+[filter items]:filter format:__tmux-formats' \ '-t+[specify session]:session:__tmux-sessions' } @@ -468,6 +565,8 @@ _tmux-load-buffer() { [[ -n ${tmux_describe} ]] && print "load a file into a paste buffer" && return _arguments -A "-*" -S \ '-b+[specify target buffer name]:buffer:__tmux-buffers' \ + '-t+[specify target client]:client:__tmux-clients' \ + '-w[also send the buffer to the clipboard using the xterm escape sequence]' \ '1:file:_files' } @@ -487,21 +586,14 @@ _tmux-lock-session() { } _tmux-move-pane() { - [[ -n ${tmux_describe} ]] && print "move a pane into a new space" && return - _arguments -s \ - '-b[join source pane left of or above target pane]' \ - "-d[don't make the new window become the active one]" \ - '-h[split horizontally]' \ - '-v[split vertically]' \ - "-l+[define new pane's size]:numeric value" \ - "-p+[define new pane's size in percent]:numeric value" \ - '-s+[specify source pane]:pane:__tmux-panes' \ - '-t+[specify target pane]:pane:__tmux-panes' + _tmux-join-pane "$@" } _tmux-move-window() { [[ -n ${tmux_describe} ]] && print "move a window to another" && return _arguments -s \ + '(-b)-a[move window to next index after destination window]' \ + '(-a)-b[move window to next index before destination window]' \ "-d[don't make the new window become the active one]" \ '-k[kill the target window if it exists]' \ '-s+[specify source window]:window:__tmux-windows' \ @@ -512,31 +604,37 @@ _tmux-move-window() { _tmux-new-session() { [[ -n ${tmux_describe} ]] && print "create a new session" && return _arguments -s -A "-*" -S \ - '-A[attach to existing session if it already exists]' \ '-c+[specify working directory for the session]:directory:_directories' \ + '-A[attach to existing session if it already exists]' \ "-d[don't attach new session to current terminal]" \ - "-D[in case of -A behave like attach-session's -d]" \ + "-D[with -A, detach other clients attached to session]" \ "-E[don't apply update-environment option]" \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-F+[specify output format]:format:__tmux-formats' \ + '-f+[specify client flags]: :_tmux_client_flags' \ '-n+[specify initial window name]:window name' \ '-P[print information about new session after it is created]' \ '-s+[name the session]:session name:__tmux-sessions' \ '-t+[specify target session]:session:__tmux-sessions' \ '-x[specify width]:width' \ '-y[specify height]:height' \ + '-X[with -D, send SIGHUP to the parent of the attached client]' \ '*:: :_cmdambivalent' } _tmux-new-window() { [[ -n ${tmux_describe} ]] && print "create a new window" && return _arguments -s -A "-*" -S \ - '-a[insert new window at next free index from -t]' \ + '(-b)-a[insert new window at next index after target]' \ + '(-a)-b[insert new window at next index before target]' \ '-c+[specify working directory for the session]:directory:_directories' \ - "-d[don't make the new window become the active one]" \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ + "(-S)-d[don't make the new window become the active one]" \ '-F+[specify output format]:format:__tmux-formats' \ '-k[destroy it if the specified window exists]' \ '-n+[specify a window name]:window name' \ '-P[print information about new window after it is created]' \ + '(-d)-S[select window if name already exists]' \ '-t+[specify target window]:window:__tmux-windows' \ '*:: :_cmdambivalent' } @@ -588,10 +686,13 @@ _tmux-previous-window() { _tmux-refresh-client() { [[ -n ${tmux_describe} ]] && print "refresh a client" && return - _arguments -s -S -A "-*" \ + _arguments -s -A "-*" -S \ + '-B+[set a subscription to a format for a control mode client]:subscription' \ + '-A+[allow a control mode client to trigger actions on a pane]:pane:__tmux-panes -P% -S\:' \ '-C+[set the width and height of a control client]:width,height' \ '-c[reset so that the position follows the cursor]' \ '-D[move visible portion of window down]' \ + '-f+[set client flags]:flag:_tmux_client_flags' \ '-L[move visible portion of window left]' \ '-l[request clipboard from the client and store it in a new paste buf using xterm(1) escape sequence]' \ "-S[only update the client's status bar]" \ @@ -624,6 +725,7 @@ _tmux-resize-pane() { '-R[resize to the right]' \ '-U[resize upward]' \ '-t+[specify target pane]:pane:__tmux-panes' \ + '-T[trim lines below the cursor position and moves lines out of the history to replace them]' \ '-x+[specify width]:width' \ '-y+[specify height]:height' \ '-Z[toggle zoom of pane]' \ @@ -649,6 +751,7 @@ _tmux-respawn-pane() { [[ -n ${tmux_describe} ]] && print "reuse a pane in which a command has exited" && return _arguments -s -A "-*" -S \ '-c+[specify a new working directory for the pane]:directory:_directories' \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-k[kill window if it is in use]' \ '-t+[specify target pane]:pane:__tmux-pane' \ ':command:_cmdambivalent' @@ -658,6 +761,7 @@ _tmux-respawn-window() { [[ -n ${tmux_describe} ]] && print "reuse a window in which a command has exited" && return _arguments -s -A "-*" -S \ '-c+[specify a new working directory for the window]:directory:_directories' \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-k[kill window if it is in use]' \ '-t+[specify target window]:window:__tmux-windows' \ ':command:_cmdambivalent' @@ -668,15 +772,28 @@ _tmux-rotate-window() { _arguments -s \ '-D[rotate downward]' \ '-U[rotate upward]' \ + '-Z[keep the window zoomed if it was zoomed]' \ '-t+[specify target window]:window:__tmux-windows' } _tmux-run-shell() { [[ -n ${tmux_describe} ]] && print "execute a command without creating a new window" && return - _arguments -s -A "-*" -S \ - '-b[run shell command in background]' \ + local curcontext="$curcontext" ret=1 + local -a state line expl + _arguments -C -s -A "-*" -S \ + '-b[run command in background]' \ + '(1)-C[run a tmux command]' \ + '-d+[specify delay before starting the command]:delay (seconds)' \ '-t+[specify target pane]:pane:__tmux-panes' \ - ':command:_cmdstring' + '(2)1:command:_cmdstring' \ + '2:tmux command:->tmux-commands' && ret=0 + + if [[ -n $state ]]; then + compset -q + words=( run "$words[@]" ) + (( CURRENT++ )) + _tmux && ret=0 + fi } _tmux-save-buffer() { @@ -699,6 +816,7 @@ _tmux-select-layout() { _tmux-select-pane() { [[ -n ${tmux_describe} ]] && print "make a pane the active one in the window" && return + # -P and -g have been removed from the documentation in tmux 3 but still work _arguments -s \ '-D[move to the pane below target]' \ '-d[disable input to the pane]' \ @@ -710,6 +828,7 @@ _tmux-select-pane() { '-m[set marked pane]' \ '-R[move to the pane right of target]' \ '-U[move to the pane above target]' \ + '-Z[keep the window zoomed if it was zoomed]' \ '-P+[set pane style]:style:__tmux-style' \ '-T+[set the pane title]:title' \ '-t+[specify target pane]:pane:__tmux-panes' @@ -728,7 +847,9 @@ _tmux-select-window() { _tmux-send-keys() { [[ -n ${tmux_describe} ]] && print "send key(s) to a window" && return _arguments -s -A "-*" -S \ - '-l[disable key name lookup and send data literally]' \ + '(-H)-l[disable key name lookup and send data literally]' \ + '-F[expand formats in arguments where appropriate]' \ + '(-l)-H[interpret key as hexadecimal number for an ASCII character]' \ '-R[reset terminal state]' \ '-M[pass through a mouse event]' \ '-X[send a command into copy mode]' \ @@ -755,6 +876,8 @@ _tmux-set-buffer() { '-a[append to rather than overwriting target buffer]' \ '-b+[specify target buffer index]:pane:__tmux-buffers' \ '-n+[specify new buffer name]:buffer-name' \ + '-t+[specify target client]:client:__tmux-clients' \ + '-w[also send the buffer to the clipboard using the xterm escape sequence]' \ ':data' } @@ -764,7 +887,9 @@ _tmux-set-environment() { local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C -s -A "-*" -S : \ + '-F[expand value as a format]' \ '(-t)-g[modify global environment]' \ + '-h[mark the variable as hidden]' \ '(-u)-r[remove variable before starting new processes]' \ '(-r)-u[unset a variable]' \ '(-g)-t[specify target session]:target session:__tmux-sessions' \ @@ -801,8 +926,10 @@ _tmux-set-option() { '-o[prevent setting of an option that is already set]' \ '-q[suppress errors about unknown or ambiguous options]' \ '-u[unset a non-global option]' \ - '-w[change window (not session) options]' \ - '-s[change server (not session) options]' \ + '-U[unset a pane option across all panes in the window]' \ + '(-w -s)-p[change pane (no session) options]' \ + '(-p -s)-w[change window (not session) options]' \ + '(-p -w)-s[change server (not session) options]' \ '-t+[specify target session]:target session:__tmux-sessions' \ '*:: :->name_or_value' && ret=0 @@ -835,8 +962,11 @@ _tmux-set-window-option() { _tmux-set-hook() { [[ -n ${tmux_describe} ]] && print "set a hook to a command" && return _arguments -s \ + '-a[append to hook]' \ '(-R)-g[add hook to global list]' \ '(-g -u)-R[run hook immediately]' \ + '(-w)-p[set pane hooks]' \ + '(-p)-w[set window hooks]' \ '(-R)-u[unset a hook]' \ '-t+[specify target session]:session:__tmux-sessions' \ ':hook name:_tmux_hooks' \ @@ -847,6 +977,8 @@ _tmux-show-hooks() { [[ -n ${tmux_describe} ]] && print "show the global list of hooks" && return _arguments -s -S -A "-*" \ '-g[show global list of hooks]' \ + '(-w)-p[show pane hooks]' \ + '(-p)-w[show window hooks]' \ '-t+[specify target session]:session:__tmux-sessions' \ } @@ -862,6 +994,7 @@ _tmux-show-environment() { typeset -A opt_args _arguments -C -A "-*" -s : \ '(-t)-g[show global environment]' \ + '-h[show hidden variables]' \ '-s[format output as Bourne shell commands]' \ '(-g)-t+[specify target session]:target session:__tmux-sessions' \ '1:: :->name' && ret=0 @@ -888,11 +1021,14 @@ _tmux-show-options() { local curcontext="$curcontext" state line ret=1 typeset -A opt_args _arguments -C -s : \ + '-A[include options inherited from a parent set]' \ + '-H[include hooks]' \ '-g[show global options]' \ '-q[suppress errors about unknown or ambiguous options]' \ - '-s[show server options]' \ '-v[show only the option value, not the name]' \ - '-w[show window options]' \ + '(-s -w)-p[show pane (not session) options]' \ + '(-p -w)-s[show server (not session) options]' \ + '(-p -s)-w[show window (not session) options]' \ '-t+[specify target session]:target session:__tmux-sessions' \ '*:: :->name_or_value' && ret=0 @@ -921,22 +1057,29 @@ _tmux-show-window-options() { _tmux-source-file() { [[ -n ${tmux_describe} ]] && print "execute tmux commands from a file" && return _arguments \ + '-F[expand path as a format]' \ + '-n[file is parsed but no commands are executed]' \ "-q[don't report error if path doesn't exist]" \ + '-v[show parsed commands and line numbers if possible]' \ '*:path:_directories' } _tmux-split-window() { [[ -n ${tmux_describe} ]] && print "splits a pane into two" && return + # -p removed from documentation but still works, or use -l and append % _arguments -s \ '-b[create new pane left of or above target pane]' \ "-d[don't make the new window become the active one]" \ + '*-e[specify environment variable]:environment variable:_parameters -g "*export*" -qS=' \ '-F+[specify output format]:format:__tmux-formats' \ - '-f[create new pane spanning full window width or height]' \ + '(-l)-f[create new pane spanning full window width or height]' \ '-h[split horizontally]' \ '-v[split vertically]' \ - "-l[define new pane's size]:size" \ - "-p[define new pane's size in percent]:size (percentage)" \ + "(-p)-l[define new pane's size]:size" \ + "!(-f -l)-p+:size (percentage)" \ '-t+[specify target pane]:pane:__tmux-panes' \ + '-Z[zoom the pane]' \ + '(:)-I[create empty pane and forward stdin to it]' \ ':command:_cmdambivalent' # Yes, __tmux-panes is correct here. The behaviour was changed # in recent tmux versions and makes more sense. Except that @@ -959,6 +1102,7 @@ _tmux-swap-pane() { _arguments -s \ '-D[move pane down]' \ '-U[move pane up]' \ + '-Z[keep the window zoomed if it was zoomed]' \ "-d[don't change the active pane]" \ '-s+[specify source pane]:pane:__tmux-panes' \ '-t+[specify destination pane]:pane:__tmux-panes' @@ -981,6 +1125,7 @@ _tmux-switch-client() { '-n[move client to next session]' \ '-p[move client to previous session]' \ '-r[toggle read-only flag of client]' \ + '-Z[keep the window zoomed if it was zoomed]' \ '-t+[specify target window]:window:__tmux-windows' } @@ -993,6 +1138,7 @@ _tmux-unbind-key() { _arguments -C -s \ '-a[remove all key bindings]' \ '-n[remove a non-prefix binding]' \ + '-q[prevent errors being returned]' \ '-T[specify key table]:key table' \ '*:: :->boundkeys' @@ -1042,7 +1188,7 @@ function __tmux-buffers() { fi buffers=( ${${(f)"$(command tmux 2> /dev/null list-buffers "${bopts[@]}")"}/:[ $'\t']##/:} ) - _describe -t buffers 'buffers' buffers + _describe -t buffers 'buffer' buffers } function __tmux-bound-keys() { @@ -1050,14 +1196,14 @@ function __tmux-bound-keys() { local -a keys keys=( ${${${${(f)"$(command tmux 2> /dev/null list-keys "$@")"}/:[ $'\t']##/:}/(#s)[ $'\t']##/}/(#s):/\\:} ) - _describe -t keys 'keys' keys + _describe -t keys 'key' keys } function __tmux-clients() { local expl local -a clients clients=( ${${(f)"$(command tmux 2> /dev/null list-clients)"}/:[ $'\t']##/:} ) - _describe -t clients 'clients' clients + _describe -t clients 'client' clients } function __tmux-environment-variables() { @@ -1093,7 +1239,7 @@ function __tmux-environment-variables() { descriptions+=( "${k//:/\\:}:$v" ) done # TODO: this if/else is because '_describe ${hint:+"-x"}' prints the "No matches" error in addition to the message. - local msg="${dash_g[1]:+"global "}environment variables${hint}" + local msg="${dash_g[1]:+"global "}environment variable${hint}" if _describe -t parameters $msg descriptions; then : elif [[ -n $hint ]]; then @@ -1311,6 +1457,11 @@ _tmux_hooks() { 'post-hooks:command post-hook:compadd - after-${_tmux_aliasmap}' } +_tmux_client_flags() { + _values -s , flag active-pane ignore-size no-output \ + 'pause-after:time (seconds)' read-only wait-exit +} + function __tmux-get-optarg() { local opt="$1" local -i i @@ -1535,23 +1686,18 @@ function __tmux-options-complete() { } function __tmux-panes() { - local expl line + local expl line orig="$IPREFIX" local -i num local -a panes opts - compset -P '*.' - if [[ -n ${IPREFIX} ]]; then - opts=( -t "${IPREFIX%.}" ) - else - opts=( ) - fi + compset -P '*.' && opts=( -t "${${IPREFIX%.}#$orig}" ) num=0 command tmux 2> /dev/null list-panes "${opts[@]}" | while IFS= read -r line; do panes+=( $(( num++ )):${line//:/} ) done - _describe -t panes 'panes' panes "$@" + _describe -t panes 'pane' panes "$@" if [[ ${IPREFIX} != *. ]]; then - _wanted windows expl 'windows' __tmux-windows -S. + _wanted windows expl 'window' __tmux-windows -S. fi } @@ -1576,14 +1722,14 @@ function __tmux-server-options() { function __tmux-sessions() { local -a sessions sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} ) - _describe -t sessions 'sessions' sessions "$@" + _describe -t sessions 'session' sessions "$@" } function __tmux-sessions-attached() { local -a sessions sessions=( ${${(f)"$(command tmux 2> /dev/null list-sessions)"}/:[ $'\t']##/:} ) sessions=( ${(M)sessions:#*"(attached)"} ) - _describe -t sessions 'attached sessions' sessions "$@" + _describe -t sessions 'attached session' sessions "$@" } # Complete attached-sessions and detached-sessions as separate tags. @@ -1599,8 +1745,8 @@ function __tmux-sessions-separately() { _tags detached-sessions attached-sessions # Placing detached before attached means the default behaviour of this # function better suits its only current caller, _tmux-attach-session(). - _requested detached-sessions && _describe -t detached-sessions 'detached sessions' detached_sessions "$@" && ret=0 - _requested attached-sessions && _describe -t attached-sessions 'attached sessions' attached_sessions "$@" && ret=0 + _requested detached-sessions && _describe -t detached-sessions 'detached session' detached_sessions "$@" && ret=0 + _requested attached-sessions && _describe -t attached-sessions 'attached session' attached_sessions "$@" && ret=0 return ret } @@ -1672,9 +1818,9 @@ function __tmux-windows() { opts=( ) fi wins=( ${${(M)${(f)"$(command tmux 2> /dev/null list-windows "${opts[@]}")"}:#<->*}/:[ $'\t']##/:} ) - _describe -t windows 'windows' wins "$@" + _describe -t windows 'window' wins "$@" if [[ ${IPREFIX} != *: ]]; then - _wanted sessions expl 'sessions' __tmux-sessions -S: + _wanted sessions expl 'session' __tmux-sessions -S: fi } @@ -1689,10 +1835,13 @@ _tmux() { '-2[force using 256 colours]' \ '-c[execute a shell command]:command name:_command_names' \ '-C[start tmux in control mode. -CC disables echo]' \ + "-D[don't start the tmux server as a daemon]" \ '-f[specify configuration file]:tmux config file:_files -g "*(-.)"' \ '-l[behave like a login shell]' \ '-L[specify socket name]:socket name:__tmux-socket-name' \ + "-N[don't start the server even if the command would normally do so]" \ '-S[specify socket path]:server socket:_path_files -g "*(=,/)"' \ + '-T+[set terminal features for the client]: : _values -s , 256 clipboard ccolour cstyle extkeys focus margins mouse overline rectfill RGB strikethrough sync title usstyle' \ '-u[force using UTF-8]' \ '-v[request verbose logging]' \ '-V[report tmux version]' \ @@ -1703,11 +1852,11 @@ _tmux() { if (( CURRENT == 1 )); then zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both' if [[ ${mode} == 'commands' ]]; then - _describe -t subcommands 'tmux commands' _tmux_commands && ret=0 + _describe -t subcommands 'tmux command' _tmux_commands && ret=0 elif [[ ${mode} == 'aliases' ]]; then - _describe -t subcommands 'tmux aliases' _tmux_aliases && ret=0 + _describe -t subcommands 'tmux alias' _tmux_aliases && ret=0 else - _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases && ret=0 + _describe -t subcommands 'tmux command or alias' _tmux_commands -- _tmux_aliases && ret=0 fi else tmuxcommand="${words[1]}" diff --git a/Completion/Unix/Command/_todo.sh b/Completion/Unix/Command/_todo.sh index 287c9ff78..99b6bb695 100644 --- a/Completion/Unix/Command/_todo.sh +++ b/Completion/Unix/Command/_todo.sh @@ -55,21 +55,26 @@ case $state in "append:adds to item on line NUMBER the text TEXT." "archive:moves done items from todo.txt to done.txt." "command:run internal commands only" + "deduplicate:removes duplicate lines from todo.txt." "del:deletes the item on line NUMBER in todo.txt." "depri:remove prioritization from item" + "done:marks task(s) on line ITEM# as done in todo.txt" "do:marks item on line NUMBER as done in todo.txt." "help:display help" "list:displays all todo items containing TERM(s), sorted by priority." "listall:displays items including done ones containing TERM(s)" + "listaddons:lists all added and overridden actions in the actions directory." "listcon:list all contexts" "listfile:display all files in .todo directory" "listpri:displays all items prioritized at PRIORITY." + "listproj:lists all the projects in todo.txt." "move:move item between files" "prepend:adds to the beginning of the item on line NUMBER text TEXT." "pri:adds or replace in NUMBER the priority PRIORITY (upper case letter)." "replace:replace in NUMBER the TEXT." "remdup:remove exact duplicates from todo.txt." "report:adds the number of open and done items to report.txt." + "showhelp:list the one-line usage of all built-in and add-on actions." ) _describe -t todo-commands 'todo.sh command' cmdlist ;; @@ -98,7 +103,7 @@ case $state in fi ;; - (depri|do|dp) + (depri|do|dp|done) nextstate=item ;; diff --git a/Completion/Unix/Command/_top b/Completion/Unix/Command/_top index 652432166..692df790d 100644 --- a/Completion/Unix/Command/_top +++ b/Completion/Unix/Command/_top @@ -64,7 +64,6 @@ case $OSTYPE in '-I[do not display idle processes]' '-i[interactive mode]' '-n[non-interactive mode (identical to batch mode)]' - '-o+[sort process display by the specified field]:field:( $fields )' '-p+[filter by the specified pid]: :_pids' '-q[renice top to -20]' '-S[show system processes]' @@ -80,6 +79,7 @@ case $OSTYPE in '-j[display the jail ID]' '-t[do not display the top process]' '-m+[specify statistic type]:type:(( cpu\:default io ))' + '-o+[sort process display by the specified field]:field:( $fields )' '-P[per-cpu CPU usage statistics]' '(1 -)-v[write version number and exit]' '-w[display approximate swap usage]' @@ -89,10 +89,14 @@ case $OSTYPE in );; openbsd*) fields+=( command ) + order=( '-:reverse order' ) specs+=( '-1[combine CPU statistic into one line]' + '-t[show the routing table instead of the wait channel]' '-C[show command arguments as well as process name]' '-g+[filter processes by the specified string]:string' + '-o+[sort process display by the specified field]:field:->sortkey' + '-T+[filter processes by the specified routing table]:routing table:_routing_tables' '-U+[filter processes by the specified user]: :_users -M "L\:|-="' );; darwin*) diff --git a/Completion/Unix/Command/_tput b/Completion/Unix/Command/_tput index a3b4e949c..abba3e8c0 100644 --- a/Completion/Unix/Command/_tput +++ b/Completion/Unix/Command/_tput @@ -14,5 +14,5 @@ esac _arguments : \ $args - set3 \ '(-S -V)-T+[terminal type]:terminal type:_terminals' \ - '1:terminal capabilities:( init reset longname ${(k)terminfo} )' \ + '1:terminal capability:( init reset longname ${(k)terminfo} )' \ '*:capability parameters:{ [[ $words[1] != (init|reset|longname) ]] && _message parameter }' diff --git a/Completion/Unix/Command/_transmission b/Completion/Unix/Command/_transmission index 8a4bebec3..a640f3dd7 100644 --- a/Completion/Unix/Command/_transmission +++ b/Completion/Unix/Command/_transmission @@ -6,17 +6,17 @@ local exclusive_auth_options='(-n --auth -ne --authenv -N --netrc)' local general_options=( {-d,--debug}'[enable debugging mode]' - $exclusive_auth_options{-n-,--auth=}'[set the username and password for authentication]:username\:password: ' + $exclusive_auth_options{-n+,--auth=}'[set the username and password for authentication]:username\:password: ' $exclusive_auth_options{-ne,--authenv}'[set the authentication information from the TR_AUTH environment variable]' - $exclusive_auth_options{-N-,--netrc=}'[set the authentication information from a netrc file]:file:_files' + $exclusive_auth_options{-N+,--netrc=}'[set the authentication information from a netrc file]:file:_files' '--find[tell Transmission where to look for the current torrents'"'"' data]' ) # `general_actions`: *actions* that can be specified when a specific set of torrents is either specified or either not local general_actions=( - '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}' + '(- :)'{-gsr,--global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed until a specific ratio]:ratio (kB/s)' '(- :)'{-GSR,--no-global-seedratio}'[all torrents, unless overridden by a per-torrent setting, should seed regardless of ratio]' '(- :)'{-pr,--peers}'[set the maximum number of peers]:number: ' - '(- :)'{-d-,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit:{_message "limit in kB/sec"}' + '(- :)'{-d+,--downlimit=}'[limit the maximum download speed to limit kB/s]:limit (kB/s)' '(- :)'{-D,--no-downlimit}'[disable download speed limits]' ) # `global_only_actions`: *actions* that can be specified only when no specific torrent is specified @@ -27,12 +27,12 @@ local global_only_actions=( '(- :)'{-asu,--alt-speed-uplimit}'[limit the alternate upload speed to limit kilobytes per second]' '(- :)'{-asc,--alt-speed-scheduler}'[use the scheduled on/off times]' '(- :)'{-asc,--not-alt-speed-scheduler}'[don'"'"'t use the scheduled on/off times]' - '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:hhmm:_transmission-remote_time' - '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:hhmm:_transmission-remote_time' + '(- :)--alt-speed-time-begin[time to start using the alt speed limits]:time (HHMM)' + '(- :)--alt-speed-time-end[time to stop using the alt speed limits]:time (HHMM)' '(- :)--alt-speed-days[set the number of days on which to enable the speed scheduler]:days:_transmission-remote_days' '(- :)--torrent-done-script[specify a file to run each time a torrent finishes]:script:_files' '(- :)--no-torrent-done-script[don'"'"'t run any script when a torrent finishes]' - '(- :)'{-e-,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):' + '(- :)'{-e+,--cache=}'[set the session'"'"'s maximum memory cache size in MiB]:size (MiB):' '(- :)'{-er,--encryption-required}'[encrypt all peer connections]' '(- :)'{-ep,--encryption-preferred}'[prefer encrypted peer connections]' '(- :)'{-et,--encryption-tolerated}'[prefer unencrypted peer connections]' @@ -42,7 +42,7 @@ local global_only_actions=( {-t,--torrent=}'[set the current torrent(s) for use by subsequent options]:torrent:_transmission-remote_torrent' '(- :)'{-si,--session-info}'[list session information from the server]' '(- :)'{-st,--session-stats}'[list statistical information from the server]' - {-a-,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add' + {-a+,--add=}'[add torrents to transmission]:filename\|url:_transmission-remote_add' '(- :)'{-l,--list}'[list all torrents]' '(- :)'{-p,--port}'[set the port for use when listening for incoming peer connections]:port:' '(- :)--start-paused[start added torrents paused]' @@ -51,7 +51,7 @@ local global_only_actions=( '(- :)'{-M,--no-portmap}'[disable portmapping]' '(- :)'{-o,--dht}'[enable distributed hash table]' '(- :)'{-O,--no-dht}'[disable distributed hash table]' - '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit:{_message "limit in kB/sec"}' + '(- :)'{-u,--uplimit}'[limit the maximum upload speed to limit kB/s]:limit (kB/s)' '(- :)'{-U,--no-uplimit}'[disable upload speed limits]' '(- :)--utp[enable uTP for peer connections]' '(- :)--no-utp[disable uTP for peer connections]' @@ -65,9 +65,9 @@ local global_only_actions=( ) # `torrent_add_options`: *options* that can be used only when *adding* a torrent local torrent_add_options=( - '(-C --no-incomplete-dir)'{-c-,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:dir:{_files -/}' + '(-C --no-incomplete-dir)'{-c+,--incomplete-dir=}'[when adding new torrents, store their contents in directory until the torrent is done]:directory:_directories' '(-c --incomplete-dir)'{-C,--no-incomplete-dir}'[don'"'"'t store incomplete torrents in a different directory]' - {-w-,--download-dir=}'[when used in conjunction with --add, set the new torrent'"'"'s download folder]:dir:{_files -/}' + {-w+,--download-dir=}"[when used in conjunction with --add, set the new torrent's download directory]:directory:_directories" ) # `torrent_action_only_actions`: *actions* that can be specified only when explicitly selecting a specific set of torrents local torrent_action_only_actions=( @@ -81,15 +81,15 @@ local torrent_action_only_actions=( {-it,--info-trackers}'[list the specified torrent'"'"'s trackers]' '--trash-torrent[delete torrents after adding]' '--no-trash-torrent[do not delete torrents after adding]' - {-td-,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls' - {-tr-,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id' + {-td+,--tracker-add=}'[add a tracker to a torrent]:tracker:_urls' + {-tr+,--tracker-remove=}'[remove a tracker from a torrent]:tracker_id:_transmission-remote_torrent_tracker_id' {-s,--start}'[start the current torrent(s)]' {-S,--stop}'[stop the current torrent(s) from downloading or seeding]' {-r,--remove}'[remove the current torrent(s) without deleting the downloaded data]' {-rad,--remove-and-delete}'[remove the current torrent(s) and delete the downloaded data]' '--reannounce[reannounce the current torrent(s)]' - '--move[move the current torrents'"'"' data from their current locations to the specified directory]:{_files -/}' - {-sr-,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio:{_message "ratio in kB/sec"}' + "--move[move the current torrents' data from their current locations to the specified directory]:directory:_directories" + {-sr+,--seedratio=}'[let the current torrent(s) seed until a specific ratio]:ratio' {-SR,--no-seedratio}'[let the current torrent(s) use the global seedratio settings]' {-hl,--honor-session}'[make the current torrent(s) honor the session limits]' {-HL,--no-honor-session}'[make the current torrent(s) not honor the session limits]' @@ -97,19 +97,13 @@ local torrent_action_only_actions=( {-Bn,--bandwidth-normal}'[give this torrent the bandwidth left over by high priority torrents]' {-Bl,--bandwidth-low}'[give this torrent the bandwidth left over by high and normal priority torrents]' {-ph,--priority-high}'[try to download the specified file(s) first]:torrent_file:_transmission-remote_torrent_priority_not_high' - {-pn,--priority-normal}'[try to download the specified files normally.]:torrent_file:_transmission-remote_torrent_priority_not_normal' + {-pn,--priority-normal}'[try to download the specified files normally]:torrent_file:_transmission-remote_torrent_priority_not_normal' {-pl,--priority-low}'[try to download the specified files last]:torrent_file:_transmission-remote_torrent_priority_not_low' {-v,--verify}'[verify the current torrent(s)]' ) # helper functions -# complete argument specified after global only action: `--alt-speed-time-begin` -# completes time in HHMM format -(( $+functions[_transmission-remote_time] )) || -_transmission-remote_time(){ - _message "time in format HHMS" -} # complete argument specified after global only action: `--alt-speed-days` # completes days in a list such as "2,4-6". (( $+functions[_transmission-remote_days] )) || @@ -120,7 +114,7 @@ _transmission-remote_days(){ (( $+functions[_transmission-remote_add] )) || _transmission-remote_add(){ _alternative \ - 'args:torrent:_files -g ".torrent"' \ + 'args:torrent:_files -g ".torrent(-.)"' \ 'args:url:_urls' } # complete torrents diff --git a/Completion/Unix/Command/_truncate b/Completion/Unix/Command/_truncate new file mode 100644 index 000000000..117be9702 --- /dev/null +++ b/Completion/Unix/Command/_truncate @@ -0,0 +1,69 @@ +#compdef truncate + +local curcontext=$curcontext variant rs ret=1 +local -a state state_descr line specs optA +typeset -A opt_args + +_pick_variant -r variant gnu=GNU $OSTYPE --version +[[ $variant != gnu ]] && rs='-r -s' # -r/-s mutually exclusive + +# common specs +specs=( + '(hv -c --no-create)'{-c,--no-create}'[do not create any files]' + "(hv $rs -r --reference)"{-r+,--reference=}'[base size on the specified file]:reference file:_files' + "(hv $rs -s --size)"{-s+,--size=}'[set or adjust the file size by specified bytes]:size:->size' + '(hv)*: :_files' +) + +case $variant in + gnu) # GNU coreutils 8.32 + specs+=( + '(hv -o --io-blocks)'{-o,--io-blocks}'[treat the specified size as number of IO blocks instead of bytes]' + + 'hv' + '(- *)--help[display help and exit]' + '(- *)--version[output version information and exit]' + ) + ;; + *) # FreeBSD/DragonFly + specs=( ${specs:#(|*\))--*} ) # remove long options + optA=( -A '-*' ) + ;; +esac + +_arguments -C -s -S : $specs && ret=0 + +case $state in + size) + local unit=bytes + (( ${#opt_args[(I)(-o|--io-blocks)]} )) && unit=blocks + local -a suffix=( K:1024 M G T ) + local -a prefix=( '+:extend by' '-:reduce by' ) + local prefix_char='[-+]' + case $variant in + gnu|freebsd*) + prefix+=( '/:round down to multiple of' '%:round up to multiple of' ) + ;| + gnu) + suffix=( K:1024 KB:1000 {M,G,T,P,E,Z,Y}{,B} ) + prefix+=( '<:at most' '>:at least' ) + prefix_char='([-+/%]|\\[<>])' + ;; + freebsd*) + prefix_char='[-+/%]' + ;; + esac + local -a numbers=( _numbers -u $unit size $suffix ) + + if compset -P "$prefix_char"; then + $numbers && ret=0 + elif (( ${#opt_args[(I)(-r|--reference)]} )); then + # prefix is required if the reference file is given + _describe -t 'prefixes' 'prefix' prefix && ret=0 + else + _alternative "prefixes:prefix:((${(@q)prefix}))" \ + "sizes: :$numbers" && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_uname b/Completion/Unix/Command/_uname index 31af91eb7..c58f2edfd 100644 --- a/Completion/Unix/Command/_uname +++ b/Completion/Unix/Command/_uname @@ -62,12 +62,21 @@ else '-v[print detailed operating system version]' ) case $OSTYPE in - freebsd*|dragonfly*) args+=( '-i[print kernel ident]' ) ;| - freebsd<10->.*) + freebsd*|dragonfly*) args+=( - '-K[print FreeBSD kernel version]' - '-U[print FreeBSD user environment version]' + '-i[print kernel ident]' + '-K[print kernel version]' + '-U[print user environment version]' ) + ;| + dragonfly*) + args+=( + '-P[write ABI string for dports / pkgng, including odd-to-even version-munging]' + '-PP[write ABI string for dports / pkgng, without version-munging]' + ) + ;; + freebsd<13->.*) + args+=( "-b[print kernel's linker-generated build-id]" ) ;; solaris*) args+=( diff --git a/Completion/Unix/Command/_uniq b/Completion/Unix/Command/_uniq index 97f73b3ac..e123a94cd 100644 --- a/Completion/Unix/Command/_uniq +++ b/Completion/Unix/Command/_uniq @@ -23,8 +23,9 @@ args=( if ! _pick_variant gnu=Free\ Soft unix --version; then local optchars="cdufs" if [[ "$OSTYPE" == (darwin|dragonfly|freebsd|openbsd)* ]]; then - optchars="${optchars}i" + optchars+=i fi + [[ $OSTYPE = freebsd* ]] && optchars+=D args=( ${(M)args:#(|\*)(|\(*\))-[$optchars]*} ) fi diff --git a/Completion/Unix/Command/_unison b/Completion/Unix/Command/_unison index 2a3333742..91fa57e5b 100644 --- a/Completion/Unix/Command/_unison +++ b/Completion/Unix/Command/_unison @@ -6,7 +6,7 @@ typeset -A opt_args _arguments \ '-auto[automatically accept default (nonconflicting) actions]' \ '-batch[batch mode\: ask no questions at all]' \ - '-doc[show documentation]:topics:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \ + '-doc[show documentation]:topic:(about people lists status copying ack install tutorial basics failures running ssh news all topics)' \ '-follow[add a pattern to the follow list]:pattern:' \ '-force[force changes from this replica to the other]:replica:' \ '-group[synchronize group attributes]' \ @@ -84,9 +84,6 @@ _arguments \ '*:profile:->profile' if [[ $state == profile ]]; then - local -a profiles - - profiles=( ~/.unison/*.prf(N) ) - (( $#profiles )) && \ - compadd "$@" - ${${profiles#~/.unison/}%.prf} + local -a profiles=( ${UNISON:-~/.unison}/*.prf(N:t:r) ) + compadd "$@" -a profiles fi diff --git a/Completion/Unix/Command/_units b/Completion/Unix/Command/_units index bea77ae67..6d86f4dc3 100644 --- a/Completion/Unix/Command/_units +++ b/Completion/Unix/Command/_units @@ -40,10 +40,12 @@ local -a testfiles testfiles=( /usr/share/units.dat # GNU on Fedora /usr/share/units/units.dat # on gentoo - /usr/share/misc/units.dat # on Debian + /usr/share/units/definitions.units # on Debian, units 2.00 and newer /usr/local/share/units.dat # GNU DIY install /usr/share/lib/unittab # Solaris - /usr/share/misc/units.lib # BSD + /usr/share/misc/units.lib # OpenBSD [as of 2020]; also FreeBSD 9.1 + /usr/share/misc/definitions.units # FreeBSD 12.1 + /usr/share/misc/units.dat # on Debian, units 1.88 and older ) datfile=${opt_args[-f]:-${opt_args[--file]}} diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin index c7e1efc80..db1c977ad 100644 --- a/Completion/Unix/Command/_user_admin +++ b/Completion/Unix/Command/_user_admin @@ -54,7 +54,7 @@ case ${service%???}:${(M)service%???}:$OSTYPE in ;| user:*:(net|open)bsd*) args+=( - '-L[specify login class]:login class' + '-L[specify login class]:login class:_login_classes' '-p+[specify encrypted password]:encrypted password' ) ;| diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh deleted file mode 100644 index 00aed7d28..000000000 --- a/Completion/Unix/Command/_vcsh +++ /dev/null @@ -1,89 +0,0 @@ -#compdef vcsh - -function __vcsh_repositories () { - local -a repos - repos=( ${(f)"$(_call_program repositories vcsh list)"} ) - _describe -t repositories 'repository' repos -} - -function _vcsh-clone () { - _default #TODO -} - -local func -for func in help init list list-tracked pull push version; do - _vcsh-$func() { _nothing } -done -for func in delete enter list-tracked-by upgrade write-gitignore; do - _vcsh-$func() { (( CURRENT == 2 )) && __vcsh_repositories } -done - -function _vcsh-rename () { - case $CURRENT in - 2) __vcsh_repositories ;; - 3) _message "new repository name" ;; - *) _nothing ;; - esac -} - -function _vcsh-run () { - (( CURRENT == 2 )) && __vcsh_repositories - if (( CURRENT >= 3 )); then - words=( "${(@)words[3,-1]}" ) - (( CURRENT -= 2 )) - _complete - fi -} - -function _vcsh () { - local curcontext="${curcontext}" ret=1 - local state vcshcommand - local -a args subcommands - - subcommands=( - "clone:clone an existing repository" - "delete:delete an existing repository" - "enter:enter repository; spawn new <\$SHELL>" - "help:display help" - "init:initialize an empty repository" - "list:list all local vcsh repositories" - "list-tracked:list all files tracked by vcsh" - "list-tracked-by:list files tracked by a repository" - "pull:pull from all vcsh remotes" - "rename:rename a repository" - "run:run command with <\$GIT_DIR> and <\$GIT_WORK_TREE> set" - "upgrade:upgrade repository to currently recommended settings" - "version:print version information" - "which:find <substring> in name of any tracked file" - "write-gitignore:write .gitignore.d/<repo> via git ls-files" - ) - - args=( - '-c[source <file> prior to other configuration files]:config files:_path_files' - '-d[enable debug mode]' - '-v[enable verbose mode]' - '*:: :->subcommand_or_options_or_repo' - ) - - _arguments -C ${args} && ret=0 - - if [[ ${state} == "subcommand_or_options_or_repo" ]]; then - if (( CURRENT == 1 )); then - _describe -t subcommands 'vcsh sub-commands' subcommands && ret=0 - __vcsh_repositories && ret=0 - else - vcshcommand="${words[1]}" - if ! (( ${+functions[_vcsh-$vcshcommand]} )); then - # There is no handler function, so this is probably the name - # of a repository. Act accordingly. - _dispatch git git && ret=0 - else - curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:" - _call_function ret _vcsh-${vcshcommand} - fi - fi - fi - return ret -} - -_vcsh "$@" diff --git a/Completion/Unix/Command/_vi b/Completion/Unix/Command/_vi new file mode 100644 index 000000000..6201299a2 --- /dev/null +++ b/Completion/Unix/Command/_vi @@ -0,0 +1,47 @@ +#compdef ex vi view + +local -a args + +if _pick_variant vim='(N|)VIM' vi --version; then + _vim + return +fi + +args=( + '-c+[execute command on the first file loaded]:command:' + '-r[recover the named files]' + '-t+[start editing at the specified tag]:tag:' + '-w+[set window size to specified number of lines]:lines:' + '*: :_files' +) + +[[ $service != view ]] && args+=( + '-R[set readonly]' +) + +[[ $service == ex ]] && args+=( + '-s[enter batch mode]' + '-v[start in vi mode]' +) + +case $OSTYPE in + *bsd*|dragonfly*) + args+=( + "-F[don't copy the entire file on start]" + '-S[set the secure option]' + ) + [[ $service != ex ]] && args+=( + '-e[start in ex mode]' + ) + ;| + netbsd*) + args+=( + '-G[start in gtags mode]' + ) + [[ $service == vi ]] && args+=( + '-l[set the lisp and showmatch options]' + ) + ;; +esac + +_arguments -s -S -A '-*' : $args diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim index d9dc1a5b3..5c6054e70 100644 --- a/Completion/Unix/Command/_vim +++ b/Completion/Unix/Command/_vim @@ -27,9 +27,8 @@ arguments=( '-D[debugging mode]' '-n[no swap file (memory only)]' {-r,-L}'[list swap files and exit or recover from a swap file]::swap file:_vim_files -g "*.sw?(-.)"' - '( -H -F)-A[start in Arabic mode]' - '(-A -F)-H[start in Hebrew mode]' - '(-A -H )-F[start in Farsi mode]' + '(-H)-A[start in Arabic mode]' + '(-A)-H[start in Hebrew mode]' '-u[use given vimrc file instead of default .vimrc]:config:->config' "--noplugin[don't load plugin scripts]" '-o-[number of windows to open (default: one for each file)]::window count: ' @@ -99,8 +98,11 @@ fi [[ $service != *view ]] && arguments+='-R[readonly mode]' [[ $service = *g* ]] || (( ${words[(I)-g]} )) && arguments+=( '(--nofork -f)'{--nofork,-f}'[do not detach the GUI version from the shell]' + '(-background -bg)'{-background,-bg}'[use specified color for the background]:color:_x_color' + '(-foreground -fg)'{-foreground,-fg}'[use specified color for normal text]:color:_x_color' '-font:font:_xft_fonts' '-geometry:geometry:_x_geometry' + '-iconic[start vim iconified]' '(-rv -reverse)'{-rv,-reverse}'[use reverse video]' '-display:display:_x_display' '--role[set unique role to identify main window]:role' diff --git a/Completion/Unix/Command/_vmstat b/Completion/Unix/Command/_vmstat index f3ac1af14..e05bc88bc 100644 --- a/Completion/Unix/Command/_vmstat +++ b/Completion/Unix/Command/_vmstat @@ -8,6 +8,7 @@ case $OSTYPE in '(-t --timestamp)'{-t,--timestamp}'[show timestamp]' '(-n --one-header)'{-n,--one-header}'[do not redisplay header]' '(-S --unit)'{-S+,--unit=}'[specify unit for displayed sizes]:unit prefix [K]:((k\:1000 K\:1024 m\:1000000 M\:1048576))' + '(-C --full-cache)'{-C,--full-cache}'[add further cache lines to main cache]' '1: :_guard "[0-9]#" "interval (seconds)"' '2:count' + '(action)' \ '(- :)'{-h,--help}'[display help information]' diff --git a/Completion/Unix/Command/_w b/Completion/Unix/Command/_w index 8fb4154c7..69751c5e5 100644 --- a/Completion/Unix/Command/_w +++ b/Completion/Unix/Command/_w @@ -11,6 +11,7 @@ case $OSTYPE in '(H -o --old-style -s --short)'{-o,--old-style}'[old style output format]' '(H -s --short -o --old-style)'{-s,--short}'[use short output format]' '(H -u --no-current)'{-u,--no-current}'[ignore the username while figuring out the current process and cpu times]' + '(H -n --no-truncat)'{-n,--no-truncat}'[non-truncated listing (large)]' + H '(-)--help[display help information]' '(-)'{-V,--version}'[display version information]' diff --git a/Completion/Unix/Command/_w3m b/Completion/Unix/Command/_w3m index 6e83a6781..de425cfb1 100644 --- a/Completion/Unix/Command/_w3m +++ b/Completion/Unix/Command/_w3m @@ -1,14 +1,12 @@ #compdef w3m -# w3m version w3m/0.5.1 - local curcontext="$curcontext" state line expl ret=1 typeset -A opt_args _arguments -C \ '-t[set tab width]:tab width:' \ '-r[ignore backspace effect]' \ - '-l[specify number of preserved lines]:number of lines (default 10000):' \ + '-l[specify number of preserved lines]:number of lines [10000]' \ '-I[document charset]:charset:->charset' \ '-O[display/output charset]:charset:->charset' \ '( -s -j)-e[EUC-JP]' \ @@ -21,7 +19,7 @@ _arguments -C \ '(-B *)-v[visual startup mode]' \ '-M[monochrome display]' \ '-N[open URL of command line on each new tab]' \ - '-F[automatically render frame]' \ + '-F[automatically render frames]' \ '-cols[specify column width (used with -dump)]:column width' \ '-ppc[specify the number of pixels per character (4.0...32.0)]:number of pixels (4.0...32.0):' \ '-ppl[specify the number of pixels per line (4.0...64.0)]:number of pixels (4.0...64.0):' \ @@ -34,17 +32,17 @@ _arguments -C \ '-header[insert string as a header]:header:' \ '+-[goto specified line]:line number:_guard "[0-9]#" "line number"' \ '-num[show line number]' \ + '-session[use specified session]:id' \ "-no-proxy[don't use proxy]" \ '(-6)-4[IPv4 only (-o dns_order=4)]' \ '(-4)-6[IPv6 only (-o dns_order=6)]' \ "-no-mouse[don't use mouse]" \ '(-no-cookie)-cookie[use cookie]' \ "(-cookie)-no-cookie[don't use cookie]" \ - '-pauth[proxy authentication]:user\:pass:->pauth' \ - '(-no-graph)-graph[use graphic character]' \ - "(-graph)-no-graph[don't use graphic character]" \ + '(-no-graph)-graph[use DEC special graphics for border of table and menu]' \ + '(-graph)-no-graph[use ASCII character for border of table and menu]' \ '-S[squeeze multiple blank lines]' \ - '-W[toggle wrap search mode]' \ + '-W[toggle search wrap mode]' \ "-X[don't use termcap init/deinit]" \ '-title=[set buffer name to terminal title string]:terminal:_terminals' \ '*-o[assign value to config option]:option=value:->option' \ @@ -84,7 +82,7 @@ case "$state" in _alternative \ 'files:file:_files -g "*.x#html(-.)"' \ 'urls:URL:_urls' \ - 'bookmarks:bookmarks:compadd -a bookmarks' \ + 'bookmarks:bookmark:compadd -a bookmarks' \ 'history:history:compadd -a w3mhistory' && ret=0 ;; option) @@ -97,14 +95,6 @@ case "$state" in _describe -t options 'option' options "$suf[@]" && ret=0 fi ;; - pauth) - if compset -P 1 '*:'; then - _message -e passwords 'password' - else - compset -S ':*' || suf=( -S ':' ) - _users "$suf[@]" && ret=0 - fi - ;; esac return ret diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index 49c8e8b01..50fd7791a 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -34,6 +34,8 @@ _arguments -C -s \ '(--server-response -S)'{--server-response,-S}'[print server response]' \ "--spider[don't download anything]" \ '(--timeout -T)'{--timeout=,-T+}'[set all timeout values]:timeout (seconds)' \ + '--dns-servers=[specify DNS servers to query]:DNS server:_sequence _hosts' \ + '--bind-dns-address=[bind DNS resolver to specified address]:hostname or IP on local host' \ '(--timeout -T)--dns-timeout=[set the DNS lookup timeout]:DNS lookup timeout (seconds)' \ '(--timeout -T)--connect-timeout=[set the connect timeout]:connect timeout (seconds)' \ '(--timeout -T)--read-timeout=[set the read timeout]:read timeout (seconds)' \ @@ -107,7 +109,7 @@ _arguments -C -s \ "--ca-directory=[specify dir where hash list of CA's are stored]:directory:_directories" \ '--crl-file=[specify file with bundle of CRLs]:file:_files' \ '--pinnedpubkey=:file:_files' \ - '!--random-file=:file:_files' \ + '--random-file[specify file with random data for seeding generator]:file:_files' \ '--egd-file=[specify filename of EGD socket]:file:_files' \ '--ciphers=[set the priority string (GnuTLS) or cipher list string (OpenSSL) directly]:string' \ '--no-hsts[disable HSTS]' \ @@ -137,7 +139,7 @@ _arguments -C -s \ '(--reject -R)'{--reject=,-R+}'[specify rejected extensions]:extensions' \ --{accept,reject}-regex=:regex '--regex-type=:regex type:(posix pcre)' \ '(--domains -D)'{--domains=,-D+}'[specify accepted domains]:domains:_domains' \ - '--exclude-domains=:rejected domains:_domains' \ + '--exclude-domains=:rejected domain:_sequence _domains' \ '--follow-ftp' \ '--follow-tags=:HTML tags:' \ '--ignore-tags=[specify ignored HTML tags]:HTML tags' \ diff --git a/Completion/Unix/Command/_wiggle b/Completion/Unix/Command/_wiggle index 0a2f0c0cb..1d747a479 100644 --- a/Completion/Unix/Command/_wiggle +++ b/Completion/Unix/Command/_wiggle @@ -1,15 +1,17 @@ #compdef wiggle -local fns='-m --merge -d --diff -x --extract' +local fns='-m --merge -d --diff -x --extract -B --browse' _arguments \ "($fns -1 -2 -3)"{-m,--merge}'[select the merge function]' \ "($fns -3 3)"{-d,--diff}'[display differences between files]' \ "($fns 2 3)"{-x,--extract}'[extract one branch of a patch or merge file]' \ '(-w --words -l --lines)'{-w,--words}'[make operations and display word based]' \ - '(-l --lines -w --words)'{-l,--lines}'[make operations and display line based]' \ + '(-l --lines -w --words --non-space)'{-l,--lines}'[make operations and display line based]' \ + '(-l --lines)--non-space[words are separated by spaces]' \ '(-p --patch)'{-p,--patch}'[treat last named file as a patch]' \ '(-r --replace)'{-r,--replace}'[replace original file with merged output]' \ + '--no-backup[never save original file (as name.porig)]' \ '(-R --reverse -x --extract)'{-R,--reverse}'[swap the files or revert changes]' \ '(-2 -3 -m --merge)-1[select branch]' \ '(-1 -3 -m --merge)-2[select branch]' \ diff --git a/Completion/Unix/Command/_xargs b/Completion/Unix/Command/_xargs index f21784ef1..8e23a04bb 100644 --- a/Completion/Unix/Command/_xargs +++ b/Completion/Unix/Command/_xargs @@ -25,7 +25,7 @@ case $variant in '-R[specify maximum arguments that -I will replace in]:replacements' ) ;| - freebsd*|netbsd*) + freebsd*|netbsd*|dragonfly*) args+=( '-S[space that -I can use for replacements]:size (bytes) [255]' ) diff --git a/Completion/Unix/Command/_xmlsoft b/Completion/Unix/Command/_xmlsoft index 487974fdb..08b123e54 100644 --- a/Completion/Unix/Command/_xmlsoft +++ b/Completion/Unix/Command/_xmlsoft @@ -45,7 +45,7 @@ case $service in '--encoding[the input document character encoding]:encoding:(${encoding[@]})' \ '*--param[pass a parameter,value pair]:name::value (xpath expression)' \ '*--stringparam[pass a parameter]:name::value' \ - '--path[provide a set of paths for resources]:paths:_files -/' \ + '--path[provide a set of paths for resources]:path:_dir_list' \ '--nonet[refuse to fetch DTDs or entities over network]' \ '--nowrite[refuse to write to any file or resource]' \ '--nomkdir[refuse to create directories]' \ @@ -70,7 +70,7 @@ case $service in '--noent[substitute entity references by their value]' \ '--noenc[ignore any encoding specified inside the document]' \ "(--output -o)--noout[don't output the result tree]" \ - '--path[provide a set of paths for resources]:paths:_files -/' \ + '--path[provide a set of paths for resources]:path:_dir_list' \ '--load-trace[print trace of all external entities loaded]' \ '--nonet[refuse to fetch DTDs or entities over network]' \ '--nocompact[do not generate compact text nodes]' \ @@ -80,6 +80,7 @@ case $service in '(--dtdvalid --relaxng --schema)--postvalid[do a posteriori validation, i.e after parsing]' \ '(--postvalid --relaxng --schema --dtdvalidfpi)--dtdvalid[do a posteriori validation against a given DTD]:DTD:_webbrowser' \ '(--postvalid --relaxng --schema --dtdvalid)--dtdvalidfpi[as --dtdvalid but specify DTD with public identifier]:DTD identifier' \ + '--quiet[be quiet when successful]' \ '--timing[print some timings]' \ '(--noout --output -o)'{--output,-o}'[save to a given file]:output file:_files' \ '--repeat[repeat 100 times, for timing or profiling]' \ @@ -98,7 +99,7 @@ case $service in '--format[reformat/reindent the input]' \ '--encode[output in the given encoding]:encoding:(${encoding[@]})' \ '--dropdtd[remove the DOCTYPE of the input docs]' \ - "--pretty[pretty-print in a particular style]:style:((0\:don't\ pretty\ print 1\:reformat 2\:add\ whitespace))" \ + "--pretty[pretty-print in a particular style]:style:((0\:don\'t\ pretty\ print 1\:reformat 2\:add\ whitespace))" \ '--c14n[save in W3C canonical format]' \ '--c14n11[save in W3C canonical format v1.1 (with comments)]' \ '--exc-c14n[save in W3C exclusive canonical format]' \ diff --git a/Completion/Unix/Command/_xmms2 b/Completion/Unix/Command/_xmms2 index 525d5177c..ca2383b2f 100644 --- a/Completion/Unix/Command/_xmms2 +++ b/Completion/Unix/Command/_xmms2 @@ -43,7 +43,7 @@ _xmms2_command() { ) if (( CURRENT == 1 )); then - _describe -t command "xmms2 commands" xmms2_cmds + _describe -t command "xmms2 command" xmms2_cmds else local curcontext="$curcontext" fi @@ -63,7 +63,7 @@ _xmms2_command() { fi done - _values -s ' ' 'playlist items' ${(On)playlistitems} + _values -s ' ' 'playlist item' ${(On)playlistitems} } @@ -84,7 +84,7 @@ _xmms2_mlib() { ) if (( CURRENT == 2 )); then - _describe -t command "xmms2 mlib commands" mlib_cmds + _describe -t command "xmms2 mlib command" mlib_cmds else local curcontext="$curcontext" fi @@ -107,7 +107,7 @@ _xmms2_playlist() { remove:"Remove a playlist" ) if (( CURRENT == 2 )); then - _describe -t command "xmms2 playlist commands" playlist_cmds + _describe -t command "xmms2 playlist command" playlist_cmds else local curcontext="$curcontext" fi @@ -121,14 +121,14 @@ _xmms2_playlist() { _xmms2_playlist_load() { local list list=($(xmms2 playlist list)) - _describe -t command "xmms2 playlists" list + _describe -t command "xmms2 playlist" list } _xmms2_playlist_remove() { local list list=($(xmms2 playlist list)) - _describe -t command "xmms2 playlists" list + _describe -t command "xmms2 playlist" list } @@ -146,7 +146,7 @@ _xmms2_coll() { attr:"Get/set an attribute for a saved collection" ) if (( CURRENT == 2 )); then - _describe -t command "xmms2 collection commands" coll_cmds + _describe -t command "xmms2 collection command" coll_cmds else local curcontext="$curcontext" fi @@ -160,7 +160,7 @@ _xmms2_coll() { _xmms2_coll_helper() { local list list=($(xmms2 coll list)) - _describe -t command "xmms2 playlists" list + _describe -t command "xmms2 playlist" list } _xmms2_coll_rename() { diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd index 3a8efd664..31d26ab64 100644 --- a/Completion/Unix/Command/_xxd +++ b/Completion/Unix/Command/_xxd @@ -39,6 +39,7 @@ arguments=( {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"' {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"' {-o+,-offset}'[add specified offset to displayed file position]:offset' + '-d[show offset in decimal instead of hex]' {-s,-skip,-seek}'[specify file offset to dump from]: :_guard "[0-9]#" "file offset to dump from (absolute or relative)"' ': :_files' diff --git a/Completion/Unix/Command/_yafc b/Completion/Unix/Command/_yafc index 1e0a601a1..946c0b4ce 100644 --- a/Completion/Unix/Command/_yafc +++ b/Completion/Unix/Command/_yafc @@ -32,7 +32,7 @@ _yafc_bookmarks() { if [[ -f $bkmfile ]]; then local -a bkms expl bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy - _wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms + _wanted bookmarks expl 'bookmark' compadd "$@" -a - bkms fi } diff --git a/Completion/Unix/Command/_zfs b/Completion/Unix/Command/_zfs index 814358bc7..be4a64b33 100644 --- a/Completion/Unix/Command/_zfs +++ b/Completion/Unix/Command/_zfs @@ -1,553 +1,1350 @@ -#compdef zfs -# Synced with the S11U1 man page - -_zfs() { - local context state line expl implementation - typeset -A opt_args - local -a subcmds rw_properties rw_propnames ro_properties create_properties - local -a share_nfs_ro_properties share_nfs_rw_properties - local -a share_smb_ro_properties share_smb_rw_properties - local -a share_ro_properties share_rw_properties - local -a difffields delegatable_perms - - _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris - - subcmds=( - "create" "destroy" "clone" "promote" "rename" "snapshot" - "rollback" "list" "set" "get" "inherit" "mount" "unmount" - "share" "unshare" "send" "receive" "allow" "unallow" - "upgrade" "userspace" "groupspace" "hold" "holds" "release" - "diff" "key" "help" - ) - - [[ $OSTYPE == freebsd<7->.* ]] && subcmds+=(jail unjail) - - share_nfs_ro_properties=( - "share.nfs.all" - ) - - share_nfs_rw_properties=( - "share.nfs:value:(on off)" - "share.nfs.aclok:value:(on off)" - "share.nfs.acflfab:value:(on off)" - "share.nfs.anon:uid:" - "share.nfs.charset.euc-cn:access-list:" - "share.nfs.charset.euc-jpms:access-list:" - "share.nfs.charset.euc-kr:access-list:" - "share.nfs.charset.euc-tw:access-list:" - "share.nfs.charset.iso8859-1:access-list:" - "share.nfs.charset.iso8859-2:access-list:" - "share.nfs.charset.iso8859-5:access-list:" - "share.nfs.charset.iso8859-6:access-list:" - "share.nfs.charset.iso8859-7:access-list:" - "share.nfs.charset.iso8859-8:access-list:" - "share.nfs.charset.iso8859-9:access-list:" - "share.nfs.charset.iso8859-13:access-list:" - "share.nfs.charset.iso8859-15:access-list:" - "share.nfs.charset.koi8-r:access-list:" - "share.nfs.index:file:_files" - "share.nfs.log:nfslog.conf tag:" - "share.nfs.nosub:value:(on off)" - "share.nfs.nosuid:value:(on off)" - "share.nfs.public:value:(on off)" - "share.nfs.sec:security-mode-list:" - "share.nfs.sec.default.none:access-list:" - "share.nfs.sec.default.ro:access-list:" - "share.nfs.sec.default.root:access-list:" - "share.nfs.sec.default.root_mapping:uid:" - "share.nfs.sec.default.rw:access-list:" - "share.nfs.sec.default.window:seconds" - "share.nfs.sec.dh.none:access-list:" - "share.nfs.sec.dh.ro:access-list:" - "share.nfs.sec.dh.root:access-list:" - "share.nfs.sec.dh.root_mapping:uid:" - "share.nfs.sec.dh.rw:access-list:" - "share.nfs.sec.dh.window:seconds" - "share.nfs.sec.krb5.none:access-list:" - "share.nfs.sec.krb5.ro:access-list:" - "share.nfs.sec.krb5.root:access-list:" - "share.nfs.sec.krb5.root_mapping:uid:" - "share.nfs.sec.krb5.rw:access-list:" - "share.nfs.sec.krb5.window:seconds" - "share.nfs.sec.krb5i.none:access-list:" - "share.nfs.sec.krb5i.ro:access-list:" - "share.nfs.sec.krb5i.root:access-list:" - "share.nfs.sec.krb5i.root_mapping:uid:" - "share.nfs.sec.krb5i.rw:access-list:" - "share.nfs.sec.krb5i.window:seconds" - "share.nfs.sec.krb5p.none:access-list:" - "share.nfs.sec.krb5p.ro:access-list:" - "share.nfs.sec.krb5p.root:access-list:" - "share.nfs.sec.krb5p.root_mapping:uid:" - "share.nfs.sec.krb5p.rw:access-list:" - "share.nfs.sec.krb5p.window:seconds" - "share.nfs.sec.none.none:access-list:" - "share.nfs.sec.none.ro:access-list:" - "share.nfs.sec.none.root:access-list:" - "share.nfs.sec.none.root_mapping:uid:" - "share.nfs.sec.none.rw:access-list:" - "share.nfs.sec.none.window:seconds" - "share.nfs.sec.sys.none:access-list:" - "share.nfs.sec.sys.ro:access-list:" - "share.nfs.sec.sys.root:access-list:" - "share.nfs.sec.sys.root_mapping:uid:" - "share.nfs.sec.sys.rw:access-list:" - "share.nfs.sec.sys.window:seconds" - ) - - share_smb_ro_properties=( - "share.smb.all" - ) - - share_smb_rw_properties=( - "share.smb:value:(on off)" - "share.smb.ad-container" - "share.smb.abe" - "share.smb.csc:value:(disabled manual auto vdo)" - "share.smb.catia:value:(on off)" - "share.smb.dfsroot:value:(on off)" - "share.smb.guestok:value:(on off)" - "share.smb.ro:access-list:" - "share.smb.rw:access-list:" - "share.smb.none:access-list:" - ) - - share_ro_properties=( - "share.all" - "share.fs" - "share.name" - "share.point" - "share.protocols" - "share.state" - $share_nfs_ro_properties - $share_smb_ro_properties - ) - - share_rw_properties=( - "share.desc:description:" - "share.noauto:value:(on off)" - "share.path:path:" - $share_nfs_rw_properties - $share_smb_rw_properties - ) - - # TODO: userused@ and groupused@ could have more extensive handling - ro_properties=( - "name" "type" "creation" "used" "available" "referenced" - "compressratio" "mounted" "origin" "usedbychildren" - "usedbydataset" "usedbyrefreservation" "usedbysnapshots" - "defer_destroy" "userused@" "userrefs" "groupused@" - "keychangedate" "keystatus" "rekeydate" - $share_ro_properties - ) - - # TODO: Be cleverer about what values can be set. Is there any way to - # set the sorting for *size properties to false by default? - rw_properties=( - "aclinherit:value:(discard noallow restricted passthrough passthrough-x)" - "atime:value:(on off)" - "canmount:value:(on off noauto)" - "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)" - "compression:value:(on off lzjb lz4 gzip gzip-{1..9} zle)" - "copies:value:(1 2 3)" - "dedup:value:(on off verify sha256 sha256,verify)" - "devices:value:(on off)" - "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)" - "exec:value:(on off)" - "groupquota@:value:" # TODO: complete group=size|none - "keysource:value:_zfs_keysource_props" - "logbias:value:(latency throughput)" - "mlslabel:value:(none)" # TODO: list sensitivity labels - "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}" - "multilevel:value:(on off)" - "nbmand:value:(on off)" - "primarycache:value:(all none metadata)" - "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}" - "readonly:value:(on off)" - "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)" - "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}" - "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}" - "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}" - "rstchown:value:(on off)" - "secondarycache:value:(all none metadata)" - "setuid:value:(on off)" - "shadow:value:" # TODO: complete URI|none - "share:share properties:" - "snapdir:value:(hidden visible)" - "sync:value:(standard always disabled)" - "userquota@:value:" # TODO: complete user=size|none - "version:value:(1 2 3 4 current)" - "volsize:value:" # <size> - "vscan:value:(on off)" - "xattr:value:(on off)" - "zoned:value:(on off)" - $share_rw_properties - ) - - if [[ "$OSTYPE" == "linux-gnu" ]]; then - rw_properties+=("acltype:value:(off noacl posixacl)") - elif [[ "$implementation" == "solaris" ]]; then - rw_properties+=("aclmode:value:(discard mask passthrough)") - else - rw_properties+=("aclmode:value:(discard groupmask passthrough restricted)") - fi - - - create_properties=( - $rw_properties - "casesensitivity:value:(sensitive insensitive mixed)" - "normalization:value:(none formC formD formKC formKD)" - "utf8only:value:(on off)" - "volblocksize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)" - ) - - delegatable_perms=( - "allow" "clone" "create" "destroy" "diff" "hold" "key" - "keychange" "mount" "promote" "receive" "release" "rename" - "rollback" "send" "share" "snapshot" - "groupused" "userused" "userprop" - ${create_properties%%:*} - ) - - rw_propnames=( ${rw_properties%%:*} ) - - difffields=( - object parent size links linkschange name oldname user group - ctime mtime atime crtime - ) - - if [[ $service == "zfs" ]]; then - _arguments -C -A "-*" \ - '-\?[Help]' \ - '*::command:->subcmd' && return 0 - - if (( CURRENT == 1 )); then - _wanted commands expl "zfs subcommand" compadd -a subcmds - return - fi - service="$words[1]" - curcontext="${curcontext%:*}=$service:" - fi - - case $service in - ("create") - _arguments -A "-*" \ - '-p[Create parent datasets]' \ - '*-o[Set initial properties]:property:_values -s , "property" $create_properties' \ - - set1 \ - ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \ - - set2 \ - '-s[Create sparse volume]' \ - '-b[Set volblocksize]:blocksize:' \ - '-V[Set size]:size:' \ - ':volume:_zfs_dataset -t fs -e "parent dataset"' - ;; - - ("destroy") - _arguments -A "-*" \ - '-r[Recursively destroy all children]' \ - '-R[Recursively destroy all dependents]' \ - - set1 \ - '-d[delete or mark deferred]' \ - ':snapshot:_zfs_dataset -t snap' \ - - set2 \ - '-f[Force unmounts]' \ - ':filesystem/volume/snapshot:_zfs_dataset -t fs -t vol' - ;; - - (snap(|shot)) - _arguments -A "-*" \ - '-r[Recursively snapshot all descendant datasets]' \ - '*-o[Set property]:property:_values -s , "property" $create_properties' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol -S@' - ;; - - ("rollback") - _arguments -A "-*" \ - '-r[Recursively destroy more recent snapshots]' \ - '-R[Recursively destroy more recent snapshots and clones]' \ - '-f[Force unmounts]' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("clone") - # XXX needs to bail if there are no snapshots - _arguments -A "-*" \ - '-p[Create parent datasets]' \ - '-K[Create encryption key]' \ - '*-o[Set property]:property:_values -s , "property" $create_properties' \ - ':snapshot:_zfs_dataset -t snap' \ - ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"' - ;; - - ("promote") - _arguments \ - ':filesystem:_zfs_dataset -t clone' \ - ;; - - ("rename") - _arguments -A "-*" \ - '(-r)-p[Create parent datasets]' \ - '(-p)-r[Recursively rename snapshots of all descendent datasets]' \ - ':dataset:_zfs_dataset -r1' \ - ':dataset:_zfs_dataset -r2' - ;; - - ("list") - _arguments -A "-*" \ - '-r[Recursively display children]' \ - '-H[Scripting mode]' \ - '-d[Depth]:value:' \ - '-o[Properties to list]:property:_values -s , "property" $ro_properties $rw_propnames' \ - '*-s[Sort key (ascending)]:property:_values "property" $ro_properties $rw_propnames' \ - '*-S[Sort key (descending)]:property:_values "property" $ro_properties $rw_propnames' \ - '-t[Dataset types to list]:dataset type:_values -s , "dataset type" all filesystem snapshot volume' \ - '*:filesystem/volume/snapshot/path:_zfs_dataset -p' - ;; - - ("set") - _arguments \ - '-r[Recursively apply value]' \ - ':property:_values -s , "property" $rw_properties' \ - '*:filesystem/volume:_zfs_dataset -t fs -t vol' - ;; - - ("get") - _arguments -A "-*" \ - "-r[Recursively display children's properties]" \ - '-d[Depth]:value:' \ - '-H[Scripting mode]' \ - '-p[Display numbers exactly]' \ - '-s[Specify sources]:source:_values -s , "source" local default inherited temporary none' \ - '-o[Specify fields]:field:_values -s , "field" name property value source' \ - ':property:_values -s , "property" $ro_properties $rw_propnames all' \ - '*:filesystem/volume/snapshot:_zfs_dataset' - ;; - - ("inherit") - _arguments -A "-*" \ - '-r[Recursively inherit property for all children]' \ - '-S[Revert to received property value]' \ - ':property:_values -s , "property" $ro_properties $rw_properties' \ - '*:filesystem/volume:_zfs_dataset -t fs -t vol' - ;; - - ("userspace"|"groupspace") - _arguments -A "-*" \ - '-n[Print numeric ID]' \ - '-i[Translate SID to POSIX ID]' \ - '-H[Tab-delimited output with no headers]' \ - '-p[Parseable mode]' \ - '-o[Properties to list]:property:_values -s , "property" type name used quota' \ - '*-s[Sort key (ascending)]:property:_values "property" type name used quota' \ - '*-S[Sort key (descending)]:property:_values "property" type name used quota' \ - '-t[Types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \ - '*:filesystem/volume/snapshot:_zfs_dataset' - ;; - - ("mount") - _arguments -A "-*" \ - '-o[Mount options]:mount options:_values -s , "option" {,no}{devices,exec,setuid} ro rw' \ - '-O[Overlay mount]' \ - '-v[Report mount progress]' \ - - set1 \ - ':filesystem:_zfs_dataset -t fs' \ - - set2 \ - '-a[Mount all available ZFS filesystems]' - ;; - - ("unmount") - _arguments -A "-*" \ - - set1 \ - '-f[Force unmount]' \ - ':filesystem:_zfs_dataset -t fs -t mtpt' \ - - set2 \ - '-a[Unmount all ZFS filesystems]' - ;; - - ("share") - _arguments -A "-*" \ - - set1 \ - '-a[Share all available ZFS filesystems]' \ - - set2 \ - '-r[Share filesystems recursively]' \ - ':filesystem:_zfs_dataset -t fs' \ - - set3 \ - '*-o[Create a share with these properties]:property:_values -w "share properties" $share_rw_properties' \ - '-u[Create a share without sharing it]' \ - ':filesystem:_zfs_dataset -t fs' \ - - set4 \ - ':filesystem:_zfs_dataset -t fs -t mtpt -t share' - ;; - - ("unshare") - _arguments -A "-*" \ - - set1 \ - '-a[Unshare all shared ZFS filesystems]' \ - - set2 \ - '-r[Unshare filesystems recursively]' \ - ':filesystem:_zfs_dataset -t fs' \ - - set3 \ - ':filesystem:_zfs_dataset -t fs -t mtpt -t share' - ;; - - ("send") - _arguments -A "-*" \ - '-b' \ - '-i[Generate an incremental stream]:snapshot:_zfs_dataset -t snap' \ - '-D[Perform dedup processing]' \ - '-p[Send properties]' \ - '-v[Verbose]' \ - - set1 \ - '-I[Generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \ - '-R[Generate a replication stream package]' \ - ':snapshot:_zfs_dataset -t snap' \ - - set2 \ - '-c[Create a self-contained stream]' \ - '-r[Generate a recursive stream package]' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("receive") - _arguments -A "-*" \ - '-v[Verbose]' \ - '-n[Do not receive the stream]' \ - '-F[Force a rollback if necessary]' \ - '-u[Filesystem is not mounted]' \ - '-o[Include property change in the stream]::' \ - '-x[Exclude property change from the stream]:property:' \ - - set1 \ - ':filesystem/volume/snapshot:_zfs_dataset' \ - - set2 \ - '(-e)-d[Set path prefix from stream, excluding only pool name]' \ - '(-d)-e[Set path prefix from stream, using last path element]' \ - '-:filesystem:_zfs_dataset -t fs' - ;; - - ("allow") - _arguments -A "-*" \ - '(1 -g -e -c -s)-u[delegate to user]:user:_users' \ - '(1 -u -e -c -s)-g[delegate to group]:group:_groups' \ - '(1 -g -u -c -s)-e[delegate to everyone]' \ - '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \ - '(1 -u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \ - '(1 -c -s)-l[allow for named dataset]' \ - '(1 -c -s)-d[allow for descendent datasets]' \ - '1::filesystem/volume:_zfs_dataset -t fs -t vol' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - ;; - - ("unallow") - _arguments -A "-*" \ - '-r[Recursive removal]' \ - - set1 \ - '-s[Remove permissions from or delete a permission set]:permission set:' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set2 \ - '(-g)-u[User]:user:_users' \ - '(-u)-g[Group]:group:_groups' \ - '-l[Allow for named dataset]' \ - '-d[Allow for descendent datasets]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set3 \ - '-e[Everyone]' \ - '-l[Allow for named dataset]' \ - '-d[Allow for descendent datasets]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' \ - - set4 \ - '-c[Create-time permissions]' \ - ':permissions or sets:_values -s , "permission or set" $delegatable_perms' \ - ':filesystem/volume:_zfs_dataset -t fs -t vol' - ;; - - ("upgrade") - _arguments -A "-*" \ - - set1 \ - '-v[Verbose]' \ - - set2 \ - '-a[Upgrade all filesystems on all pools]' \ - '-r[Upgrade descendent filesystems, too]' \ - '-V[Upgrade to specified version]:version:(1 2)' \ - - set3 \ - '-r[Upgrade descendent filesystems, too]' \ - '-V[Upgrade to specified version]:version:(1 2)' \ - ':filesystem:_zfs_dataset -t fs' - ;; - - ("hold") - _arguments -A "-*" \ - '-r[Apply hold recursively]' \ - ':tag:' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("holds") - _arguments -A "-*" \ - '-r[List holds recursively]' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("release") - _arguments -A "-*" \ - '-r[Release holds recursively]' \ - ':tag:' \ - ':snapshot:_zfs_dataset -t snap' - ;; - - ("diff") - _arguments -A "-*" \ - '-F[Add column for filetype character]' \ - '-H[Parseable output]' \ - '-e[Only show new and changed files]' \ - '*-o[Show fields]:field:_values "field" $difffields' \ - '-t[Add column for ctime]' \ - - set1 \ - ':snapshot:_zfs_dataset -t snap' \ - ':snapshot or filesystem:_zfs_dataset -t snap -t fs' \ - - set2 \ - '-E[Show difference from empty]' \ - ':snapshot or filesystem:_zfs_dataset -t snap -t fs' - ;; - - ("key") - _arguments -A "-*" \ - - set1 \ - '-a[Apply to all datasets in all pools]' \ - '(-u -K -f)-l[Load the encryption key]' \ - '(-l -K)-u[Unload the encryption key]' \ - '(-l -u -f)-K[Create a new data encryption key]' \ - '(-l -K)-f[Unmount the dataset before unloading the encryption key]' \ - '-r[Apply recursively]' \ - ':filesystem or volume:_zfs_dataset -t fs -t vol' \ - - set2 \ - '-c[Change the encryption key]' \ - '-o[Change a property]:property:_zfs_keysource_props' \ - ':filesystem or volume:_zfs_dataset -t fs -t vol' - ;; - - ("jail"|"unjail") - _arguments \ - '1: : _jails' \ - '2:filesystem:_zfs_dataset -t fs' - ;; - - ("help") - _arguments -A "-*" \ - - set1 \ - ':command:($subcmds $delegatable_perms $ro_properties ${rw_properties%%:*} properties)' \ - - set2 \ - '-l[Display property information]' \ - ': :(properties)' - ;; - - (*) - _message "unknown zfs subcommand: $service" - ;; - esac -} - -_zfs "$@" +#compdef zfs zdb zpool + +local curcontext="$curcontext" implementation nm="$compstate[nmatches]" +local -a state curstate line state_descr expl alts args +typeset -A opt_args val_args +local MATCH MBEGIN MEND +local -a subcmds +local -a share_nfs_ro_properties share_nfs_rw_properties +local -a share_smb_ro_properties share_smb_rw_properties +local -a share_ro_properties share_rw_properties +local -a difffields delegatable_perms key_properties +local -a ds_types sum_algorithms comp_algorithms dedup_algorithms + +local -a ds_propnames ro_ds_props rw_ds_props ci_ds_props # dataset properties +local -a po_propnames ro_po_props rw_po_props ci_po_props # pool properties + +_pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris + +ds_types=( filesystem snapshot volume all ) +sum_algorithms=( on off fletcher2 fletcher4 sha256 ) +comp_algorithms=( on off lzjb lz4 gzip gzip-{1..9} zle ) +dedup_algorithms=( on off verify sha256 sha256,verify ) + +ro_po_props=( # readonly + 'all[all properties]' + 'allocated[space allocated]' + 'capacity[space used (percentage)]' + 'dedupratio[deduplication ratio]' + 'free[space unallocated]' + 'health[health status]' + 'size[total size]' +) +ci_po_props=( # only set at create or import + 'altroot[alternate root directory]:path:_directories' + 'guid[unique identifier]:identifier' + 'readonly[whether the pool can be modified]:value:(on off)' +) +rw_po_props=( + 'autoexpand[automatic pool expansion]:value:(on off)' + 'autoreplace[automatic device replacement]:value:(on off)' + 'bootfs[default bootable dataset]:dataset:_zfs_dataset' + 'cachefile[pool configuration cache file location]:value' + 'dedupditto[threshold for number of copies]:value [0]' + 'delegation[delegated administration]:value:(on off)' + 'failmode[failure-mode behavior]:value:(wait continue panic)' + "listshares[show shares in 'zfs list']:value:(on off)" + "listsnaps[show snapshots in 'zfs list']:value:(on off)" + 'version[pool version]:version' +) + +# TODO: userused@ and groupused@ could have more extensive handling +ro_ds_props=( + name type creation space used available referenced compressratio mounted + origin usedbychildren usedbydataset usedbyrefreservation usedbysnapshots + defer_destroy userused@ userrefs groupused@ keystatus +) +ci_ds_props=( + 'casesensitivity:value:(sensitive insensitive mixed)' + 'normalization:value:(none formC formD formKC formKD)' + 'utf8only:value:(on off)' +) +rw_ds_props=( + 'aclinherit:value:(discard noallow restricted passthrough passthrough-x)' + 'atime:value:(on off)' + 'canmount:value:(on off noauto)' + "checksum:value:($sum_algorithms)" + "compression:value:($comp_algorithms)" + 'copies:value:(1 2 3)' + "dedup:value:($dedup_algorithms)" + 'devices:value:(on off)' + 'encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)' + 'exec:value:(on off)' + 'groupquota@' + 'logbias:value:(latency throughput)' + "mountpoint: : _alternative \ + 'properties:property:(none legacy)' \ + 'paths:mountpoint:_directories -W / -P /'" + 'multilevel:value:(on off)' + 'nbmand:value:(on off)' + 'primarycache:value:(all none metadata)' + 'quota: :->quotas' + 'readonly:value:(on off)' + 'recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)' + 'refquota: :->quotas' + "refreservation: : _alternative \ + 'sizes: :_numbers -M \"m:{a-zA-Z}={A-Za-z}\" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \ + 'properties:property:(auto none)'" + 'reservation: :->quotas' + 'rstchown:value:(on off)' + 'secondarycache:value:(all none metadata)' + 'setuid:value:(on off)' + 'shadow:value' # TODO: complete URI|none + 'share:share properties' + 'snapdir:value:(hidden visible)' + 'sync:value:(standard always disabled)' + 'userquota@' + 'version:value' + 'volsize:size:_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' +) + +case $service:$implementation in + *:openzfs) + ds_types+=( bookmark ) + sum_algorithms+=( noparity sha512 skein edonr ) + comp_algorithms+=( zstd zstd-{1..19} zstd-fast zstd-fast-{{1..9}{,0},100,500,1000} ) + dedup_algorithms+=( {sha512,skein}{,\,verify} edonr,verify ) + share_rw_properties=( sharesmb:option sharenfs:option ) + ro_po_props+=( + 'expandsize[uninitialized space within the pool]' + 'fragmentation[amount of fragmentation in the pool]' + 'freeing[amount of space remaining to be reclaimed]' + 'used[amount of storage space used within the pool]' + 'load_guid[unique identifier generated when pool is loaded]' + ) + ci_po_props+=( + 'ashift[pool sector size exponent]:exponent:((9\:512 10\:1024 11\:2048 12\:4096 13\:8192 14\:16384 15\:32768 16\:65536))' + ) + rw_po_props+=( + 'autotrim[periodically trim recently freed space]:value:(on off)' + 'comment[text string that is available even if the pool becomes faulted]:value' + 'multihost[perform pool activity check during import]:value:(on off)' + ) + rw_ds_props+=( + 'aclmode:value:(discard groupmask passthrough restricted)' + 'acltype:value:(off noacl nfsv4 posix posixacl)' + 'mlslabel:value:(none)' # TODO: list sensitivity labels + 'redundant_metadata:value:(all most)' + 'vscan:value:(on off)' + 'xattr:value:(on off dir sa)' + "filesystem_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}" + "snapshot_limit: :{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ -prefix n ]]; then compadd none; else _message -e limits 'number or none'; fi}" + 'volmode:mode:(( + default\:use\ system-wide\ tunable + full\:expose\ as\ block\ devices + geom\:expose\ as\ block\ devices + dev\:hide\ partitions + none\:not\ exposed\ outside\ zfs + ))' + ) + ro_ds_props+=( + createtxg clones filesystem_count guid logicalreferenced logicalused + receive_resume_token refcompressratio snapshot_count volblocksize written + ) + delegatable_perms=( + bookmark load-key change-key userobjquota userobjused groupobjquota + groupobjused projectused projectquota projectobjused projectobjquota + ) + ;| + *:solaris) + ds_types+=( share ) + sum_algorithms+=( sha256+mac ) + share_nfs_ro_properties=( share.nfs.all ) + share_nfs_rw_properties=( + 'share.nfs:value:(on off)' + 'share.nfs.aclok:value:(on off)' + 'share.nfs.aclfab:value:(on off)' + 'share.nfs.anon:uid' + 'share.nfs.charset.'{cp932,euc-{cn,jpns,kr,tw},iso8859-{1,2,5,6,7,8,9,13,15},koi8-r,shift_jis}':access-list' + 'share.nfs.index:file:_files' + 'share.nfs.labeled:value:(on off)' + 'share.nfs.noaclfab:value:(on off)' + 'share.nfs.log:nfslog.conf tag' + 'share.nfs.nosub:value:(on off)' + 'share.nfs.nosuid:value:(on off)' + 'share.nfs.public:value:(on off)' + 'share.nfs.sec:security-mode-list' + 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.{ro,root,rw}':access-list' + 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.root_mapping':uid' + 'share.nfs.sec.'{default,dh,krb5{,i,p},none,sys}.window':credential lifetime (seconds)' + 'share.nfs.sec.sys.resvport:value:(on off)' + ) + share_smb_ro_properties=( share.smb.all ) + share_smb_rw_properties=( + 'share.smb:value:(on off)' + 'share.smb.abe' + 'share.smb.ad-container' + 'share.smb.catia:value:(on off)' + 'share.smb.csc:value:(disabled manual auto vdo)' + 'share.smb.dfsroot:value:(on off)' + 'share.smb.encrypt:value:(on off)' + 'share.smb.guestok:value:(on off)' + 'share.smb.oplocks:value:(disabled enabled)' + 'share.smb.cont_avail:value:(on off)' + 'share.smb.'{none,ro,rw}':access-list' + ) + share_ro_properties=( + share.all share.fs share.name share.point share.protocols share.state + $share_nfs_ro_properties $share_smb_ro_properties + ) + share_rw_properties=( + 'share.desc:description' + 'share.auto:value:(on off)' + 'share.autoname:value' + 'share.nfs.cksum:value' + 'share.path:path' + $share_nfs_rw_properties $share_smb_rw_properties + ) + ro_po_props+=( + 'lastscrub[start time of the last successful scrub]' + ) + rw_po_props+=( + 'clustered[pool is imported as a global pool in Oracle Solaris Cluster]:value:(on off)' + 'scrubinternal[time interval between scheduled scrubs]:interval' + ) + ro_ds_props+=( keychangedate rekeydate effective{read,write}limit ) + rw_ds_props+=( + 'aclmode:value:(discard mask passthrough)' + "defaultreadlimit: : _alternative \ + 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \ + 'properties:property:(none)'" + "defaultwritelimit: : _alternative \ + 'sizes: :_guard \[0-9\]\#\(\|\[BKMGTPEZ\]\) size\ \(bytes\ per\ second\)' \ + 'properties:property:(none)'" + 'defaultuserquota:->quotas' + 'defaultgroupquota: :->quotas' + 'keysource:value:->keysources' + ) + ci_ds_props+=( + 'volblocksize:value:compadd -o nosort 512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M' + ) + difffields=( + object parent size links linkschange name oldname user group + ctime mtime atime crtime mountpoint dataset_name + ) + delegatable_perms=( key keychange ) + ;| + zfs:openzfs) + subcmds+=( + bookmark change-key load-key program project projectspace redact + unload-key wait + ) + ;| + zpool:openzfs) + subcmds+=( + checkpoint events labelclear initialize reopen resilver sync trim wait + version + ) + ;| + zfs:solaris) + subcmds+=( key help ) + ;| + zpool:solaris) + subcmds+=( help label monitor ) + ;| + + zfs:*) + subcmds+=( + create destroy clone promote rename snapshot rollback list set get + inherit mount unmount share unshare send receive allow unallow upgrade + userspace groupspace hold holds release diff + ) + [[ $OSTYPE = freebsd<7->.* ]] && subcmds+=( jail unjail ) + ;; + zpool:*) + subcmds+=( + add attach clear create destroy detach export get history import iostat + list offline online reguid remove replace scrub set split status upgrade + ) + ;; +esac + +case $OSTYPE in + solaris*) + rw_ds_props+=( 'zoned:value:(on off)' ) + ;; + freebsd*) + [[ $OSTYPE = freebsd<-12>.* ]] && subcmds+=( remap ) + rw_ds_props+=( 'jailed:value:(on off)' ) + ;; + linux-gnu) + rw_ds_props+=( 'relatime:value:(on off)' ) + ci_ds_props+=( + {,fs,def,root}'context:SELinux context:_selinux_contexts' + ) + ;; +esac + +delegatable_perms+=( + allow clone create destroy diff hold key keychange mount promote receive + release rename rollback send share snapshot groupquota groupused userprop + userused ${ci_ds_props%%:*} +) + +key_properties=( + 'keylocation:location [prompt]:_files -P file\:// -W /' + 'keyformat:format:(raw hex passphrase)' + 'pbkdf2iters:iterations [350000]' +) + +ro_ds_props+=( $share_ro_properties ) +rw_ds_props+=( $share_rw_properties ) +ci_ds_props+=( $rw_ds_props ) + +ds_propnames=( ${rw_ds_props%%:*} ) +po_propnames=( ${ro_po_props%%:*} ${ci_po_props%%:*} ${rw_po_props%%:*} ) + + +case $service in + zfs|zpool) + _arguments -C -A "-*" \ + '-?[display usage information]' \ + '*::command:->subcmd' && return 0 + + if (( CURRENT == 1 )); then + _wanted commands expl "subcommand" compadd -a subcmds + return + fi + curcontext="${curcontext%:*}-$words[1]:" + ;; + zdb) + if [[ $implementation = openzfs ]]; then + args=( + '-mm[also display free space histogram associated with each metaslab]' + {-mmm,-MM}'[display more free space information]' + {-mmmm,-MMM}'[display every spacemap record]' + '-DD[display a histogram of deduplication statistics]' + '-DDD[display deduplication statistics independently for each table]' + '-DDDD[dump the contents of the deduplication tables describing duplicate blocks]' + '-DDDDD[also dump the contents of the deduplication tables describing unique blocks]' + '-E+[decode and display block from a given embedded block pointer]:word' + '(-l)-ll+[like -l but display L2ARC log blocks]:device:_files' + '(-l -ll)-lll+[like -l but display every configuration, unique or not]:device:_files' + "-q[don't print labels (with -l)]" + '-k[examine the checkpointed state of the pool]' + '-M[display the offset, spacemap, and free space of each metaslab]' \ + '-O+[look up the specified path inside of the dataset]:dataset:_zfs_dataset:path:_files' + '-o+[set the given global libzpool variable]:variable' + '-r+[copy the specified path inside of the dataset to the specified destination]:dataset:_zfs_dataset:path:_files:destination:_files' + '-x+[copy all blocks accessed to files in the specified directory]:directory:_directories' + '-V[attempt verbatim import]' + '-Y[attempt all possible combinations when reconstructing indirect split blocks]' + '-y[perform validation for livelists that are being deleted]' + ) + else + args=( + '-?[display usage information]' + '-M+[dump MOS contents]:contents: _values -s , raw_config all objset dir pool_props metaslab sync_bplist dtl config spares l2cache history errlog_scrub errlog_last bpmap-vdev bpmap_defer_obj dtl-scan ddt2' + '-r[dump datasets recursively]' + '-z[report zombies only]' + '-V[verify DDT xtree block data]' + "-a[don't import l2arc cache data]" + '-f[attempt to force import (with -e)]' + '-w+[specify directory to save shadow copy of all accessed disk locations]: :_directories' + '-x+[set kernel tunable]:tunable' + '-G[dump the contents of the zfs_dbgmsg buffer before exiting]' + '-I[limit the number of outstanding checksum I/Os to the specified value]' + ) + fi + _arguments -A "-*" -S $args \ + '(-C)-b[display block statistics]' \ + '(-C)*-c[verify checksum of metadata blocks]' \ + '(-b -c -d)-C[display configuration information]' \ + '(-C)*-d[display dataset information]' \ + '-h[display pool history]' \ + '-i[display intent log (ZIL) information]' \ + '-l+[read the vdev labels from the specified device]:device:_files' \ + '-m[display the offset, spacemap, and free space of each metaslab]' \ + '-s[report statistics on zdb I/O]' \ + '*-u[also display the uberblocks on the device (with -l)]' \ + '*-v[enable verbose output]' \ + '-D[display deduplication statistics]' \ + '-S[simulate the effects of deduplication, displaying constructed DDT as with -DD]' \ + '-L[disable leak detection and the loading of space maps]' \ + '-R+[read and display a block from the specified device]:device' \ + "-A[don't abort should any assertion fail]" \ + "-AA[enable panic recovery]" \ + '-F[try progressively older transactions until pool is readable]' \ + '-U+[specify cache file to use]:cache file [/etc/zfs/zpool.cache]:_files' \ + '-X[attempt "extreme" transaction rewind]' \ + '-e[operate on an exported pool]' \ + '-p[specify path under which to search for devices (with -e)]:path:_files' \ + '-P[use exact (parsable) numeric output]' \ + '-t+[specify the highest transaction to use when searching for uberblocks]:transaction' \ + '1:pool:_zfs_pool' + return + ;; +esac + +case $service:$words[1] in + zfs:create) + [[ $implementation = openzfs ]] && args=( + '-P[print machine-parsable verbose information about the created dataset]' + '-n[do a dry-run, no dataset will be created]' + '-v[print verbose information about the created dataset]' + ) + _arguments -C -A "-*" -S $args \ + '-p[create parent datasets]' \ + '*-o+[set initial propertyvalue]:property:->create-properties' \ + - set1 \ + ':filesystem:_zfs_dataset -t fs -e "parent dataset"' \ + - set2 \ + '-s[create sparse volume]' \ + '-b+[set volblocksize]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes blocksize \:B {k,M,G,T,P,E,Z}{,B}' \ + '-V+[set size]: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \ + ':volume:_zfs_dataset -t fs -e "parent dataset"' + ;; + + zfs:destroy) + if [[ $implementation = openzfs ]]; then + args=( + '-n[do a dry-run, no data will be deleted]' + '-p[print machine-parsable verbose information about the deleted data]' + '-v[print verbose information about the deleted data]' + ) + else + args=( '-s[destroy snapshots synchronously - only return when blocks freed]' ) + fi + _arguments -A "-*" -S $args \ + '-r[recursively destroy all children]' \ + '-R[recursively destroy all dependents]' \ + '(-f)-d[delete or mark deferred]' \ + '(-d)-f[force unmounts]' \ + ':dataset:_zfs_dataset -t fs -t vol ${=${opt_args[(i)-f]:--t snap}:/-f/} ${=${opt_args[(i)-*]:--t bookmark}:/-?/}' + ;; + + zfs:snap(|shot)) + _arguments -C -A "-*" -S \ + '-r[recursively snapshot all descendant datasets]' \ + '*-o+[set property]:property:->create-properties' \ + ':filesystem/volume:_zfs_dataset -t fs -t vol -S@' + ;; + + zfs:rollback) + _arguments -A "-*" -S \ + '-r[recursively destroy more recent snapshots]' \ + '-R[recursively destroy more recent snapshots and clones]' \ + '-f[force unmounts]' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:clone) + [[ $implementation = solaris ]] && args+=( + '-K[create encryption key]' + ) + _arguments -C -A "-*" -S $args \ + '-p[create parent datasets]' \ + '*-o+[set property]:property:->create-properties' \ + ':snapshot:_zfs_dataset -t snap' \ + ':filesystem/volume:_zfs_dataset -t fs -e "parent dataset"' + ;; + + zfs:promote) + _arguments \ + ':filesystem:_zfs_dataset -t clone' \ + ;; + + zfs:rename) + [[ $implementation = openzfs ]] && args=( + '(-r -u)-f[force unmount any filesystems]' + "(-r -f)-u[don't remount file systems during rename]" + ) + _arguments -A "-*" -S $args \ + '(-r)-p[create parent datasets]' \ + '(-p -u -f)-r[recursively rename snapshots of all descendent datasets]' \ + ':dataset:_zfs_dataset -r1' \ + ':dataset:_zfs_dataset -r2' + ;; + + zfs:bookmark) + _arguments \ + ':snapshot or bookmark:_zfs_dataset -t snap -t bookmark' \ + ':bookmark' + ;; + + zfs:program) + _arguments -A "-*" -S \ + '-j[display channel program output in JSON format]' \ + '-n[execute a read-only channel program]' \ + '-t+[limit the number of Lua instructions to execute]:instruction limit' \ + '-m+[specify memory limit]:memory limit (bytes) [10MB]' \ + ':pool:_zfs_pool' \ + ':script:_files' \ + '*: :_default' + ;; + + zfs:list) + if [[ $implementation = solaris ]]; then + args=( '-I+[specify dataset states to display instead of normal datasets]:dataset state:_sequence compadd - receiving resumable hidden all' ) + else + args=( '-p[use exact (parsable) numeric output]' ) + fi + _arguments -A "-*" -S $args \ + '(-d)-r[recursively display children]' \ + '-H[suppress printing of headers]' \ + '(-r)-d+[depth]:value' \ + '-o+[specify properties to list]: :_values -s , "property" $ro_ds_props $ds_propnames' \ + '*-s+[specify sort key (ascending)]: :_values "property" $ro_ds_props $ds_propnames' \ + '*-S+[specify sort key (descending)]: :_values "property" $ro_ds_props $ds_propnames' \ + '-t+[specify dataset types to list]: :_values -s , "dataset type" $ds_types' \ + '*:filesystem/volume/snapshot/path:_zfs_dataset -p' + ;; + + zfs:set) + [[ $implementation = solaris ]] && args=( + '-r[recursively apply value]' \ + ) + _arguments -C -A "-*" -S $args \ + ':property:->set-properties' \ + '*:filesystem/volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:get) + if [[ $implementation == openzfs ]]; then + args=( '-t+[specify dataset types to display]: :_values -s , "dataset type" $ds_types' ) + else + args=( '-e[expand property sublists to any depth]' ) + fi + _arguments -A "-*" -S $args \ + "(-d)-r[recursively display children's properties]" \ + '(-r)-d+[depth]:value' \ + '-H[suppress printing of headers]' \ + '-p[use exact (parsable) numeric output]' \ + '-s+[specify sources]: :_values -s , "source" local default inherited received temporary none' \ + '-o+[specify fields]: :_values -s , "field" name property received value source' \ + ':property:_values -s , "property" $ro_ds_props $ds_propnames all' \ + '*:filesystem/volume/snapshot:_zfs_dataset' + ;; + + zfs:inherit) + _arguments -C -A "-*" -S \ + '-r[recursively inherit property for all children]' \ + '-S[revert to received property value]' \ + ':property:_values "property" $ro_ds_props ${rw_ds_props%%:*}' \ + '*:filesystem/volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:remap) + _arguments \ + ':filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:upgrade) + _arguments -A "-*" -S \ + '(- :)-v[display supported ZFS versions]' \ + '(-v :)-a[upgrade all filesystems on all pools]' \ + '(-v)-r[upgrade descendent filesystems, too]' \ + '(-v)-V+[upgrade to specified version]:version' \ + '(-a -v):filesystem:_zfs_dataset -t fs' + ;; + + zfs:(user|group)space) + args=( + '-n[print numeric ID]' + '-i[translate SID to POSIX ID]' + ) + ;& # fall-through + zfs:projectspace) + [[ $implementation = solaris ]] && args+=( + '(- *)'{-h,--help}'[display usage information]' + ) + _arguments -A "-*" -S $args \ + '-H[suppress printing of headers, tab-delimit columns]' \ + '-p[use exact (parsable) numeric output]' \ + '-o+[specify properties to list]:property:_values -s , "property" type name used quota' \ + '*-s+[specify sort key (ascending)]: :_values "property" type name used quota' \ + '*-S+[specify sort key (descending)]: :_values "property" type name used quota' \ + '-t+[specify types to list]:type:_values -s , "type" all posixuser smbuser posixgroup smbgroup' \ + '*:filesystem/volume/snapshot:_zfs_dataset' + ;; + + zfs:project) + _arguments -A "-*" -S \ + '(-r -C -k -p -s)-d[act on the directory project ID and inherit flag, not its children]' \ + '(-d)-r[act on subdirectories recursively]' \ + '(-0 -c -d -s)-C[clear project inherit flag and/or ID on the file(s) or directories]' \ + '(-0 -c -d -p -s)-k[keep the project ID unchanged]' \ + '(-k -C -s)-c[check project ID and inherit flag on the file(s) or directories]' \ + '(-k -C -s)-0[print file name with a trailing NUL instead of newline]' \ + '(-k)-p+[specify project ID]:project ID' \ + '(-0 -c -k -C)-s[set project inherit flag on the given file(s) or directories]' \ + '*:file:_files' + ;; + + zfs:mount) + [[ $OSTYPE != freebsd* ]] && args=( '-O[overlay mount]' ) + [[ $implementation = openzfs ]] && args+=( + '-l[load keys for encrypted filesystems as they are being mounted]' + ) + _arguments -A "-*" -S $args \ + '-o+[specify temporary file system options]: :_values -s , "option" {,no}{atime,dev,exec,relatime,suid,xattr} ro rw' \ + '-v[report mount progress]' \ + '-f[force mount]' \ + '(:)-a[mount all available ZFS filesystems]' \ + '(-a):filesystem:_zfs_dataset -t fs' + ;; + + zfs:u(|n)mount) + [[ $implementation = openzfs ]] && args+=( + '-u[unload keys for any unmounted encryption roots]' + ) + _arguments -A "-*" -S $args \ + '-f[force unmount]' \ + '(:)-a[unmount all ZFS filesystems]' \ + '(-a):dataset or mountpoint:_zfs_dataset -t fs -t mtpt' + ;; + + zfs:share) + [[ $implementation = solaris ]] && args=( + - set2 \ + '-r[share filesystems recursively]' \ + ':dataset:_zfs_dataset -t fs' \ + - set3 \ + '*-o+[create a share with specified properties]: :_values -w "share properties" $share_rw_properties' \ + '-u[create a share without sharing it]' \ + ':dataset:_zfs_dataset -t fs' \ + ) + _arguments -A "-*" -S \ + - set1 \ + '-a[share all available ZFS filesystems]' \ + $args \ + - set4 \ + ':dataset or mountpoint:_zfs_dataset -t fs -t mtpt -t share' + ;; + + zfs:unshare) + [[ $implementation = solaris ]] && args=( + - set2 + '-r[unshare filesystems recursively]' + ':filesystem:_zfs_dataset -t fs' + ) + _arguments -A "-*" -S $args \ + - set1 \ + '-a[unshare all shared ZFS filesystems]' \ + - set3 \ + ':filesystem:_zfs_dataset -t fs -t mtpt -t share' + ;; + + zfs:send) + if [[ $implementation = openzfs ]]; then + args=( + '(-L --large-block)'{-L,--large-block}'[generate a stream which may contain blocks larger than 128KB]' + '(-P --parsable)'{-P,--parsable}'[print machine-parsable verbose information about the stream generated]' + '(-e --embed)'{-e,--embed}'[more compact stream for blocks stored with the embedded_data feature]' + '(-c --compressed)'{-c,--compressed}'[more compact stream for compressed blocks]' + '(-h --holds)'{-h,--holds}'[send snapshot holds]' + '-V[set the process title to a per-second report of how much data has been send]' + '-t[create a send stream that resumes an interrupted receive]:resume token' + '(-w --raw)'{-w,--raw}'[keep encrypted data exactly as it exists on disk]' + - redact + '(-h -V -t -w --raw)--redact[generate a redacted send stream]' + - saved + '(-S --saved)'{-S,--saved}'[generate stream from partially received dataset]' + ) + else + args=( + '-w+[send compressed filesystem blocks as compressed in the stream]:compression:(compress none)' + '-m+[limit amount of memory used by deduplication processing]: :_numbers -u bytes "memory size" K M G' + '-s+[set stream options]:token:(streamsize check nocheck memsize)' + '-C[read a receive checkpoint from stdin]' + '-c[create a self-contained stream]' + '(-R)-r[generate a recursive stream package]' + ) + fi + _arguments -A "-*" -S \ + '-b[send only received property values]' \ + '(-I)-i[generate an incremental stream]:snapshot:_zfs_dataset -t snap' \ + '-D[perform dedup processing]' \ + "-n[don't send the stream]" \ + '-p[send properties]' \ + '-v[verbose]' \ + '(-i)-I[generate an incremental stream with intermediary snapshots]:snapshot:_zfs_dataset -t snap' \ + '(-r)-R[generate a replication stream package]' \ + ':snapshot:_zfs_dataset -t snap -t bookmark' \ + $args + ;; + + zfs:redact) + _arguments \ + ':snapshot:_zfs_dataset -t snap' \ + ':bookmark:_zfs_dataset -t bookmark' \ + ':redaction snapshot:_zfs_dataset -t snap' + ;; + + zfs:(receive|recv)) + if [[ $implementation = openzfs ]]; then + args=( + '-h[skip the receive of holds]' + '-s[if the receive is interrupted, save the partially received state]' + '(- set2)-A[abort an interrupted zfs recv -s, deleting its saved partially received state]' + ) + [[ $OSTYPE != linux* ]] && args+=( + '-M[force an unmount of the file system while receiving a snapshot]' + ) + else + args=( '(-)-C[write a receive checkpoint to stdout]' ) + fi + _arguments -A "-*" -S $args \ + '-v[verbose]' \ + "-n[don't receive the stream]" \ + '-F[force a rollback if necessary]' \ + '-u[filesystem is not mounted]' \ + '-o[include property change in the stream]:property' \ + '-x[exclude property change from the stream]:property' \ + - set1 \ + ':filesystem/volume/snapshot:_zfs_dataset' \ + - set2 \ + '(-e)-d[set path prefix from stream, excluding only pool name]' \ + '(-d)-e[set path prefix from stream, using last path element]' \ + ':filesystem:_zfs_dataset -t fs' + ;; + + zfs:allow) + _arguments -C -A "-*" -S \ + '(-g -e -c -s)-u[delegate to user]' \ + '(-u -e -c -s)-g[delegate to group]' \ + '(1 -g -u -c -s)-e[delegate to everyone]' \ + '(1 -u -g -e -l -d -s)-c[set permissions for newly-created descendant filesystems]' \ + '(-u -g -e -l -d -c)-s[define or modify permission sets]:permission set' \ + '(-c -s)-l[allow for named dataset]' \ + '(-c -s)-d[allow for descendent datasets]' \ + '1: :->first' \ + ':permission list:_values -s , "permission or set" $delegatable_perms' \ + ':filesystem/volume:_zfs_dataset -t fs -t vol' + + if [[ -n $state ]]; then + case $opt_args[(I)-[ugs]] in + ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;| + ^-[gs]) alts+=( 'users:user:_users' ) ;| + ^-[us]) alts+=( 'groups:group:_groups' ) ;| + '') + alts+=( + 'all:everyone:(everyone)' + 'filesystems:filesystem/volume:_zfs_dataset -t fs -t vol' + ) + ;; + esac + _alternative $alts + fi + ;; + + zfs:unallow) + _arguments -A "-*" -S \ + '-r[recursive removal]' \ + '(-e -g -s -c)-u[user]' \ + '(-e -u -s -c)-g[group]' \ + '(1 -g -u -s -c)-e[everyone]' \ + '(1 -u -g -e -s -l -d)-c[create-time permissions]' \ + '(-e -u -g -c)-s[remove permissions from or delete a permission set]:permission set' \ + '(-c -s)-l[allow for named dataset]' \ + '(-c -s)-d[allow for descendent datasets]' \ + '1: :->first' \ + '::permissions or sets:_values -s , "permission or set" $delegatable_perms' \ + ':filesystem/volume:_zfs_dataset -t fs -t vol' + + if [[ -n $state ]]; then + case $opt_args[(I)-[ugs]] in + ^-[ug]) alts+=( 'permission-sets: :_guard "(|@*)" "permission set"' ) ;| + ^-[gs]) alts+=( 'users:user:_users' ) ;| + ^-[us]) alts+=( 'groups:group:_groups' ) ;| + '') alts+=( 'all:everyone:(everyone)' ) ;; + esac + _alternative $alts + fi + ;; + + zfs:hold) + _arguments -A "-*" -S \ + '-r[apply hold recursively]' \ + ':tag' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:holds) + [[ $implementation = openzfs ]] && args=( + '-H[suppress printing of headers, tab-delimit columns]' + ) + [[ $OSTYPE = freebsd<-12>.* ]] && args+=( + # features were lost with the openzfs rebase + '-p[use exact (parsable) numeric output]' + '(-r)-d+[depth]:value' + ) + _arguments -A "-*" -S $args \ + '(-d)-r[list holds recursively]' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:release) + _arguments -A "-*" -S \ + '-r[release holds recursively]' \ + ':tag' \ + ':snapshot:_zfs_dataset -t snap' + ;; + + zfs:diff) + [[ $implementation = solaris ]] && args=( + '(-E)-e[only show new and changed files, no deleted]' + '*-o+[show specified fields]:field:_values "field" $difffields' + '-q[silence warnings for missing snapshots on recursive datasets]' + '-N[enumerate new child datasets (with -r)]' + '(1 -e)-E[show difference from empty]' + ) + _arguments -A "-*" -S $args \ + '-F[add column for filetype character, similar to ls(1)]' \ + '-H[suppress printing of headers and arrows, tab-delimit columns]' \ + '-t[add column for ctime]' \ + '(-E)1:snapshot:_zfs_dataset -t snap' \ + '2:snapshot or filesystem:_zfs_dataset -t snap -t fs' + ;; + + zfs:wait) + _arguments -A "-*" -S \ + '-t[specify background activity]:activity:(deleteq)' \ + ':filesystem:_zfs_dataset' + ;; + + zfs:key) + _arguments -C -A "-*" -S \ + '-t+[only apply to given dataset type]: :_values -s , "dataset type" $ds_types' \ + '(-u -c -K -f -o)-l[load the encryption key]' \ + "(-u -c -K -f -o)-M[don't mount file systems after loading their keys]" \ + "(-u -c -K -f -o)-S[don't share file systems after loading their keys]" \ + '(-l -c -K -o -M -S)-u[unload the encryption key]' \ + '(-l -c -K -o -M -S)-f[force unmount the dataset before unloading the encryption key]' \ + '(-l -u -K -f -M -S)-c[change the encryption key]' \ + '(-l -u -K -f -M -S)-o+[change a property]:property:->keysources' \ + '(-l -c -u -f -o -M -S)-K[create a new data encryption key]' \ + '(1 -r)-a[apply to all datasets in all pools]' \ + '(-a)-r[apply recursively]' \ + ':filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:load-key) + _arguments -A "-*" -S \ + "-L+[specify location of user's encryption key]:key location [prompt]:_files -P file\:// -W /" \ + '(:)-a[load keys for all encryption roots in all imported pools]' \ + '-n[do a dry-run, simply check that the provided key is correct]' \ + '-r[load keys for datasets recursively]' \ + '(-a):filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:unload-key) + _arguments -A "-*" -S \ + '(:)-a[unload keys for all encryption roots in all imported pools]' \ + '-r[unload keys for datasets recursively]' \ + '(-a):filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:change-key) + _arguments -A "-*" -S \ + '(-o)-i[make filesystem inherit key from its parent]' \ + '-l[ensure key is loaded before attempting to change it]' \ + '(-i)*-o+[change encryption key property]: :_values -s , "property" $key_properties' \ + ':filesystem or volume:_zfs_dataset -t fs -t vol' + ;; + + zfs:jail|zfs:unjail) + _arguments \ + '1: : _jails' \ + '2:filesystem:_zfs_dataset -t fs' + ;; + + zfs:help) + _arguments -A "-*" -S \ + - set1 \ + ':command:($subcmds $delegatable_perms $ro_ds_props ${rw_ds_props%%:*} properties)' \ + - set2 \ + '(2)-l[display property information]' \ + ':help topic:(property)' \ + ':property:($delegatable_perms $ro_ds_props ${rw_ds_props%%:*})' + ;; + + zpool:help) + _arguments -A "-*" -S \ + - commands \ + ':command:($subcmds)' \ + - properties \ + '(2)-l[display property information]' \ + ':help topic:(property)' \ + ':property:(${po_propnames%%\[*})' + ;; + + zpool:add) + if [[ $implementation = openzfs ]]; then + args=( + '-g[display vdev, GUIDs instead of the normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' \ + '-P[display real paths for vdevs instead of only the last component of the path]' + ) + elif [[ $implementation = solaris ]]; then + args=( '-l[display configuration in /dev/chassis location form]' ) + fi + _arguments -A "-*" -S $args \ + '-f[force use of in-use devices]' \ + '-n[display configuration without modifying pool]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->virtual-devices' + ;; + + zpool:attach) + if [[ $implementation = openzfs ]]; then + args=( + '-w[wait until new device has finished resilvering before returning]' + '-s[reconstruct sequentially to restore redundancy as quickly as possible]' + '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' + ) + fi + _arguments -A "-*" -S $args \ + '-f[force attach, even if in use]' \ + ':pool:_zfs_pool' \ + ':virtual device:->pool-devices' \ + ':virtual device:->disk-devices' + ;; + + zpool:checkpoint) + _arguments -A "-*" -S \ + '(-d --discard)'{-d,--discard}'[discard an existing checkpoint from the pool]' \ + '(-w --wait)'{-w,--wait}'[wait until the checkpoint has finished being discarded before returning]' \ + ':pool:_zfs_pool' + ;; + + zpool:clear) + [[ $implementation = solaris ]] && args=( + '-f[ignore fmadm acquit and fmadm repair failures]' + ) + _arguments -C -A "-*" -S $args \ + '-F[discard transactions to allow pool opening]' \ + '-n[with -F, check if discarding transactions would work]' \ + '-X[(undocumented) extreme rewind of transactions]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->pool-devices' + ;; + + zpool:create) + if [[ $implementation = openzfs ]]; then + args=( + "-d[don't enable any features on the new pool]" + ) + else + args=( + '-B[create EFI boot partition on whole disks]' + '-l[display configuration in /dev/chassis location form]' + "-N[create pool but don't mount or share]" + ) + fi + _arguments -C -A "-*" -S $args \ + '-o+[set pool property at creation time]:property:->newpool-properties' \ + '-O+[set dataset property at creation time]:property:->create-properties' \ + '-f[force use of in-use devices]' \ + '-n[display configuration without creating pool]' \ + '-R+[use alternate root]:alternate root:_directories' \ + '-m+[set mountpoint for root dataset]:mountpoint' \ + '-t+[use a temporary pool name]:pool name' \ + ':pool :_guard "^-*" "pool name"' \ + '*: :->virtual-devices' + ;; + + zpool:destroy) + _arguments -A "-*" -S \ + '-f[force active datasets to be unmounted]' \ + ':pool:_zfs_pool' + ;; + + zpool:detach) + _arguments -C \ + ':pool:_zfs_pool' \ + ':virtual device:->pool-devices' + ;; + + zpool:events) + _arguments -A "-*" -S \ + '(- 1)-c[clear all previous events]' \ + '-f[follow mode - continue running, showing new events]' \ + '-H[suppress headers and tab-delimit fields]' \ + '-v[print the entire payload for each event]' \ + '(-c)1:pool:_zfs_pool' + ;; + + zpool:export) + [[ $implementation = openzfs ]] && args=( '(*)-a[export all pools]' ) + _arguments -A "-*" -S $args \ + '-f[forcefully unmount all datasets]' \ + '*:pool:_zfs_pool' + ;; + + zpool:get) + [[ $implementation = solaris ]] && args=( + '-s+[specify sources to display]: :_values -s "source" local default none' + ) + _arguments -A "-*" -S $args \ + '-H[suppress headers and tab-delimit fields]' \ + '-p[display numbers in parseable (exact) values]' \ + '-o+[specify fields to display]: : _values -s , field name property value source' \ + ':property:_values -s , "property" $po_propnames' \ + '*:pool:_zfs_pool' + ;; + + zpool:history) + _arguments -A "-*" -S \ + '-i[display internal events]' \ + '-l[long format]' \ + '*:pool:_zfs_pool' + ;; + + zpool:import) + # TODO: -o should complete mount options, too + if [[ $implementation = openzfs ]]; then + args=( + '-t[new pool name is temporary]' + '-l[request encryption keys for all encrypted datasets]' + '--rewind-to-checkpoint[rewind pool to the checkpointed state]' + '-s[scan using the default search path]' + '(-F -X)-T[specify the txg to use for rollback]' + ) + else + args=( + '(-a)-t+[use a temporary pool name]:pool name' + '-l[display configuration in /dev/chassis location form]' + ) + fi + _arguments -C -A "-*" -S $args \ + '(1 2 -t)-a[search for and import all pools found]' \ + '-D[destroyed pools only]' \ + '(-d)*-c+[use cache file]:cache file:_files' \ + '(-c -D)*-d+[search for devices or files in directory]:directory:_files -/' \ + '-F[recovery mode: discard transactions if required]' \ + '-X[(undocumented) extreme rewind of transactions]' \ + '!-V' \ + '-f[force import]' \ + '-m[ignore missing log devices]' \ + '-N[import pool without mounting any filesystems]' \ + "-n[with -F; don't perform input]" \ + '-R+[specify alternate root]:alternate root:_files -/' \ + '-o+[set pool or dataset property]:property:->import-properties' \ + '1:pool name or id:_zfs_pool' \ + '2::new pool name' + ;; + + zpool:initialize) + _arguments -A "-*" -S \ + '(-s --suspend -c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \ + '(-s --suspend -c --cancel)'{-s,--suspend}'[suspend initializing on specified devices]' \ + '(-w --wait)'{-w,--wait}'[wait until devices have finished initializing before returning]' \ + ':pool:_zfs_pool' \ + '*:device:pool-devices' + ;; + + zpool:iostat) + if [[ $implementation = openzfs ]]; then + args=( + '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"' + '-g[display vdev GUIDs instead of normal device names]' + '-H[suppress headers and tab-delimit fields]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-n[print headers only once]' + '-p[display numbers in parsable (exact) values and times in nanoseconds]' + '-P[display full paths for vdevs instead of only the last component of the path]' + "-r[print request size histograms for the leaf vdev's IO]" + '-y[omit statistics since boot]' + '-w[display latency histograms]' + '-l[include average latency statistics]' + '-q[include active queue statistics]' + ) + else + args=( '-l[display configuration in /dev/chassis location form]' ) + fi + _arguments -A "-*" -S $args \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '-v[verbose statistics]' \ + '*::pool:_zfs_pool' \ + '::interval' \ + '::count' + ;; + + zpool:label) + _arguments -C -A "-*" -S \ + '(-c)*-d+[specify path in which to search for devices or files]:path:_directories' \ + '(-d)-c+[read configuration from specified cache file]:cache file:_files' \ + '(-R)-C[clear ZFS metadata on an inactive pool or device]' \ + '(-C)-R[recover ZFS metadata for a pool]' \ + '1::pool:_zfs_pool' \ + '2:device:->pool-devices' + ;; + + zpool:labelclear) + _arguments -A "-*" -S \ + '-f[treat exported or foreign devices as inactive]' \ + '*:virtual device:_files' + ;; + + zpool:list) + [[ $implementation = openzfs ]] && args=( + '-g[display vdev GUIDs instead of normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-p[display numbers in parsable (exact) values]' + '-P[display full paths for vdevs instead of only the last component of the path]' + '-v[report usage statistics for individual vdevs within the pool]' + ) + _arguments -A "-*" -S $args \ + '-H[suppress headers and tab-delimit fields]' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '-o+[specify fields to list]: :_values -s , "field" $po_propnames' \ + '::pool:_zfs_pool' + ;; + + zpool:monitor) + _arguments -A "-*" -S \ + '-t+[specify provider]:provider:(send receive scrub resilver ddtmigrate destroy)' \ + '-o+[specify fields]: :_values -s , field done other pctdone pool provider speed starttime tag timeleft timestmp total' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '-p[use machine-parseable output format]' \ + '1:pool:_zfs_pool' \ + '2:interval' \ + '3:count' + ;; + + zpool:offline) + [[ $implementation = openzfs ]] && args=( + '-f[force disk into faulted state]' + ) + _arguments -C -A "-*" -S $args \ + '-t[offline until next reboot]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->pool-devices' + ;; + + zpool:online) + _arguments -C -A "-*" -S \ + '-e[expand device to use all available space]' \ + ':pool:_zfs_pool' \ + '*:virtual device:->pool-devices' + ;; + + zpool:reopen) + _arguments -A "-*" -S \ + "-n[don't restart an in-progress scrub operation]" \ + '1:pool:_zfs_pool' + ;; + + zpool:reguid) + _zfs_pool + ;; + + zpool:remove) + [[ $implementation = openzfs ]] && args=( + '(-s)-w[wait until removal has completed before returning]' + ) + _arguments -C -A "-*" -S $args \ + "(-s)-n[don't perform the removal, display mapping table memory use]" \ + '(-s)-p[with -n, display numbers in parseable (exact) values]' \ + '(- *)-s[stop and cancel an in-progress removal]' \ + '1:pool:_zfs_pool' \ + '*:device:->pool-devices' + ;; + + zpool:replace) + [[ $implementation = openzfs ]] && args=( + '-w[wait until replacement has completed before returning]' + '-s[reconstruct sequentially to restore redundancy as quickly as possible]' + '-o+[set given pool properties]: :_values -s , "property" "${(@M)ci_po_props\:#ashift*}"' + ) + _arguments -A "-*" -S $args \ + '-f[force attach, even if in use]' \ + ':pool:_zfs_pool' \ + ':virtual device:_files' \ + '::virtual device:_files' + ;; + + zpool:(resilver|sync)) + _arguments \ + '*:pool:_zfs_pool' + ;; + + zpool:scrub) + [[ $implementation = openzfs ]] && args=( + '(-s)-p[pause scrubbing]' + '-w[wait until scrub has completed before returning]' + ) + _arguments -A "-*" -S $args \ + '(-p)-s[stop scrubbing]' \ + '*:pool:_zfs_pool' + ;; + + zpool:set) + _arguments -C -A "-*" -S \ + ':property:->set-pool-properties' \ + '*:pool:_zfs_pool' + ;; + + zpool:split) + if [[ $implementation = solaris ]]; then + args=( '-l[display configuration in /dev/chassis location form]' ) + else + args=( + '-g[display vdev GUIDs instead of normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-l[request encryption keys for encrypted datasets]' + '-P[display full paths for vdevs instead of only the last component of the path]' + ) + fi + _arguments -C -A "-*" -S $args \ + '-R+[specify alternate root]:alternate root:_files -/' \ + '-n[display configuration without splitting]' \ + '-o+[set pool or dataset property]:property:->import-properties' \ + ':pool name or id:_zfs_pool' \ + ':new pool name' \ + '*:virtual device:->pool-devices' + ;; + + zpool:status) + if [[ $implementation = openzfs ]]; then + args=( + '-D[display a histogram of deduplication statistics]' + '-c[run scripts on each vdev]:script:_files -W "($ZPOOL_SCRIPTS_PATH /etc/zfs/zpool.d ~/.zpool.d)"' + '-i[display vdev initialization status]' + '-g[display vdev GUIDs instead of the normal device names]' + '-L[display real paths for vdevs resolving all symbolic links]' + '-p[display numbers in parsable (exact) values and times in nanoseconds]' + '-P[display full paths for vdevs instead of only the last component of the path]' + '-s[display the number of leaf VDEV slow IOs]' + '-t[display vdev TRIM status]' + ) + else + args=( '-l[display configuration in /dev/chassis location form]' ) + fi + _arguments -A "-*" -S $args\ + '-v[verbose information]' \ + '-x[show only unhealthy pools]' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + '*::pool:_zfs_pool' \ + ':: :_guard "[0-9]#" interval' \ + ':: :_guard "[0-9]#" count' + ;; + + zpool:trim) + _arguments -C -A "-*" -S \ + '(-d --secure)'{-d,--secure}'[initiate a secure TRIM]' \ + '(-r --rate)'{-r,--rate}'[set rate at which the TRIM operation progresses]:rate (bytes per second)' \ + '(-c --cancel)'{-c,--cancel}'[cancel trimming]' \ + '(-s --suspend)'{-s,--suspend}'[suspend trimming]' \ + '(-w --wait)'{-w,--wait}'[wait until devices are done being trimmed]' \ + '1:pool:_zfs_pool' \ + '*:device:->pool-devices' + ;; + + zpool:upgrade) + _arguments -A "-*" -S \ + '(- *)-v[display ZFS versions and descriptions]' + "(-v)-V+[upgrade to given version]:version" \ + '(-v *)-a[upgrade all pools]' \ + '(-a -v)*:pool:_zfs_pool' + ;; + + zpool:wait) + _arguments -A "-*" -S \ + '-H[suppress printing of headers, tab-delimit columns]' \ + '-P[use exact (parsable) numeric output]' \ + '-t+[specify background activity]: : _values -s , activity discard free initialize replace remove resilver scrub trim' \ + '-T+[display a timestamp]:format:((d\:standard u\:internal))' \ + ':pool:_zfs_pool' \ + ':interval' + ;; + + *) + _default + ;; +esac + +while (( $#state )); do + curstate=$state + state=() + case $curstate in + virtual-devices) + local -a vdevtypes + vdevtypes=( mirror raidz{,1,2,3} spare log cache ) + if [[ $implementation = openzfs ]]; then + vdevtypes+=( draid{,1,2,3} dedup special ) + else + vdevtypes+=( meta ) + fi + # cache can't be a mirror + [[ $words[CURRENT-1] != cache ]] && alts=( + 'vdev-types:vdev type:compadd -a vdevtypes' + ) + [[ -prefix / ]] || alts+=( + 'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev' + ) + _alternative $alts 'file-vdevs:file vdev:_files -W / -P /' + ;; + + pool-devices) + local -a devices + devices=( ${${${(M)${(f)"$(_call_program devices zpool status $line[1])"}:#$'\t' *}##[[:blank:]]#}%%[[:blank:]]*} ) + if (( $#devices )); then + _description devices expl "$state_descr" + compadd "$expl[@]" -a devices + break + fi + ;& # fall-through if we found none + + disk-devices) + [[ -prefix / ]] || alts=( + 'disk-vdevs:disk vdev:_files -g "*(-%)" -W /dev' + ) + _alternative $alts 'file-vdevs:file vdev:_files -W / -P /' + ;; + + keysources) + local -a suf + + compset -S ",*" || suf=(-S ,) + if compset -P 1 "*,"; then + _alternative \ + 'zfs-keylocator-prompt:"prompt" locator:(prompt)' \ + 'zfs-keylocator-file:file locator:_files' \ + 'zfs-keylocator-pkcs11: : _message -e zfs-keylocator-pkcs11 "PKCS#11 locator"' \ + 'zfs-keylocator-https: : _message -e zfs-keylocator-https "HTTPS URL locator"' + else + _description keysource-formats expl "keysource format" + compadd $suf -q "$expl[@]" "$@" raw hex passphrase + fi + ;; + + quotas) + _alternative \ + 'sizes: :_numbers -M "m:{a-zA-Z}={A-Za-z}" -u bytes size :B {k,M,G,T,P,E,Z}{,B}' \ + 'properties:property:(none)' + ;; + + import-properties) args=( $ci_ds_props $rw_ds_props $ci_po_props ) ;| + create-properties) args=( $ci_ds_props ) ;| + set-properties) args=( $rw_ds_props ) ;| + newpool-properties) args=( $rw_po_props $ci_po_props ) ;| + set-pool-properties) args=( $rw_po_props ) ;| + + *-properties) + if compset -P 1 '(#m)*@'; then + if compset -P 1 '*='; then + case $MATCH in + *quota@) _alternative \ + 'sizes: :_numbers -M "m\:{a-zA-Z}={A-Za-z}" -u bytes size \:B {k,M,G,T,P,E,Z}{,B}' \ + 'properties:property:(none)' + ;; + esac + else + case $MATCH in + user*@) _users -S = ;; + group*@) _groups -S = ;; + project*@) _message -e projects project ;; + esac + fi + else + _wanted values expl "$state_descr" compadd -S@ ${${(M)args:#*@}%@} + _values -C "$state_descr" ${args:#*@} + fi + ;; + esac +done + +[[ nm -ne "$compstate[nmatches]" ]] diff --git a/Completion/Unix/Command/_zip b/Completion/Unix/Command/_zip index bc9aab1a5..cfa51be36 100644 --- a/Completion/Unix/Command/_zip +++ b/Completion/Unix/Command/_zip @@ -115,7 +115,7 @@ case $service in '(-U)-UU[ignore any Unicode fields]' \ '-W[modify pattern matching so only ** matches /]' \ '-\:[allow extraction outside of extraction base directory]' \ - '-\\\^[allow control characters in extracted entries]' \ + '-^[allow control characters in extracted entries]' \ '-i[include the following names]:*-*:pattern' \ '-x[exclude the following names]:*-*:pattern' \ "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|xpi|[ejw]ar)(-.)'" \ diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool deleted file mode 100644 index d9c2caa52..000000000 --- a/Completion/Unix/Command/_zpool +++ /dev/null @@ -1,311 +0,0 @@ -#compdef zpool -# Synced with the S11U1 man page - -_zpool() { - local context state line expl implementation - local -a subcmds fields ro_props rw_props versions create_properties_dataset - - _pick_variant -r implementation -c 'zpool upgrade -v' openzfs='This system supports ZFS pool feature flags' solaris - - subcmds=( - create destroy add remove list iostat status online - offline clear attach detach replace scrub import export - upgrade history get set split help - ) - - if [[ $implementation = openzfs ]] && [[ $OSTYPE != solaris* ]]; then - subcmds+=( labelclear initialize ) - fi - - versions=( - ${${${(M)"${(f)$(_call_program versions zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*} - ) - - ro_props=( - "all[All properties]" - "allocated[Space allocated]" - "capacity[Space used (percentage)]" - "dedupratio[Deduplication ratio]" - "free[Space unallocated]" - "guid[Unique identifier]" - "health[Health status]" - "size[Total size]" - ) - - rw_props=( - "altroot[Alternate root directory]:value:" - "autoexpand[Automatic pool expansion]:value:(on off)" - "autoreplace[Automatic device replacement]:value:(on off)" - "bootfs[Default bootable dataset]:value:" - "cachefile[Pool configuration cache file location]:value:" - "dedupditto[Threshold for number of copies]:value:" - "delegation[Delegated administration]:value:(on off)" - "failmode[Failure-mode behavior]:value:(wait continue panic)" - "listshares[Show shares in 'zfs list']:value:(on off)" - "listsnaps[Show snapshots in 'zfs list']:value:(on off)" - "readonly[Controls whether the pool can be modified]:value:(on off)" - "version[Pool version]:version:($versions)" - ) - - fields=( ${ro_props%%:*} ${rw_props%%:*} ) - - create_properties_dataset=( - "aclinherit:value:(discard noallow restricted passthrough passthrough-x)" - "aclmode:value:(discard mask passthrough)" - "atime:value:(on off)" - "canmount:value:(on off noauto)" - "checksum:value:(on off fletcher2 fletcher4 sha256 sha256+mac)" - "compression:value:(on off lzjb gzip gzip-{1..9} zle)" - "copies:value:(1 2 3)" - "dedup:value:(on off verify sha256 sha256,verify)" - "devices:value:(on off)" - "encryption:value:(off on aes128-ccm aes-192-ccm aes-256-ccm aes-128-gcm aes-192-gcm aes-256-gcm)" - "exec:value:(on off)" - "groupquota@:value:" # TODO: complete group=size|none - "keysource:value:_zfs_keysource_props" - "logbias:value:(latency throughput)" - "mlslabel:value:(none)" # TODO: list sensitivity labels - "mountpoint:path, 'legacy', or 'none':{if [[ -prefix /* ]]; then _path_files -/; else _wanted mountpoints expl 'mountpoint (type \"/\" to start completing paths)' compadd legacy none; fi}" - "nbmand:value:(on off)" - "primarycache:value:(all none metadata)" - "quota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == quota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'quota' compadd none; fi}" - "readonly:value:(on off)" - "recordsize:value:(512 1K 2K 4K 8K 16K 32K 64K 128K 256K 512K 1M)" - "refquota:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refquota= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refquota' compadd none; fi}" - "refreservation:number or 'none':{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == refreservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'refreservation' compadd none; fi}" - "reservation:value:{if [[ -prefix [0-9]## ]]; then _message -e 'number'; elif [[ $PREFIX == reservation= ]]; then _wanted none expl 'number or none' compadd none; else _wanted none expl 'reservation' compadd none; fi}" - "rstchown:value:(on off)" - "secondarycache:value:(all none metadata)" - "setuid:value:(on off)" - "shadow:value:" # TODO: complete URI|none - "share:share properties:" - "sharenfs:value:(on off)" - "sharesmb:value:(on off)" - "snapdir:value:(hidden visible)" - "sync:value:(standard always disabled)" - "userquota@:value:" # TODO: complete user=size|none - "version:value:(1 2 3 4 current)" - "volsize:value:" # <size> - "vscan:value:(on off)" - "xattr:value:(on off)" - "zoned:value:(on off)" - ) - - if [[ $service == "zpool" ]]; then - _arguments -C \ - '-\?[show help information]' \ - '1:subcommand:compadd -a subcmds' \ - '*:: :->subcmd' && return - - service="$words[1]" - curcontext="${curcontext%:*}-$service:" - fi - - case $service in - (help) - _arguments -A "-*" \ - - set1 \ - ':command/property:($subcmds ${fields%%\[*} properties)' \ - - set2 \ - '-l[Display property information]' \ - ': :(properties)' - ;; - - (clear) - _arguments -A "-*" \ - '-F[Discard transactions to allow pool opening]' \ - '-f[Ignore fmadm acquit and fmadm repair failures]' \ - '-n[With -F, check if discarding transactions would work]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (create) - # TODO: investigate better vdev handling - _arguments -A "-*" \ - '-B[Create EFI boot partition on whole disks]' \ - '-o[Set pool property at creation time]:property:_values -s , "property" $rw_props' \ - '-O[Set dataset property at creation time]:property:_values -s , "property" $create_properties_dataset' \ - '-f[Force use of in-use devices]' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-n[Display configuration without creating pool]' \ - '-R[Use alternate root]:alternate root:_files -/' \ - '-m[Set mountpoint for root dataset]:mountpoint:' \ - ':pool name:' \ - '*:virtual device:_files' - ;; - - (destroy) - _arguments -A "-*" \ - '-f[Force active datasets to be unmounted]' \ - ':pool name:_zfs_pool' - ;; - - (add) - _arguments -A "-*" \ - '-f[Force use of in-use devices]' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-n[Display configuration without modifying pool]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (list) - _arguments \ - '-H[Scripted mode]' \ - '-T[timestamp]:value:(u d)' \ - '-o[Fields to list]:field:_values -s , "field" $fields' \ - '::pool name:_zfs_pool' - ;; - - (initialize) - _arguments -A "-*" \ - '(-c --cancel)'{-c,--cancel}'[cancel initializing on specified devices]' \ - '(-s --suspend)'{-s,--suspend}'[suspend initializing on specified devices]' \ - ':pool name:_zfs_pool' \ - '*:device:_files' - ;; - - (iostat) - _arguments -A "-*" \ - '-l[Display configuration in /dev/chassis location form]' \ - '-T[timestamp]:value:(u d)' \ - '-v[Verbose statistics]' \ - '*::pool name:_zfs_pool' \ - '::interval:' \ - '::count:' - ;; - - (labelclear) - _arguments -A "-*" \ - '-f[treat exported or foreign devices as inactive]' \ - '*:virtual device:_files' - ;; - - (status) - _arguments -A "-*" \ - '-l[Display configuration in /dev/chassis location form]' \ - '-v[Verbose information]' \ - '-x[Show only unhealthy pools]' \ - '-T[timestamp]:value:(u d)' \ - '*::pool name:_zfs_pool' - ;; - - (offline) - _arguments -A "-*" \ - '-t[Offline until next reboot]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (online) - _arguments \ - '-e[Expand device to use all available space]' \ - ':pool name:_zfs_pool' \ - '*:virtual device:_files' - ;; - - (attach) - # TODO: first device should choose first from existing. - _arguments \ - '-f[Force attach, even if in use]' \ - ':pool name:_zfs_pool' \ - ':virtual device:_files' \ - ':virtual device:_files' - ;; - - (detach) - _arguments \ - ':pool name:_zfs_pool' \ - ':virtual device:_files' - ;; - - (replace) - _arguments -A "-*" \ - '-f[Force attach, even if in use]' \ - ':pool name:_zfs_pool' \ - ':virtual device:_files' \ - '::virtual device:_files' - ;; - - (scrub) - _arguments -A "-*" \ - '-s[Stop scrubbing]' \ - '*:pool name:_zfs_pool' - ;; - - (export) - _arguments -A "-*" \ - '-f[Forcefully unmount all datasets]' \ - '*:pool name:_zfs_pool' - ;; - - (import) - # TODO: -o should complete mount options, too - _arguments -A "-*" \ - '-D[Destroyed pools]' \ - '(-d)*-c[Use cache file]:cache file:_files' \ - '(-c -D)*-d[Search for devices or files in directory]:directory:_files -/' \ - '-F[Recovery mode: discard transactions if required]' \ - '-f[Force import]' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-m[Ignore missing log devices]' \ - '-N[Import pool without mounting any filesystems]' \ - '-n[With -F; do not perform input]' \ - '-R[Alternate root]:alternate root:_files -/' \ - '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \ - - set1 \ - '*:pool name or id:_zfs_pool' \ - '::new pool name:' \ - - set2 \ - '-N[Do not mount any filesystems]' \ - '-a[All pools]' - ;; - - (get) - _arguments -A "-*" \ - ':property:_values -s , "property" $fields' \ - '*:pool name:_zfs_pool' - ;; - - (set) - _arguments -A "-*" \ - ':property:_values -s , "property" $rw_props' \ - '*:pool name:_zfs_pool' - ;; - - (split) - _arguments -A "-*" \ - '-R[Alternate root]:alternate root:_files -/' \ - '-l[Display configuration in /dev/chassis location form]' \ - '-n[Display configuration without splitting]' \ - '-o[Set pool or dataset property]:property:_values -s , "property" $create_properties_dataset $rw_props' \ - ':pool name or id:_zfs_pool' \ - ':new pool name:' \ - '*::virtual device:_files -/' - ;; - - (upgrade) - _arguments -A "-*" \ - - set1 \ - '-v[Display ZFS versions and descriptions]' \ - - set2 \ - "-V[Upgrade to given version]:version:($versions)" \ - '-a[Upgrade all pools]' \ - '*:pool name:_zfs_pool' - ;; - - (history) - _arguments -A "-*" \ - '-i[Display internal events]' \ - '-l[Long format]' \ - '*:pool name:_zfs_pool' - ;; - - (*) - _message "unknown zpool subcommand: $service" - ;; - esac -} - -_zpool "$@" diff --git a/Completion/Unix/Type/_bpf_filters b/Completion/Unix/Type/_bpf_filters index 54e2172c9..b744b1ab4 100644 --- a/Completion/Unix/Type/_bpf_filters +++ b/Completion/Unix/Type/_bpf_filters @@ -63,7 +63,7 @@ compquote suf # protocol or field: it is one, the other or both but not neither _regex_arguments _bpf /$'[^\0]#\0'/ \( \ - /$'(not[ \0]#|![ \0]#|(\\\\|)\\([ \0]#)'/ ':operators:operator:(not ()' \# \ + /$'(not[ \0]#|![ \0]#|(\\\\|)\\([ \0]#)'/ ':operators:operator:(not \()' \# \ \(\ \(\ \(\ diff --git a/Completion/Unix/Type/_date_formats b/Completion/Unix/Type/_date_formats index 889a95779..55af7c591 100644 --- a/Completion/Unix/Type/_date_formats +++ b/Completion/Unix/Type/_date_formats @@ -1,6 +1,6 @@ #autoload -local flag +local flag ret=1 local -aU specs local -A exclusion @@ -106,5 +106,7 @@ for flag in ${(s..)PREFIX#%}; do done _describe -t date-format-specifier 'date format specifier' specs \ - -p "${(Q)PREFIX:-%}" -S '' + -p "${(Q)PREFIX:-%}" -S '' && ret=0 [[ $1 == zsh ]] && _message -e date-format-precision 'precision for %%. (1-9)' + +return ret diff --git a/Completion/Unix/Type/_diff_options b/Completion/Unix/Type/_diff_options index 440913dff..dfa9889f2 100644 --- a/Completion/Unix/Type/_diff_options +++ b/Completion/Unix/Type/_diff_options @@ -70,9 +70,7 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '(-E --ignore-tab-expansion)'{-E,--ignore-tab-expansion}'[ignore changes due to tab expansion]' '(-Z --ignore-trailing-space)'{-Z,--ignore-trailing-space}'[ignore white space at line end]' "($ofwuc $oss -F --show-function-line)"{-F+,--show-function-line=}'[show the most recent line matching regex]:regex' - "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line' "($ofwy $ouc)--left-column[output only left column of common lines]" - "($ofwy $ouc)--suppress-common-lines[do not output common lines]" "($ofwg $ouc $oss)--old-group-format=[set old group format]:old group format" "($ofwg $ouc $oss)--new-group-format=[set new group format]:new group format" "($ofwl $ouc $oss)--unchanged-line-format=[set unchanged line format]:unchanged line format" @@ -80,8 +78,6 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '(--from-file)--to-file=[compare all operands to specified file]:to file:_files' \ '--color=-[use colors in output]::when [auto]:(never always auto)' '--palette=[specify colors to use]:color:_diff_palette' - "($of $ouc)--side-by-side[output in two columns]" - "($of $ouc)-y[output in two columns]" ) else args+=( '!--speed-large-files' ) @@ -128,6 +124,9 @@ if _pick_variant -r variant -c $cmd gnu=GNU unix -v || [[ $OSTYPE = freebsd<12-> '(-S --starting-file)'{-S+,--starting-file=}'[set first file in comparison]:start with file:_files' \ '--horizon-lines=[set number of lines to keep in prefix and suffix]:number of horizon lines' \ '(-d --minimal)'{-d,--minimal}'[try to find a smaller set of changes]' \ + "($of $ouc)"{-y,--side-by-side}'[output in two columns]' \ + "($ofwy $ouc)--suppress-common-lines[don't output common lines]" \ + "($ofwy $ouc --width -W)"{--width=,-W+}'[set size of line]:number of characters per line' \ "$@" else of='-c -e -f' diff --git a/Completion/Unix/Type/_email_addresses b/Completion/Unix/Type/_email_addresses index 8a5877a9c..d5f175a79 100644 --- a/Completion/Unix/Type/_email_addresses +++ b/Completion/Unix/Type/_email_addresses @@ -69,7 +69,7 @@ _email-ldap() { fi done compstate[insert]=menu - _wanted email-ldap expl 'matching names' \ + _wanted email-ldap expl 'matching name' \ compadd -U -i "$IPREFIX" -I "$ISUFFIX" "$@" -a - ali } diff --git a/Completion/Unix/Type/_files b/Completion/Unix/Type/_files index 6adaa8154..f03b4a148 100644 --- a/Completion/Unix/Type/_files +++ b/Completion/Unix/Type/_files @@ -1,6 +1,7 @@ #compdef -redirect-,-default-,-default- local -a match mbegin mend +local -a subtree local ret=1 # Look for glob qualifiers. This is duplicated from _path_files because @@ -91,7 +92,10 @@ for def in "$pats[@]"; do pat="${${sdef%%:${tag}*}//\\:/:}" if [[ "$sdef" = *:${tag}:* ]]; then + # If the file-patterns spec includes a description, use it and give the + # group/description options from it precedence over passed in parameters. descr="${(Q)sdef#*:${tag}:}" + end= else if (( $opts[(I)-X] )); then descr= @@ -107,27 +111,30 @@ for def in "$pats[@]"; do while _next_label "$tag" expl "$descr"; do _comp_ignore=( $_comp_ignore $ign ) if [[ -n "$end" ]]; then - if _path_files -g "$pat" "$opts[@]" "$expl[@]"; then - ret=0 - elif [[ $PREFIX$SUFFIX != */* ]] && zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles; then - local subtree - for rfile in $rfiles; do - if [[ $PWD/ = ${~rfile} ]]; then - if [[ -z $subtree ]]; then - subtree=( **/*(/) ) - fi - for prepath in $subtree; do - oprefix=$PREFIX - PREFIX=$prepath/$PREFIX - _path_files -g "$pat" "$opts[@]" "$expl[@]" && ret=0 - PREFIX=$oprefix - done - break - fi - done - fi + expl=( "$opts[@]" "$expl[@]" ) else - _path_files "$expl[@]" -g "$pat" "$opts[@]" && ret=0 + expl+=( "$opts[@]" ) + fi + + if _path_files -g "$pat" "$expl[@]"; then + ret=0 + elif [[ $PREFIX$SUFFIX != */* ]] && \ + zstyle -a ":completion:${curcontext}:$tag" recursive-files rfiles + then + for rfile in $rfiles; do + if [[ $PWD/ = ${~rfile} ]]; then + if [[ -z $subtree ]]; then + subtree=( **/*(/) ) + fi + for prepath in $subtree; do + oprefix=$PREFIX + PREFIX=$prepath/$PREFIX + _path_files -g "$pat" "$expl[@]" && ret=0 + PREFIX=$oprefix + done + break + fi + done fi done (( ret )) || break diff --git a/Completion/Unix/Type/_find_net_interfaces b/Completion/Unix/Type/_find_net_interfaces index 3f5db6b9a..06238b11c 100644 --- a/Completion/Unix/Type/_find_net_interfaces +++ b/Completion/Unix/Type/_find_net_interfaces @@ -22,11 +22,17 @@ case $OSTYPE in darwin*|freebsd*|dragonfly*) net_intf_list=( $(ifconfig -l) ) ;; irix*) net_intf_list=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;; *) - # linux's deprecated ifconfig may truncate long interface names - net_intf_list=( $(_call_program interfaces "ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p'") ) + if (( $+commands[ip] )); then + # if ip is available, we can also show altnames + net_intf_list=( $(_call_program interfaces "ip link | sed -ne 's/^[0-9]\+: \([^:@]\+\).*/\1/p;t; s/^[\ ]\+altname \(.\+\)\$/\1/p'") ) + else + # linux's deprecated ifconfig may truncate long interface names + net_intf_list=( $(_call_program interfaces "ifconfig -a 2>/dev/null | sed -n 's/^\([^ :]*\).*/\1/p'") ) + fi + if (( ${#net_intf_list} == 0 )) && [[ -d /proc/sys/net/ipv4/conf ]]; then # On linux we used to use the following as the default, without /sys/class/net/*. - # However, we now use ifconfig since it finds additional devices such + # However, we now use ip or ifconfig since it finds additional devices such # as tunnels. So only do this if that didn't work. typeset -gU net_intf_list net_intf_list=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) /sys/class/net/*(N:t) ) diff --git a/Completion/Unix/Type/_path_commands b/Completion/Unix/Type/_path_commands index 66795ae0f..4d5a6c5af 100644 --- a/Completion/Unix/Type/_path_commands +++ b/Completion/Unix/Type/_path_commands @@ -87,18 +87,19 @@ fi # 'if' block move up to the "_command_names -" branch of _command_names? if [[ -o path_dirs ]]; then local -a path_dirs - path_dirs=(${^path}/*(/N:t)) - (( ${#path_dirs} )) && - _wanted path-dirs expl 'directory in path' compadd "$@" -a path_dirs && ret=0 if [[ $PREFIX$SUFFIX = */* ]]; then + path_dirs=( ${path:#.} ) # Find command from path, not hashed - _wanted commands expl 'external command' _path_files -W path -g '*(*)' && - ret=0 + _wanted commands expl 'external command' _path_files -W path_dirs -g '*(-*)' && ret=0 + else + path_dirs=(${^path}/*(/N:t)) + (( ${#path_dirs} )) && + _wanted path-dirs expl 'directory in path' compadd "$@" -S / -a path_dirs && ret=0 fi fi -return $ret +return ret } _path_commands "$@" diff --git a/Completion/Unix/Type/_perl_modules b/Completion/Unix/Type/_perl_modules index d27a7f7af..3e11de9ea 100644 --- a/Completion/Unix/Type/_perl_modules +++ b/Completion/Unix/Type/_perl_modules @@ -60,10 +60,11 @@ _perl_modules () { with_pod=_with_pod fi - local perl=${words[1]%doc} perl_modules - if whence $perl >/dev/null; then + local perl perl_modules + if [[ $service == (perl|perldoc) ]] && whence -- ${${(Q)words[1]}%doc} >/dev/null; then + perl=$_ perl_modules=_${${perl//[^[:alnum:]]/_}#_}_modules$with_pod - elif (( ${+commands[perl]} )); then + elif whence perl > /dev/null; then perl=perl perl_modules=_perl_modules$with_pod else @@ -81,8 +82,8 @@ _perl_modules () { else local inc libdir new_pms - if [[ ${+perl} -eq 1 ]]; then - inc=( $( $perl -e 'print "@INC"' ) ) + if [[ -n $perl ]]; then + inc=( $( _call_program perl-inc ${(q)perl}$' -e \'print "@INC"\'' ) ) else # If perl isn't there, one wonders why the user's trying to # complete Perl modules. Maybe her $path is wrong? diff --git a/Completion/Unix/Type/_pgids b/Completion/Unix/Type/_pgids new file mode 100644 index 000000000..25d0c4af0 --- /dev/null +++ b/Completion/Unix/Type/_pgids @@ -0,0 +1,5 @@ +#autoload + +local expl + +_wanted pgids expl 'process group ID' compadd "$@" - ${(un)$(_call_program pgids ps -A -o pgid=)} diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files index 3fa5779c8..93e1b7f43 100644 --- a/Completion/Unix/Type/_remote_files +++ b/Completion/Unix/Type/_remote_files @@ -4,13 +4,16 @@ # key-based authentication with no passwords or a running ssh-agent to work. # # Usage: -# _remote_files [-/] [-g glob] [-h host] -- <cmd> [<cmd options>] +# _remote_files [-/] [-g glob] [-h host] [-W dir] -- <cmd> [<cmd options>] # # Options: # - -/: only complete directories # - -g: specify a pattern to match against files # p, = and * glob qualifiers supported # - -h: specify the remote host, default is ${IPREFIX%:} +# - -W: specify the parent directory to list files from, +# default is the home directory +# # # Commands: # - ssh: Additional options for non-interactive use are automatically added @@ -30,12 +33,12 @@ # There should be coloring based on all the different ls -F classifiers. local expl rempat remfiles remdispf remdispd args cmd suf ret=1 local -a args cmd_args -local glob host +local glob host dir dirprefix if zstyle -T ":completion:${curcontext}:files" remote-access; then # Parse options to _remote_files. Stops at the first "--". - zparseopts -D -E -a args / g:=glob h:=host + zparseopts -D -E -a args / g:=glob h:=host W:=dir (( $#host)) && shift host || host="${IPREFIX%:}" args=( ${argv[1,(i)--]} ) @@ -53,9 +56,13 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then cmd_args=( "$@" ) fi + if (( $#dir )); then + dirprefix=${dir}/ + fi + if [[ -z $QIPREFIX ]] - then rempat="${PREFIX%%[^./][^/]#}\*" - else rempat="${(q)PREFIX%%[^./][^/]#}\*" + then rempat="${dirprefix}${PREFIX%%[^./][^/]#}\*" + else rempat="${dirprefix}${(q)PREFIX%%[^./][^/]#}\*" fi # remote filenames @@ -78,12 +85,15 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then remdispf=( ${(M)remdispf:#${~glob[2]}} ) fi + local -a autoremove + [[ -o autoremoveslash ]] && autoremove=(-r "/ \t\n\-") + _tags remote-files while _tags; do while _next_label remote-files expl ${suf:-remote directory}; do [[ -n $suf ]] && compadd "$args[@]" "$expl[@]" -d remdispf -- ${(q)remdispf%[*=|]} && ret=0 - compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd \ + compadd ${suf:+-S/} $autoremove "$args[@]" "$expl[@]" -d remdispd \ -- ${(q)remdispd%/} && ret=0 done (( ret )) || return 0 diff --git a/Completion/Unix/Type/_ssh_hosts b/Completion/Unix/Type/_ssh_hosts index e20142cfd..a4a08ad91 100644 --- a/Completion/Unix/Type/_ssh_hosts +++ b/Completion/Unix/Type/_ssh_hosts @@ -19,11 +19,24 @@ fi if [[ -r $config ]]; then local key line host local -a lines=("${(@f)$(<"$config")}") 2>/dev/null - while (($#lines)); do - IFS=$'=\t ' read -r key line <<<"${lines[1]}" + local -a match_args + local idx=1 + while (( idx <= $#lines )); do + IFS=$'=\t ' read -r key line <<<"${lines[idx]}" + if [[ "$key" == ((#i)match) ]]; then + match_args=(${(z)line}) + while [[ $#match_args -ge 2 ]]; do + if [[ "${match_args[1]}" == (#i)(canonical|final|(|original)host) ]]; then + key="Host" + line="${match_args[2]//,/ }" + break + fi + shift 2 match_args + done + fi case "$key" in ((#i)include) - lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; + lines[idx]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; ((#i)host(|name)) for host in ${(z)line}; do case $host in @@ -31,7 +44,7 @@ if [[ -r $config ]]; then (*) config_hosts+=("$host") ;; esac done ;& - (*) shift lines;; + (*) (( ++idx ));; esac done if (( ${#config_hosts} )); then diff --git a/Completion/Unix/Type/_tar_archive b/Completion/Unix/Type/_tar_archive index e8ddb1e59..bc49c4a3a 100644 --- a/Completion/Unix/Type/_tar_archive +++ b/Completion/Unix/Type/_tar_archive @@ -20,8 +20,10 @@ if [[ "$1" = *[urtx]* ]]; then _files "$expl[@]" -g '*.(tar|TAR).bz2(-.)' elif [[ "$1" = *J* ]]; then _files "$expl[@]" -g '*.(tar|TAR).(lzma|xz)(-.)' - elif [[ "$_cmd_variant[$service]" == (gnu|libarchive) ]]; then - _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|)|(tbz|tgz|txz))(-.)' + elif [[ "$_cmd_variant[$service]" == gnu ]]; then + _files "$expl[@]" -g '*.((tar|TAR)(.gz|.GZ|.Z|.bz2|.lzma|.xz|.zst|lzo|)|(tbz|tgz|txz|tzst|taz|taZ|tz2|tbz2|tlz))(-.)' + elif [[ "$_cmd_variant[$service]" == libarchive ]]; then + _files "$expl[@]" -g '*.((tar|TAR|cpio)(.gz|.GZ|.Z|.bz2|.lzma|.xz|.zst|lzo|)|(tbz|tgz|txz|tzst|tzo|taz|tbz2|tz2|tlz|tZ|7z|ar|iso|deb|cab|lha|mtree|rar|warc|xar|zip))(-.)' else _files "$expl[@]" -g '*.(tar|TAR)(-.)' fi diff --git a/Completion/Unix/Type/_time_zone b/Completion/Unix/Type/_time_zone index cd924bbc7..c437252a8 100644 --- a/Completion/Unix/Type/_time_zone +++ b/Completion/Unix/Type/_time_zone @@ -6,4 +6,4 @@ if (( ! $+_zoneinfo_dirs )); then _zoneinfo_dirs=( /usr/{share,lib,share/lib}/{zoneinfo*,locale/TZ}(/) ) fi -_wanted time-zones expl 'time zone' _files -W _zoneinfo_dirs "$@" - +_wanted time-zones expl 'time zone' _files -g '[A-Z]*' -W _zoneinfo_dirs "$@" - diff --git a/Completion/Unix/Type/_urls b/Completion/Unix/Type/_urls index 5d4990442..f9cdd58cd 100644 --- a/Completion/Unix/Type/_urls +++ b/Completion/Unix/Type/_urls @@ -103,7 +103,7 @@ case "$scheme" in bookmark) if [[ -f "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" && -s "$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}" ]]; then - _wanted -C bookmark bookmarks expl bookmarks \ + _wanted -C bookmark bookmarks expl bookmark \ compadd "$@" -U - \ "$ipre$(<"$urls/$scheme/${(Q)PREFIX}${(Q)SUFFIX}")" && ret=0 else diff --git a/Completion/Unix/Type/_zfs_dataset b/Completion/Unix/Type/_zfs_dataset index 6bef04e45..7edcfd5d7 100644 --- a/Completion/Unix/Type/_zfs_dataset +++ b/Completion/Unix/Type/_zfs_dataset @@ -11,10 +11,12 @@ local expl_type # -t takes arguments (what kinds of datasets) and can appear multiple times zparseopts -D -E e:=expl_type_arr p=paths_allowed r1=rsrc r2=rdst t+:=type -[[ -n $type[(r)fs] ]] && typearg=( filesystem ) -[[ -n $type[(r)vol] ]] && typearg=( $typearg volume ) -[[ -n $type[(r)snap] ]] && typearg=( $typearg snapshot ) -[[ -n $type[(r)share] ]] && typearg=( $typearg share ) +[[ -n $type[(r)fs] ]] && typearg=( filesystem ) +[[ -n $type[(r)vol] ]] && typearg+=( volume ) +[[ -n $type[(r)snap] ]] && typearg+=( snapshot ) +[[ -n $type[(r)share] && $implementation = solaris ]] && typearg+=( share ) +[[ -n $type[(r)bookmark] && $implementation = openzfs ]] && + typearg+=( bookmark ) if [[ -n $typearg ]]; then typearg=( -t ${(j:,:)typearg} ) # We know we're in zfs list if paths_allowed is non-empty. @@ -58,14 +60,14 @@ if [[ ${#rdst} -gt 0 ]]; then fi if [[ -n $type[(r)clone] ]]; then - datasetlist=( ${="$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} ) + datasetlist=( ${(f)"$(zfs list -H -o name,origin -t filesystem 2>/dev/null | awk -F$'\t' "\$2 != \"-\" {print \$1}")":#no cloned filesystems available} ) else - datasetlist=( ${="$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} ) + datasetlist=( ${(f)"$(zfs list -H -o name $typearg 2>/dev/null)":#no datasets available} ) fi expl_type=${typearg[2,-1]//,/\/} if [[ -n $type[(r)mtpt] ]]; then - mlist=( ${="$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} ) + mlist=( ${(f)"$(zfs list -H -o mountpoint $typearg 2>/dev/null)":#no mountpoints available} ) datasetlist=( $datasetlist $mlist ) expl_type="$expl_type/mountpoint" fi @@ -74,4 +76,5 @@ if [[ -n $expl_type_arr[2] ]]; then expl_type=$expl_type_arr[2] fi -_wanted dataset expl "$expl_type" _multi_parts "$@" -q / datasetlist +_description datasets expl "$expl_type" +_multi_parts "$@" "$expl[@]" -q / datasetlist diff --git a/Completion/Unix/Type/_zfs_keysource_props b/Completion/Unix/Type/_zfs_keysource_props deleted file mode 100644 index 01f63257a..000000000 --- a/Completion/Unix/Type/_zfs_keysource_props +++ /dev/null @@ -1,15 +0,0 @@ -#autoload - -local -a suf -local expl - -compset -S ",*" || suf=(-S ,) -if compset -P 1 "*,"; then - _alternative "zfs-keylocator-prompt:\"prompt\" locator:(prompt)" \ - "zfs-keylocator-file:file locator:_path_files" \ - "zfs-keylocator-pkcs11:PKCS#11 locator: " \ - "zfs-keylocator-https:HTTPS URL locator: " -else - _description format expl "keysource format" - compadd $suf -q "$expl[@]" "$@" raw hex passphrase -fi diff --git a/Completion/X/Command/_code b/Completion/X/Command/_code index b725b2a17..76cd3dd19 100644 --- a/Completion/X/Command/_code +++ b/Completion/X/Command/_code @@ -4,7 +4,7 @@ local arguments arguments=( '(-d --diff)'{-d,--diff}'[compare two files with each other]:file to compare:_files:file to compare with:_files' - \*{-a,--add}'[add specified directory to the last active window.]:directory:_directories' + \*{-a,--add}'[add specified directory to the last active window]:directory:_directories' '(-g --goto)'{-g,--goto}'[open a file at the path on the specified line and column position]:file\:line[\:column]:_files -r \:' '(-n --new-window -r --reuse-window)'{-n,--new-window}'[open a new window]' '(-n --new-window -r --reuse-window)'{-r,--reuse-window}'[open a file or directory in the last active window]' diff --git a/Completion/X/Command/_gnome-gv b/Completion/X/Command/_gnome-gv index 25de6fadf..b1b66e2a4 100644 --- a/Completion/X/Command/_gnome-gv +++ b/Completion/X/Command/_gnome-gv @@ -1,6 +1,6 @@ #compdef gnome-gv ggv _arguments \ - '(--help)-\\?[help]' \ + '(--help)-?[help]' \ '(--windows)-w[number of empty windows]:number:' \ '*:file: _pspdf -z' -- diff --git a/Completion/X/Command/_gv b/Completion/X/Command/_gv index cde8a1c1a..9b11ad31c 100644 --- a/Completion/X/Command/_gv +++ b/Completion/X/Command/_gv @@ -28,8 +28,11 @@ _arguments \ '(--portrait --seascape --upsidedown)--landscape' \ '(--portrait --landscape --upsidedown)--seascape' \ '(--portrait --landscape --seascape)--upsidedown' \ - --{help,spartan} \ -{h,v} \ + -{,-}{help,version} \ + -{,-}{spartan,widgetless,presentation,fullscreen} \ + -{,-}{infoSilent,infoErrors,infoAll} \ + -{,-}'password=:password:' \ '--arguments=:ghostscript arguments:' \ '--page=:label of first page:' \ '--media=:page size:(Letter Legal Statement Tabloid Ledger Folio Quarto 10x14 Executive A3 A4 A5 B4 B5)' \ diff --git a/Completion/X/Command/_kdeconnect b/Completion/X/Command/_kdeconnect index ffb7f5774..ee186690c 100644 --- a/Completion/X/Command/_kdeconnect +++ b/Completion/X/Command/_kdeconnect @@ -10,7 +10,7 @@ _arguments \ '--id-only[make --list-devices or --list-available print only the devices id, to ease scripting]' \ '--refresh[search for devices in the network and re-establish connections]' \ '(--pair --unpair)--pair[request pairing with the specified device]' \ - '--ring[find the device by ringing it.]' \ + '--ring[find the device by ringing it]' \ '(--pair --unpair)--unpair[stop pairing to the specified device]' \ '(--ping --ping-msg)--ping[send a ping to the device]' \ '(--ping --ping-msg)--ping-msg[send a ping to the device with the specified message]:message' \ diff --git a/Completion/X/Command/_mozilla b/Completion/X/Command/_mozilla index 64f4d9450..0be25b8d3 100644 --- a/Completion/X/Command/_mozilla +++ b/Completion/X/Command/_mozilla @@ -95,7 +95,7 @@ if [[ "$state" = "remote" ]]; then ;; *) compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}" - _wanted commands expl 'remote commands' \ + _wanted commands expl 'remote command' \ compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \ remote_commands && ret=0 ;; diff --git a/Completion/X/Command/_mplayer b/Completion/X/Command/_mplayer index a913960fe..1f99a1789 100644 --- a/Completion/X/Command/_mplayer +++ b/Completion/X/Command/_mplayer @@ -131,13 +131,13 @@ case "$state" in ;; audio-drivers) vals=( help ${${${(f)"$(_call_program audio-drivers mplayer -ao help 2>/dev/null)"}[(r) *,-1]#?}/ /:} ) - _describe -t audio-drivers 'audio drivers' vals && ret=0 + _describe -t audio-drivers 'audio driver' vals && ret=0 ;; audio-codec-families) compset -P '*,' compset -S ',*' vals=( help ${${${(f)"$(_call_program audio-codec-families mplayer -afm help 2>/dev/null)"}[(r) [^:]#,-1]## ##}/ ##/:} ) - _describe -t audio-codec-families 'audio drivers' vals && ret=0 + _describe -t audio-codec-families 'audio driver' vals && ret=0 ;; audio-plugins) _values -s : 'audio output plugin' \ @@ -154,7 +154,7 @@ case "$state" in ;; video-drivers) vals=( help ${${${(f)"$(_call_program video-drivers mplayer -vo help 2>/dev/null)"}[(r) *,-1]#?}/ /:} ) - _describe -t video-drivers 'video drivers' vals && ret=0 + _describe -t video-drivers 'video driver' vals && ret=0 ;; video-output-plugins) vals=( help ${${${${(f)"$(_call_program video-output-plugins mplayer -vop help 2>/dev/null)"}[(r) *,-1]}/ /}/ #: /:} ) diff --git a/Completion/X/Command/_netscape b/Completion/X/Command/_netscape index e1d02ae90..78b2da649 100644 --- a/Completion/X/Command/_netscape +++ b/Completion/X/Command/_netscape @@ -52,7 +52,7 @@ if [[ "$state" = "remote" ]]; then ;; *) compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}" - _wanted commands expl 'remote commands' \ + _wanted commands expl 'remote command' \ compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \ remote_commands && ret=0 ;; diff --git a/Completion/X/Command/_pdftk b/Completion/X/Command/_pdftk index b8c43f754..b26deb15f 100644 --- a/Completion/X/Command/_pdftk +++ b/Completion/X/Command/_pdftk @@ -24,7 +24,7 @@ case $words[CURRENT-1] in (allow) #_description permissions expl "permission" #compadd $expl \ - _values -s , permissions \ + _values -s , permission \ Printing DegradedPrinting ModifyContents Assembly CopyContents \ ScreenReaders ModifyAnnotations FillIn AllFeatures ;; @@ -34,13 +34,11 @@ case $words[CURRENT-1] in ;; (fill_form) - _description files expl 'FDF and XFDF files' - _files "$@" $expl -g '(#i)*.(fdf|xfdf)' + _wanted files expl 'FDF or XFDF file' _files -g '(#i)*.(fdf|xfdf)(-.)' ;; ((multibackground|background|stamp|multistamp|output)) - _description files expl 'PDF files' - _files "$@" $expl -g '(#i)*.pdf' + _pdf ;; (update_info) @@ -53,11 +51,11 @@ case $words[CURRENT-1] in esac && return 0 if [[ -n $words[(r)(${(j:|:)operations})] ]]; then - _description options expl "options" + _description options expl "option" compadd $@ $expl $opts else _tags files operations _alternative \ - 'files:PDF files:_pdfwithhandle' \ - "operations:operations:($operations)" + 'files:PDF file:_pdfwithhandle' \ + "operations:operation:($operations)" fi diff --git a/Completion/X/Command/_sublimetext b/Completion/X/Command/_sublimetext index 1243d2779..5382e5dbc 100644 --- a/Completion/X/Command/_sublimetext +++ b/Completion/X/Command/_sublimetext @@ -8,6 +8,8 @@ _arguments -s -S : \ '(-a -n --add --new-window)'{-n,--new-window}'[open new window]' \ '--project[load specified project]:project file:_files' \ '(-s --stay)'{-s,--stay}'[keep application activated]' \ + '--safe-mode[launch using sandboxed (clean) environment]' \ + '--launch-or-new-window[only open new window if application is open]' \ '(: -)'{-v,--version}'[display version information]' \ '(-w --wait)'{-w,--wait}'[wait for files to close]' \ '*:file or directory:_files' diff --git a/Completion/X/Command/_urxvt b/Completion/X/Command/_urxvt index 661897c3a..2d7c09579 100644 --- a/Completion/X/Command/_urxvt +++ b/Completion/X/Command/_urxvt @@ -43,8 +43,8 @@ _x_arguments \ '-sl:save lines' \ '-embed:window id to embed terminal in:_x_window' \ '-pty-fd:file descriptor of pty to use' \ - '-w:external border in pixels' \ - '-b:internal border in pixels' \ + {-bw,-w}':external border (pixels)' \ + '-b:internal border (pixels)' \ '-lsp:number of extra pixels between rows' \ '-letsp:letter spacing adjustment' \ '-mod:meta modifier:_x_modifier' \ diff --git a/Completion/X/Command/_vnc b/Completion/X/Command/_vnc index d60616f21..7d818cfe7 100644 --- a/Completion/X/Command/_vnc +++ b/Completion/X/Command/_vnc @@ -65,10 +65,10 @@ case $service in '-rfbauth[use authentication on RFB protocol]:passwd-file:_files' \ '-httpd[serve files via HTTP from here]:dir:_files -/' \ '-httpport[port for HTTP]:port:' \ - '-deferupdate[time in ms to defer updates (default 40)]:time (ms):' \ + '-deferupdate[specify time to defer updates by]:time (ms) [40]' \ '-economictranslate[less memory-hungry translation]' \ '-lazytight[disable "gradient" filter in tight encoding]' \ - '-desktop[VNC desktop name (default x11)]:name:' \ + '-desktop[specify VNC desktop name]:name [x11]' \ '-alwaysshared[always treat new clients as shared]' \ '-nevershared[never treat new clients as shared]' \ "-dontdisconnect[don't disconnect existing clients for new non-shared connections]" \ @@ -86,7 +86,7 @@ case $service in ;; *vncviewer) _xt_arguments -shared -viewonly -fullscreen -bgr233 -owncmap -truecolour \ - '-encodings:encodings:_values -s " " encoding copyrect hextile corre rre raw' \ + '-encodings: :_values -s " " encoding copyrect hextile corre rre raw' \ '-depth:depth' \ '-passwd:file:_files' \ '(1)-listen:display number' \ diff --git a/Completion/X/Command/_xauth b/Completion/X/Command/_xauth index 14dfc8400..22ebffecd 100644 --- a/Completion/X/Command/_xauth +++ b/Completion/X/Command/_xauth @@ -41,7 +41,7 @@ while [[ -n "$state" ]]; do group) _message -e ids 'group-id';; data) _message -e values 'hexdata';; *) - _wanted options expl 'xauth generate options' \ + _wanted options expl 'xauth generate option' \ compadd trusted untrusted timeout group data && ret=0 ;; esac diff --git a/Completion/X/Command/_xdvi b/Completion/X/Command/_xdvi index d55c99485..c33e67bcc 100644 --- a/Completion/X/Command/_xdvi +++ b/Completion/X/Command/_xdvi @@ -9,7 +9,7 @@ _xt_arguments \ '-cr:cursor color:_x_color' \ '-debug:debugging bitmask:((1\:bitmaps 2\:dvi\ translation 4\:pk\ reading 8\:batch\ operation 16\:events 32\:file\ opening 64\:PostScript\ communication 128\:Kpathsea\ statistics 256\:Kpathsea\ hash\ table\ lookups 512\:Kpathsea\ path\ definitions 1024\:Kpathsea\ path\ expansion 2048\:Kpathsea\ searches))' \ '-density:font shrink density' \ - '-gamma:anti-aliasing factor (default 1.0)' \ + '-gamma:anti-aliasing factor [1.0]' \ -grid{1,2,3}':grid color:_x_color' \ '-gspalette:Ghostscript palette:(Color Greyscale Monochrome)' \ '-hl:page highlight color:_x_color' \ diff --git a/Completion/X/Command/_xinput b/Completion/X/Command/_xinput new file mode 100644 index 000000000..2bbadd65a --- /dev/null +++ b/Completion/X/Command/_xinput @@ -0,0 +1,139 @@ +#compdef xinput + +local curcontext="$curcontext" xinput=${words[1]} desc subcmd out ret=1 +local match mbegin mend +local -a state state_descr line args cmds ids names disp expl +local -A opt_args + +cmds=( + 'get-feedbacks:display device feedbacks' + 'set-ptr-feedback:change pointer acceleration (or feedback) parameters ' + 'set-integer-feedback:change value of an integer device feedback' + 'get-button-map:get the button mapping of a device' + 'set-button-map:change the button mapping of a device' + set-pointer + "set-mode:set a device's mode" + 'list:list input devices or device features' + "query-state:query a device's state" + 'test:perpetual display of extended events from a device' + 'create-master:create a new pair of master devices on an XI2-enabled server' + 'remove-master:remove a master and its paired master device' + 'reattach:reattach a slave to a master' + 'float:remove a slave from its current master device' + 'set-cp:set the ClientPointer for the client owning window to master' + 'test-xi2:perpetual display of XI2 events' + 'map-to-output:restrict movements of the absolute device to an RandR crtc' + 'list-props:list properties that can be set for a device' + set-int-prop set-float-prop set-atom-prop + 'watch-props:perpetual display of property changes' + 'delete-prop:delete a property from a device' + 'set-prop:set a property to a given value' + 'disable:disable a device' + 'enable:enable a device' + 'help:display usage information' + 'version:display version information for program and server' +) + +if (( CURRENT == 2 )); then + if [[ -prefix - ]]; then + cmds=( --$^cmds ) + desc=option + else + desc=command + fi + _describe -t ${desc}s $desc cmds -M 'r:|-=* r:|=*' + return +fi + +subcmd=${words[2]#--} +curcontext="${curcontext%:*}-$subcmd:" + +args=( '1:device:->devices' ) +case $subcmd in + (set|delete)-*prop) args+=( '2:property:->properties' ) ;| + set-*prop) args+=( '*:value' ) ;| + set-ptr-feedback) args+=( '2:threshold' '3:num' '4:denom' ) ;; + set-integer-feedback) args+=( '2:feedback id' '3:value' ) ;; + set-button-map) + args+=( '*:::button mapping:compadd -F words -o numeric {1..12}' ) + ;; + set-pointer) args+=( '2:x index' '3:y index' ) ;; + set-mode) args+=( '2:mode:(ABSOLUTE RELATIVE)' ) ;; + list) args+=( '(-)--short' '(-)--long' '(-)--name-only' '(-)--id-only' ) ;; + test) args+=( '-proximity' ) ;; + create-master) + args=( + '1:prefix' + '2:send core events [1]:((0\:false 1\:true))' + '3:enable [1]:((0\:false 1\:true))' + ) + ;; + remove-master) + args=( + '1:master:->devices' + '2:slave setting:(Floating AttachToMaster)' + '3:pointer master:->devices' + '4:keyboard master:->devices' + ) + ;; + reattach) args=( '1:slave:->devices' '2:master:->devices' ) ;; + float) args=( '1:slave:->devices' ) ;; + set-cp) args=( '1:window:_x_window' '2:device:->devices' ) ;; + test-xi2) args+=( '--root[select events on the root window only]' ) ;; + map-to-output) args+=( '2:output:->outputs' ) ;; + list-props) args=( '*:device:->devices' ) ;; + set-int-prop) args+=( '3:format:compadd -o numeric 8 16 32' ) ;; + set-prop) + args+=( + '--type=-:type:(atom float int)' + '--format=-:format:compadd -o numeric 8 16 32' + ) + ;; + help|version) _message 'no more arguments'; return 1 ;; +esac + +shift words +(( CURRENT-- )) +_arguments -C -A "-*" $args && ret=0 + +case $state in + devices) + _description input-devices expl $state_descr + + ids=( ${${(f)"$(_call_program input-devices $xinput list --id-only)"}#? } ) + names=( ${${(f)"$(_call_program input-devices $xinput list --name-only)"}#? } ) + disp=( ${(f)"$(_call_program input-devices $xinput list --short)"} ) + + if [[ $PREFIX$SUFFIX = [^-]*[^0-9]* ]]; then + # match based on the names but insert IDs + compadd "$expl[@]" -M 'b:=* m:{[:lower:]}={[:upper:]}' -D ids -D disp -a names + compadd "$expl[@]" -U -ld disp -a ids && ret=0 + + zstyle -s ":completion:${curcontext}:input-devices" insert-ids out || out=menu + case "$out" in + menu) compstate[insert]=menu ;; + single) [[ $#ids -ne 1 && $compstate[insert] != menu ]] && + compstate[insert]= ;; + *) [[ ${#:-$PREFIX$SUFFIX} -gt ${#compstate[unambiguous]} ]] && + compstate[insert]=menu ;; + esac + else + compadd "$expl[@]" -M 'B:0=' -o nosort -ld disp -a ids && ret=0 + fi + ;; + properties) + _description input-properties expl 'property' + disp=( ${${${${(M)${(f)"$(_call_program input-properties + $xinput list-props $line[1] + )"}:#[[:blank:]]*}##[[:blank:]]#}%%:*}:/(#b)(*) \((<->)\)/$match[2]:$match[1]} + ) + _describe -t input-properties $state_descr disp -o numeric && ret=0 + ;; + outputs) + _description outputs expl 'output' + compadd "$expl[@]" - ${${(M)${(f)"$(_call_program outputs + xrandr)"}:#* connected*}%% *} && ret=0 + ;; +esac + +return ret diff --git a/Completion/X/Command/_xournal b/Completion/X/Command/_xournal index 066ef55f5..c36210c26 100644 --- a/Completion/X/Command/_xournal +++ b/Completion/X/Command/_xournal @@ -2,5 +2,5 @@ local expl -_description files expl 'PDF and Xournal files' +_description files expl 'PDF or Xournal file' _files "$@" "$expl[@]" -g '*.(#i){xoj,pdf}(-.)' diff --git a/Completion/X/Command/_xrandr b/Completion/X/Command/_xrandr index 67045b33d..2551e1958 100644 --- a/Completion/X/Command/_xrandr +++ b/Completion/X/Command/_xrandr @@ -1,6 +1,6 @@ #compdef xrandr -local curcontext="$curcontext" state line expl +local curcontext="$curcontext" state line expl state_descr typeset -A opt_args _arguments -C \ @@ -36,6 +36,7 @@ _arguments -C \ '*--set:property:(Backlight scaling\ mode):value:->value' \ '*--scale:output scaling:' \ '*--transform:transformation matrix:' \ + '*--filter:mode:(nearest bilinear)' \ '*--off[disable the output]' \ '*--crtc:crtc to use:' \ '*--panning:panning:' \ @@ -47,8 +48,8 @@ _arguments -C \ "*--addmode:output:->outputs:name" \ "*--delmode:output:->outputs:name" \ '--listproviders' \ - '--setprovideroutputsource:provider: :source' \ - '--setprovideroffloadsink:provider: :sink' \ + '--setprovideroutputsource:provider:->providers:source:->providers' \ + '--setprovideroffloadsink:provider:->providers:sink:->providers' \ '--listmonitors' \ '--listactivemonitors' \ '--setmonitor:name' \ @@ -75,4 +76,8 @@ case $state in _wanted modes expl mode compadd \ ${(Mun)$(_call_program modes xrandr):#[0-9]##x[0-9]##} && return 0 ;; + providers) + local -a xrandr_providers=(${(f)"$(_call_program providers xrandr --listproviders)"}) + _wanted xrandr-providers expl $state_descr compadd ${${xrandr_providers}[2,-1]##*:} && return 0 + ;; esac diff --git a/Completion/X/Command/_xset b/Completion/X/Command/_xset index b35a6466b..adda47f01 100644 --- a/Completion/X/Command/_xset +++ b/Completion/X/Command/_xset @@ -91,8 +91,8 @@ _regex_arguments _xset_parse \ \( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \ ':option-s:screen saver:(blank noblank expose noexpose default on activate reset off)' \ \| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:(off)' \| \) \ - \| "/[0-9]##$nul/" ':option-s-timeout:length:' \ - \( "/[0-9]##$nul/" ':option-s-period:period:' \ + \| "/[0-9]##$nul/" ':option-s-timeout: :_numbers -u seconds length' \ + \( "/[0-9]##$nul/" ':option-s-period: :_numbers -u seconds period' \ \| \) \ \| \) \ \| "/-r$nul/" "$guard" \ diff --git a/Completion/X/Command/_xterm b/Completion/X/Command/_xterm index 6d98985e7..180c2eb21 100644 --- a/Completion/X/Command/_xterm +++ b/Completion/X/Command/_xterm @@ -3,7 +3,7 @@ _xt_arguments \ -+{132,ah,ai,aw,bc,bdc,cb,cjk_width,cm,cn,cu,dc,fbb,fbx,fullscreen,hf,hm,hold,ie,im,itc,j,k8,l,lc,ls,maximized,mb,mesg,mk_width,nul,pc,pob,rvc,rw,s,samename,sb,sf,si,sk,sm,sp,t,u8,uc,ulc,ulit,ut,vb,wc,wf} \ -{version,help,leftbar,rightbar,C} \ - '-report-'{charclass,colors,fonts} \ + '-report-'{charclass,colors,fonts,icons,xres} \ '-T:title' \ '-b:inner border size:' \ '-baudrate:rate [38400]' \ diff --git a/Completion/X/Type/_x_color b/Completion/X/Type/_x_color index 960eae6d3..845a35686 100644 --- a/Completion/X/Type/_x_color +++ b/Completion/X/Type/_x_color @@ -10,25 +10,28 @@ local expl -if (( ! $+_color_cache )); then +if (( ! $+_cache_x_colors )); then + typeset -ga _cache_x_colors local file # Cache of color names doesn't exist yet, create it. zstyle -s ":completion:${curcontext}:colors" path file if [[ -n "$file" ]]; then - _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) + _cache_x_colors=( "${(@)${(@f)$(< $file)}[2,-1]##* }" ) + elif (( $+commands[showrgb] )); then + _cache_x_colors=( "${(@)${(@)${(@f)$(_call_program colors showrgb)}[2,-1]##* }:#* *}" ) else file=( /usr/{lib,{{X11R6,openwin},local{,/X11{,R6}}}/lib}/X11/rgb.txt(N) ) (( $#file )) && - _color_cache=( "${(@)${(@)${(@f)$(< $file[1])}[2,-1]##* }:#* *}" ) + _cache_x_colors=( "${(@)${(@)${(@f)$(< $file[1])}[2,-1]##* }:#* *}" ) fi # Stupid default value. - (( $#_color_cache )) || _color_cache=(white black gray red blue green) + (( $#_cache_x_colors )) || _cache_x_colors=(white black gray red blue green) fi _wanted colors expl 'color specification' compadd "$@" -M \ - 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a - _color_cache + 'm:{a-z}={A-Z} m:-=\ r:[^ A-Z0-9]||[ A-Z0-9]=* r:|=*' -a - _cache_x_colors diff --git a/Completion/Zsh/Command/_bindkey b/Completion/Zsh/Command/_bindkey index 81ae69974..df9c8f225 100644 --- a/Completion/Zsh/Command/_bindkey +++ b/Completion/Zsh/Command/_bindkey @@ -27,7 +27,7 @@ _arguments -C -s -S \ '(-l -L -d -D -A -N -m -p -r *)-s[bind each in-string to each out-string]:*:key string' \ '(-e -v -a -M -l -L -d -D -A -N -m -p)-R[interpret in-strings as ranges]' \ '(-l -L -d -A -N -m -p -r -s):in-string' \ - '(-l -L -d -A -N -m -p -r -s)*::widgets:_widgets' && ret=0 + '(-l -L -d -A -N -m -p -r -s)*::widget:_widgets' && ret=0 case $state in keymap) diff --git a/Completion/Zsh/Command/_compadd b/Completion/Zsh/Command/_compadd index 781fa2af8..4456cf71e 100644 --- a/Completion/Zsh/Command/_compadd +++ b/Completion/Zsh/Command/_compadd @@ -1,47 +1,94 @@ -#compdef compadd +#compdef compadd -P _* -local curcontext="$curcontext" state line ret=1 +local curcontext="$curcontext" ret=1 +local -a state line args typeset -A opt_args -_arguments -C -s -S -A "-*" \ - '-P+[specify prefix]:prefix' \ - '-S+[specify suffix]:suffix' \ - '-p+[specify hidden prefix]:hidden prefix' \ - '-s+[specify hidden suffix]:hidden suffix' \ - '-i+[specify ignored prefix]:ignored prefix' \ - '-I+[specify ignored suffix]:ignored suffix' \ - '(-k)-a[matches are elements of specified arrays]' \ - '(-a)-k[matches are keys of specified associative arrays]' \ - '-d+[specify display strings]:array:_parameters -g "*array*"' \ - '-l[list display strings one per line, not in columns]' \ +args=( + '-P+[specify prefix]:prefix' + '-S+[specify suffix]:suffix' + '-p+[specify hidden prefix]:hidden prefix' + '-s+[specify hidden suffix]:hidden suffix' + '-i+[specify ignored prefix]:ignored prefix' + '-I+[specify ignored suffix]:ignored suffix' '-o[specify order for matches by match string not by display string]:: : _values -s , order "match[order by match not by display string]" "nosort[matches are pre-ordered]" "numeric[order numerically]" - "reverse[order backwards]"' \ - '(-1 -E)-J+[specify match group]:group' \ - '!-V+:group' \ - '(-J -E)-1[remove only consecutive duplicates from group]' \ - '-2[preserve all duplicates]' \ - '(-x)-X[specify explanation]:explanation' \ - '(-X)-x[specify unconditional explanation]:explanation' \ - '-q[make suffix autoremovable]' \ - '-r+[specify character class for suffix autoremoval]:character class' \ - '-R+[specify function for suffix autoremoval]:function:_functions' \ - '-f[mark matches as being files]' \ - '-e[mark matches as being parameters]' \ - '-W[specify location for matches marked as files]' \ - '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"' \ - '-Q[disable quoting of possible completions]' \ - '*-M[specify matching specifications]' \ - '-n[hide matches in completion listing]' \ - '-U[disable internal matching of completion candidates]' \ - '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"' \ - '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"' \ - '-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"' \ - '-C[add special match that expands to all other matches]' \ - '(-1 -J)-E+[add specified number of display only matches]:number' \ - '*:candidate:->candidates' && ret=0 + "reverse[order backwards]"' + '(-1 -E)-J+[specify match group]:group' + '!-V+:group' + '(-J -E)-1[remove only consecutive duplicates from group]' + '-2[preserve all duplicates]' + '(-x)-X[specify explanation]:explanation' + '(-X)-x[specify unconditional explanation]:explanation' + '-q[make suffix autoremovable]' + '-r+[specify character class for suffix autoremoval]:character class' + '-R+[specify function for suffix autoremoval]:function:_functions' + '-F+[specify array of ignore patterns]:array:_parameters -g "*array*"' + '-Q[disable quoting of possible completions]' + '*-M[specify matching specifications]' + '-n[hide matches in completion listing]' + '-O+[populate array with matches instead of adding them]:array:_parameters -g "*array*"' + '-A+[populate array with expanded matches instead of adding them]:array:_parameters -g "*array*"' + '*-D+[delete elements from array corresponding to non-matching candidates]:array:_parameters -g "*array*"' +) + +case $service in + compadd|_(path_|)files) + args+=( + '-W[specify location for matches marked as files]' + ) + ;| + compadd) + args+=( + '(-k)-a[matches are elements of specified arrays]' + '(-a)-k[matches are keys of specified associative arrays]' + '-d+[specify display strings]:array:_parameters -g "*array*"' + '-l[list display strings one per line, not in columns]' + '-f[mark matches as being files]' + '-e[mark matches as being parameters]' + '-C[add special match that expands to all other matches]' + '(-1 -J)-E+[add specified number of display only matches]:number' + '-U[disable internal matching of completion candidates]' + '*:candidate:->candidates' + ) + ;; + _dates) + args=( ${args:#([(][^)]##\)|)-[12noOAD]*} + '-f[specify format for matches]:format:_date_formats' + '-F[select a future rather than past date]' + ) + ;; + _(path_|)files) + args=( ${args:#([(][^)]##\)|)-[OAD]*} + '-g+[specify file glob pattern]:glob pattern' + '-/[complete only directories]' + ) + ;; + _parameters) + args+=( + '-g+[specify pattern to filter parameter type by]:pattern' + ) + ;; + _pids) + args+=( '-m+[pattern to filter process command line by]:pattern' ) + ;; + _process_names) + args+=( + '-a[include all processes]' + '-t[use truncated process names]' + ) + ;; + _sys_calls) + args+=( + '-a[add "all" as an additional match]' + '-n[add "none" as an additional match]' + ) + ;; +esac + +_arguments -C -s -S -A "-*" $args && ret=0 if [[ -n $state ]]; then if (( $+opt_args[-a] )); then diff --git a/Completion/Zsh/Command/_disable b/Completion/Zsh/Command/_disable index 52b82a6e9..da3803039 100644 --- a/Completion/Zsh/Command/_disable +++ b/Completion/Zsh/Command/_disable @@ -7,10 +7,10 @@ sali_arr=(${(k)saliases}) func_arr=(${(k)functions}) _arguments -C -s -A "-*" -S \ - "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global aliases:compadd -k ali_arr" \ - "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \ - "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k reswords" \ - "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \ - "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k patchars" \ + "(-f -r -s -p)-a[act on regular or global aliases]:*:regular or global alias:compadd -k ali_arr" \ + "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \ + "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k reswords" \ + "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \ + "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k patchars" \ '-m[treat arguments as patterns]' \ "*:builtin command:(${(k)builtins})" diff --git a/Completion/Zsh/Command/_enable b/Completion/Zsh/Command/_enable index 9410651b7..b62619d89 100644 --- a/Completion/Zsh/Command/_enable +++ b/Completion/Zsh/Command/_enable @@ -7,10 +7,10 @@ sali_arr=(${(k)dis_saliases}) func_arr=(${(k)dis_functions}) _arguments -C -s -A "-*" -S \ - "(-f -r -s -p)-a[act on regular or global aliases]:*:aliases:compadd -k ali_arr" \ - "(-a -r -s -p)-f[act on functions]:*:functions:compadd -k func_arr" \ - "(-a -f -s -p)-r[act on reserved words]:*:reserved-words:compadd -k dis_reswords" \ - "(-a -f -r -p)-s[act on suffix aliases]:*:suffix aliases:compadd -k sali_arr" \ - "(-a -f -r -s)-p[act on pattern characters]:*:pattern characters:compadd -k dis_patchars" \ + "(-f -r -s -p)-a[act on regular or global aliases]:*:alias:compadd -k ali_arr" \ + "(-a -r -s -p)-f[act on functions]:*:function:compadd -k func_arr" \ + "(-a -f -s -p)-r[act on reserved words]:*:reserved-word:compadd -k dis_reswords" \ + "(-a -f -r -p)-s[act on suffix aliases]:*:suffix alias:compadd -k sali_arr" \ + "(-a -f -r -s)-p[act on pattern characters]:*:pattern character:compadd -k dis_patchars" \ '-m[treat arguments as patterns]' \ "*:builtin command:(${(k)dis_builtins})" diff --git a/Completion/Zsh/Command/_fc b/Completion/Zsh/Command/_fc index dd014e7d7..80e570c5d 100644 --- a/Completion/Zsh/Command/_fc +++ b/Completion/Zsh/Command/_fc @@ -59,7 +59,8 @@ case $service in ;; *) _arguments "$fc_common[@]" "$fc_hist[@]" "$fc_r" \ - '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ + '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P -s)-e+[specify editor to invoke]:editor to invoke:_command_names -e' \ + '(-A -R -W -a -l -n -d -f -E -i -r -t -D -p -P -e)-s[re-execute command without invoking editor (like -e-)]' \ '(-a -l -L -m -e -r -n -d -f -t -E -i -R -D -A -W -p -P *)-'{\ 'R[read history from file]',\ 'A[append history to file]',\ diff --git a/Completion/Zsh/Command/_sched b/Completion/Zsh/Command/_sched index e8ff5ab87..888708684 100644 --- a/Completion/Zsh/Command/_sched +++ b/Completion/Zsh/Command/_sched @@ -10,7 +10,7 @@ if [[ CURRENT -eq 2 ]]; then else disp=() fi - [[ -z $lines ]] || _wanted jobs expl 'scheduled jobs' \ + [[ -z $lines ]] || _wanted jobs expl 'scheduled job' \ compadd "$disp[@]" - {1..$#lines} return else diff --git a/Completion/Zsh/Command/_strftime b/Completion/Zsh/Command/_strftime index 0849f1c85..a57a76ce4 100644 --- a/Completion/Zsh/Command/_strftime +++ b/Completion/Zsh/Command/_strftime @@ -1,14 +1,16 @@ #compdef strftime -local ret=1 expl +local expl two='epoch time' + +if (( words[(I)-r] )); then + two='date string' +fi _arguments -S -A '-*' -s \ + '-n[omit trailing newline]' \ '-q[run quietly]' \ '(3)-r[reverse lookup using strptime]' \ '-s+[assign result to parameter]:param:_parameters' \ '1:format: _date_formats zsh' \ - '2:epoch time (or date string with -r)' \ + "2:$two" \ '3:nanoseconds' \ -&& ret=0 - -return ret diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset index ae33ae539..058842378 100644 --- a/Completion/Zsh/Command/_typeset +++ b/Completion/Zsh/Command/_typeset @@ -1,6 +1,6 @@ #compdef autoload declare export functions integer float local readonly typeset -local expl state line func i use curcontext="$curcontext" +local expl state state_descr line func i use curcontext="$curcontext" ret=1 local fopts="-f -k -z +k +z" local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x" local -A allargs opt_args @@ -69,8 +69,8 @@ case ${service} in allargs[i]='-i+[specify arithmetic base for output]:: :_guard "[0-9]#" base' \ ;; readonly) use="${use/r/}" ;; - local) use="${use/[fkz]/}" ;& - export) use="${${use//[gkz]/}/x/}" ;; + local) use="${use//[fgkz]/}" ;; + export) use="${use//[fgkxz]/}" ;; esac [[ -z "${words[(r)-*[aA]*]}" ]] || func=p @@ -79,38 +79,38 @@ esac # This function uses whacky features of _arguments which means we # need to look for options to the command beforehand. local onopts offopts -onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}} +onopts=${(j..)${${words[1,CURRENT-1]:#^-[^-]*}##-}} offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}} for ((i=1;i<=$#use;++i)); do args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[dUurRtT]]:+$func}]} ) done -_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq' +_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq' && ret=0 if [[ "$state" = vars_eq ]]; then if [[ $func = f ]]; then if (( $+opt_args[+M] || ( $+opt_args[-M] && $+opt_args[-m] ) )); then _wanted functions expl 'math function' compadd -F line - \ - ${${${(f)"$(functions -M)"}##*-M }%% *} + ${${${(f)"$(functions -M)"}##*-M }%% *} && ret=0 elif (( $+opt_args[-M] )); then _arguments ':new math function:_functions' \ ":minimum arguments${(k)opt_args[-s]:+:(1)}" \ ":maximum arguments${(k)opt_args[-s]:+:(1)}" \ - ':shell function:_functions' + ':shell function:_functions' && ret=0 elif (( $+opt_args[-w] )); then - _wanted files expl 'zwc file' _files -g '*.zwc(-.)' + _wanted files expl 'zwc file' _files -g '*.zwc(-.)' && ret=0 elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then - if [[ $PREFIX[1] = [/~] ]]; then + if [[ ${"${(e)PREFIX}"[1]} = [/~] ]] && _files; then # Autoload by absolute path - _files + ret=0 else args=(${^fpath}/*(-.:t)) # Filter out functions already loaded or marked for autoload. local -a funckeys funckeys=(${(k)functions}) args=(${args:|funckeys}) - _wanted functions expl 'shell function' compadd -a args + _wanted functions expl 'shell function' compadd -a args && ret=0 fi elif [[ -n $onopts$offopts ]]; then if [[ -n $offopts ]]; then @@ -127,22 +127,23 @@ if [[ "$state" = vars_eq ]]; then [[ $PREFIX != [_.]* ]]; then args=(${args:#_*}) fi - _wanted functions expl 'shell functions' compadd -a args + _wanted functions expl 'shell function' compadd -a args && ret=0 else - _functions + _functions && ret=0 fi elif [[ "$PREFIX" = *\=* ]]; then compstate[parameter]="${PREFIX%%\=*}" compset -P 1 '*=' - _value + _value && ret=0 elif (( $+opt_args[-a] || $+opt_args[-A] )); then - _parameters -q + _parameters -q && ret=0 elif (( $+opt_args[-T] )); then _arguments \ ':scalar parameter:_parameters -g "*scalar*" -q -S "="' \ ':array parameter:_parameters -g "*array*"' \ - ':separator character' + ':separator character' && ret=0 else - _parameters -q -S '=' + _parameters -q -S '=' && ret=0 fi fi +return ret diff --git a/Completion/Zsh/Command/_zed b/Completion/Zsh/Command/_zed index 6b68fadf0..f84993d73 100644 --- a/Completion/Zsh/Command/_zed +++ b/Completion/Zsh/Command/_zed @@ -1,10 +1,16 @@ -#compdef zed fned +#compdef zed fned histed case $service in (fned) _arguments -S : ':shell function:_functions';; +(histed) _arguments -S : \ + '1:history file:_files' \ + '2:history size: ';; (zed) _arguments -S : \ - '(- 2):file:_files' \ - '(1):shell function:_functions' \ - '(1)-x+[specify spaces to use for indentation in function expansion]:spaces' \ - '(1)-f[edit function]';; + '(-h 1 3 4)-f[edit function]' \ + '(-h 1 3 4)-x+[specify spaces to use for indentation in function expansion]:spaces' \ + '(-f -x 1 2)-h[edit history]' \ + '(- 2 3 4)1:file:_files' \ + '(3 4)2:shell function:_functions' \ + '3:history file:_files -g "*(D)"' \ + '4:history size';; esac diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle index e01d0a943..0b8ef7a15 100644 --- a/Completion/Zsh/Command/_zle +++ b/Completion/Zsh/Command/_zle @@ -51,11 +51,11 @@ case "$state[1]" in ;; (widget*) _wanted -C "$context[1]" widgets expl "${state_descr[1]:-widget}" _widgets && ret=0 - ;& - (function) - [[ $state[1] != *function ]] || # Handle fall-through + ;| + (*function) _wanted -C "$context[1]" functions expl 'widget shell function' \ - compadd -M 'r:|-=* r:|=*' -k functions && ret=0 + compadd -M 'r:|-=* r:|=*' -k functions && + ret=0 ;; (comp-widget) _wanted -C "$context[1]" widgets expl 'completion widget' \ diff --git a/Completion/Zsh/Command/_zmodload b/Completion/Zsh/Command/_zmodload index 3416d50c6..f3e38c0f6 100644 --- a/Completion/Zsh/Command/_zmodload +++ b/Completion/Zsh/Command/_zmodload @@ -23,7 +23,7 @@ _arguments -n -C -S -s \ '(-e -u)-L[output in the form of calls to zmodload]' \ '(-b -c -d -I -f -F -P -l -m -A -R)-p[autoload module for parameters]' \ '(-u -b -c -d -p -f -A -R)-P[array param for features]:array name:_parameters' \ - '(-)*:params:->params' && ret=0 + '(-)*:param:->params' && ret=0 [[ $state = params ]] || return ret @@ -66,7 +66,7 @@ else while _tags; do _requested builtins expl 'builtin command' \ compadd "$@" -k builtins && ret=0 - _requested loadedmodules expl 'loaded modules' \ + _requested loadedmodules expl 'loaded module' \ compadd -k 'modules[(R)loaded]' && ret=0 _requested files expl 'module file' \ _files -W module_path -g '*.(dll|s[ol]|bundle)(:r)' && ret=0 diff --git a/Completion/Zsh/Command/_zstyle b/Completion/Zsh/Command/_zstyle index 7db73c0c0..0c81c2f2e 100644 --- a/Completion/Zsh/Command/_zstyle +++ b/Completion/Zsh/Command/_zstyle @@ -5,9 +5,6 @@ local nm=$compstate[nmatches] taglist patterns contexts MATCH integer MBEGIN MEND typeset -A opt_args styles -_vcs_info_hooks() { - compadd - ${functions[(I)+vi-*]#+vi-} -} # Assoc array of styles; the values give the possible top-level # contexts: # c completion @@ -65,6 +62,7 @@ styles=( ignore-parents c:ignorepar ignored-patterns c: insert-ids c:insert-ids + insert-sections c:insert-sections insert-tab c:bool insert-unambiguous c:insunambig keep-prefix c:keep-prefix @@ -103,6 +101,7 @@ styles=( preserve-prefix c:preserve-prefix range c: recent-dirs-insert c:recent-dirs-insert + recursive-files c: regular c:bool rehash c:bool remote-access c:bool @@ -113,7 +112,7 @@ styles=( show-ambiguity c: show-completer c:bool single-ignored c:single-ignored - sort c:bool + sort c:sort-order special-dirs c:sdirs squeeze-slashes c:bool stop c:stop @@ -145,6 +144,7 @@ styles=( cursor e: edit-buffer e:bool edit-previous e:bool + editor e: insert-kept e: leave-cursor e:bool match e: @@ -218,7 +218,7 @@ taglist=( ) # Be careful with the context arguments here. They like to masquerade. -_arguments -C \ +_arguments -C -A '-*' \ '(: -)-L[output in form of zstyle commands]:pattern for context patterns:->metapatterns:style:->metastyles' \ '(: -)-d[delete style definitions]:verbatim context pattern:->patterns:*:styles:->pstyles' \ '(: -)-e[value is evaluated when style is looked up]:context pattern:->contexts:style:->styles:*:command:_cmdstring' \ @@ -229,7 +229,7 @@ _arguments -C \ '(: -)-t[test a style, returning false if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \ '(: -)-T[test a style, returning true if it'\''s undefined]:context name:->contexts:style:->styles:*:strings to test presence of: ' \ '(: -)-m[pattern-match values of a style]:context name:->contexts:style:->styles:pattern: ' \ - '(-):context pattern:->contexts' '(-):style:->styles' '(-)*:argument:->style-arg' + ':context pattern:->contexts' ':style:->styles' '*:argument:->style-arg' while (( $#state )); do case "$state[1]" in @@ -412,14 +412,15 @@ while (( $#state )); do ;; (function) - _wanted control-function expl 'control function' \ + _wanted control-functions expl 'control function' \ compadd predict-on all-matches ;; (functions) - _wanted comp-widget expl 'completion widget' \ - compadd $suf - all-matches complete-debug complete-tag \ - correct-word expand-word expand-alias-word history-words + _wanted comp-widgets expl 'completion widget' \ + compadd $suf -M 'r:|-=* r:|=*' - all-matches complete-debug complete-tag \ + correct-word expand-word expand-alias-word history-words \ + ${${${(M)${(f)"$(_call_program comp-widgets zle -l)"}:#*-C*}:#_*}/ -C*} ;; (user-host-port) @@ -490,7 +491,7 @@ while (( $#state )); do elif compset -P '*:'; then _message -e tags tag else - _message -e patterns 'glob patterns' + _message -e patterns 'glob pattern' fi ;; @@ -524,6 +525,11 @@ while (( $#state )); do compadd - menu single longer ;; + (insert-sections) + _wanted values expl 'where to insert man page section' \ + compadd - true false prepend suffix + ;; + (fake-files) _message -e fakes 'prefix and names' ;; @@ -571,6 +577,10 @@ while (( $#state )); do _message -e separators 'separator string' ;; + (sort-order) + _wanted sort-orders expl 'sort order' compadd -F line - true false match nosort numeric reverse + ;; + (max-matches-width) _message -e numbers 'maximum display width for matches' ;; @@ -659,7 +669,7 @@ while (( $#state )); do 'p[name of top-most patch (applied-string)]' \ 'u[number of unapplied patches (unapplied-string)]' \ 'n[number of applied patches]' \ - 'c[number of unapplied patches.]' \ + 'c[number of unapplied patches]' \ 'a[number of all patches]' \ 'g[names of active mq guards (hg backend)]' \ 'G[number of active mq guards (hg backend)]' diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter index 6960cec9b..66be4f7cd 100644 --- a/Completion/Zsh/Context/_brace_parameter +++ b/Completion/Zsh/Context/_brace_parameter @@ -140,8 +140,9 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then flags+=("m:count number of character code points in padding calculation") fi flags+=( - "#:evaluate as numeric expression" + "#:interpret numeric expression as character code" "@:prevent double-quoted joining of arrays" + "*:enable extended globs for pattern" "A:assign as an array parameter" "a:sort in array index order (with O to reverse)" "b:backslash quote pattern characters only" @@ -155,7 +156,8 @@ if [[ $PREFIX = *'${('[^\)]# ]]; then "i:sort case-insensitively" "k:substitute keys of associative arrays" "L:lower case all letters" - "n:sort decimal integers numerically" + "n:sort positive decimal integers numerically" + "-:sort decimal integers numerically" "o:sort in ascending order (lexically if no other sort option)" "O:sort in descending order (lexically if no other sort option)" "P:use parameter value as name of parameter for redirected lookup" diff --git a/Completion/Zsh/Context/_subscript b/Completion/Zsh/Context/_subscript index 0c9a89ad5..25cedd193 100644 --- a/Completion/Zsh/Context/_subscript +++ b/Completion/Zsh/Context/_subscript @@ -1,6 +1,8 @@ #compdef -subscript- -local expl ind osuf=']' flags sep +local expl ind osuf flags sep + +[[ $ISUFFIX = *\]* ]] || osuf=\] if [[ "$1" = -q ]]; then compquote osuf @@ -78,7 +80,7 @@ elif compset -P '\('; then );; esac - _values -s '' 'subscript flags' $flags + _values -s '' 'subscript flag' $flags elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then local suf MATCH MBEGIN MEND local -a keys diff --git a/Completion/Zsh/Context/_zcalc_line b/Completion/Zsh/Context/_zcalc_line index 50fb8c17c..ab8e42df9 100644 --- a/Completion/Zsh/Context/_zcalc_line +++ b/Completion/Zsh/Context/_zcalc_line @@ -16,7 +16,7 @@ _zcalc_line_escapes() { "function:define math function (also \:func or \:f)" ) cmds=("\:"${^cmds}) - _describe -t command-escapes "command escapes" cmds -Q + _describe -t command-escapes "command escape" cmds -Q } _zcalc_line() { diff --git a/Completion/Zsh/Function/__arguments b/Completion/Zsh/Function/__arguments new file mode 100644 index 000000000..af7710971 --- /dev/null +++ b/Completion/Zsh/Function/__arguments @@ -0,0 +1,44 @@ +#compdef _arguments + +# Dear reader: This function is called "__arguments" and is the completion +# function for the completion function _arguments. This function, however, is +# not the completion function _arguments. If you're looking for the function +# _arguments, then you've come to the wrong place. +# +# _arguments is a completion utility function. It is called by completion +# functions for command-line tools. +# +# __arguments is a completion function for _arguments. It runs when one does +# `_arguments -<TAB>' at the shell prompt to jog one's memory about _arguments' +# option flags. +# +# _arguments is in documented in the manual. If you were looking for its +# source code, that'd be either in ../../../Completion/Base/Utility/_arguments +# or in ./_arguments, depending on where you're reading this file. +# +# __arguments takes no arguments. + +if (( ${words[(i)--]} < CURRENT )); then + # "Deriving spec forms from the help output" + _arguments : \ + '*-i[specify option name exclude patterns]:option name exclude pattern' \ + '*-s[specify option aliases]:pattern and replacement as "(this that)"' \ + '*:helpspec (pattern\:message\:action)' +else + _arguments -A '-([AMO]*|[0CRSWnsw])' : \ + '!-n[set $NORMARG]' \ + '-s[enable single-letter option stacking (-x -y == -xy)]' \ + '-w[(rarely needed) enable single-letter option stacking with arguments (-x X -y == -xy X)]' \ + '-W[(rarely needed) enable single-letter option stacking with arguments in the same word (-x X -y == -xXy)]' \ + "-C[modify \$curcontext for \`->action' (instead of \$context)]" \ + "-R[when \`->action' matches, return 300]" \ + "-S[honour \`--' as end-of-options guard]" \ + "-A[do not complete options after non-options]:pattern matching unknown options (e.g., '-*')" \ + '-O[pass elements of array variable to function calls in actions]:array variable name:_parameters -g array' \ + "-M[specify matchspec for completing option names and values]:matchspec for completing option names and values [ 'r\\:|[_-]=* r\\:|=*' ]" \ + '-0[have ${(v)opt_args} be NUL-joined rather than colon-escaped and colon-joined]' \ + "--[derive optspecs from \`\${command} --help' output]" \ + '1::optional delimiter:(\:)' \ + '*:spec (e.g., "(-t --to)"*{-t+,--to=}"[specify recipient]\:recipient'\''s address\:_email_addresses)' + # TODO: doesn't support "Specifying Multiple Sets of Arguments" +fi diff --git a/Completion/Zsh/Function/_add-zle-hook-widget b/Completion/Zsh/Function/_add-zle-hook-widget index f108d1868..c0bd77819 100644 --- a/Completion/Zsh/Function/_add-zle-hook-widget +++ b/Completion/Zsh/Function/_add-zle-hook-widget @@ -26,9 +26,12 @@ _add-zle-hook-widget() { local context state state_descr line typeset -A opt_args _arguments -s -w -S : \ - '(-D)-d[remove HOOK from the array]' \ - '(-d)-D[interpret HOOK as pattern to remove from the array]' \ - {-U,-z,-k}"[passed to 'autoload']" \ + "(-d -D -U -z -k)-L[output in form of 'zstyle' commands]" \ + '(-L -D -U -z -k)-d[remove HOOK from the array]' \ + '(-L -d -U -z -k)-D[interpret HOOK as pattern to remove from the array]' \ + '(-L -d -D)-U[suppress alias expansion for functions]' \ + '(-L -d -D -k)-z[mark function for zsh-style autoloading]' \ + '(-L -d -D -z)-k[mark function for ksh-style autoloading]' \ ':hook type:_add-zle-hook-widget_types' \ ':widget:_add-zle-hook-widget_widgets' } diff --git a/Completion/Zsh/Function/_add-zsh-hook b/Completion/Zsh/Function/_add-zsh-hook index e8ae97052..5b1ff0e42 100644 --- a/Completion/Zsh/Function/_add-zsh-hook +++ b/Completion/Zsh/Function/_add-zsh-hook @@ -3,7 +3,7 @@ _add-zsh-hook_hooks() { local expl if (( $+opt_args[-d] )); then - _wanted functions expl "installed hooks" compadd -a - "$line[1]_functions" && return 0 + _wanted functions expl "installed hook" compadd -a - "$line[1]_functions" && return 0 else _functions && return 0 fi @@ -14,9 +14,12 @@ _add-zsh-hook() { local context state state_descr line typeset -A opt_args _arguments -s -w -S : \ - '(-D)-d[remove HOOK from the array]' \ - '(-d)-D[interpret HOOK as pattern to remove from the array]' \ - {-U,-z,-k}"[passed to 'autoload']" \ + "(-d -D -U -z -k)-L[output in form of 'typeset' commands]" \ + '(-L -D -U -z -k)-d[remove HOOK from the array]' \ + '(-L -d -U -z -k)-D[interpret HOOK as pattern to remove from the array]' \ + '(-L -d -D)-U[suppress alias expansion for functions]' \ + '(-L -d -D -k)-z[mark function for zsh-style autoloading]' \ + '(-L -d -D -z)-k[mark function for ksh-style autoloading]' \ ':hook class:(chpwd precmd preexec periodic zshaddhistory zshexit zsh_directory_name)' \ ':hook function:_add-zsh-hook_hooks' } diff --git a/Completion/Zsh/Function/_vcs_info b/Completion/Zsh/Function/_vcs_info new file mode 100644 index 000000000..fdb28de6a --- /dev/null +++ b/Completion/Zsh/Function/_vcs_info @@ -0,0 +1,31 @@ +#compdef vcs_info_hookadd vcs_info_hookdel + +local -a hook_types=( + gen-applied-string + gen-hg-bookmark-string + gen-mqguards-string + gen-unapplied-string + no-vcs + post-backend + post-quilt + pre-addon-quilt + pre-get-data + set-branch-format + set-hgrev-format + set-message + set-patch-format + start-up +) + +local -a specs +case $service in + (vcs_info_hookdel) + specs=( '-a[remove all occurrences, not just the first]' ) + ;; +esac + +# TODO: for vcs_info_hookdel complete only functions installed for that hook +_arguments : \ + $specs \ + ":hook type:($hook_types)" \ + '*:hook function:_vcs_info_hooks' diff --git a/Completion/Zsh/Function/_zargs b/Completion/Zsh/Function/_zargs index f974ab646..94a35e3a5 100644 --- a/Completion/Zsh/Function/_zargs +++ b/Completion/Zsh/Function/_zargs @@ -18,17 +18,17 @@ case $numeofs in #zargs arguments arguments=( '(--eof -e)'{--eof=,-e+}'[change the end-of-input-args string from "--" to eof-str]' - '(--exit, -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]' + '(--exit -x)'{--exit,-x}'[exit if the size (see --max-chars) is exceeded]' '--help[print summary and exit]' - '(--interactive, -p)'{--interactive,-p}'[prompt before executing each command line]' - '(--max-args, -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]' - '(--max-chars, -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]' - '(--max-lines, -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]' - '(--max-procs, -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]' - '(--no-run-if-empty, -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]' - '(--null, -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]' - '(--replace, -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]' - '(--verbose, -t)'{--verbose,-t}'[print each command line to stderr before executing it]' + '(--interactive -p)'{--interactive,-p}'[prompt before executing each command line]' + '(--max-args -n)'{--max-args=,-n+}'[use at most max-args arguments per command line]' + '(--max-chars -s)'{--max-chars=,-s+}'[use at most max-chars characters per command line]' + '(--max-lines -l)'{--max-lines=,-l+}'[use at most max-lines of the input-args per command line]' + '(--max-procs -P)'{--max-procs=,-P+}'[run up to max-procs command lines in the background at once]' + '(--no-run-if-empty -r)'{--no-run-if-empty,-r}'[do nothing if there are no input arguments before the eof-str]' + '(--null -0)'{--null,-0}'[split each input-arg at null bytes, for xargs compatibility]' + '(--replace -i)'{--replace=,-i}'[substitute replace-str in the initial-args by each initial-arg]' + '(--verbose -t)'{--verbose,-t}'[print each command line to stderr before executing it]' '--version[print the version number of zargs and exit]' ) _arguments -S -s $arguments[@] && ret=0 diff --git a/Completion/Zsh/Type/_command_names b/Completion/Zsh/Type/_command_names index cd630b7a4..12cbd69c1 100644 --- a/Completion/Zsh/Type/_command_names +++ b/Completion/Zsh/Type/_command_names @@ -4,7 +4,7 @@ # complete only external commands and executable files. This and a # `-' as the first argument is then removed from the arguments. -local args defs ffilt +local args defs expl ffilt zstyle -t ":completion:${curcontext}:commands" rehash && rehash @@ -16,8 +16,12 @@ defs=( 'commands:external command:_path_commands' ) -[[ -n "$path[(r).]" || $PREFIX = */* ]] && - defs+=( 'executables:executable file:_files -g \*\(-\*\)' ) +if [[ -n "$path[(r).]" || $PREFIX = */* ]]; then + defs+=( 'executables:executable file:_files -g \*\(-\*\)' ) +else + # this is ignored but exists to facilitate the use of the fake style + _description executables expl 'executable file' +fi if [[ "$1" = -e ]]; then shift @@ -41,11 +45,24 @@ fi args=( "$@" ) local -a cmdpath -if zstyle -a ":completion:${curcontext}" command-path cmdpath && - [[ $#cmdpath -gt 0 ]] -then + +zstyle -a ":completion:${curcontext}" command-path cmdpath + +# Using the current PATH doesn't necessarily make sense when completing commands +# to tools like sudo, which might set a different one. A common issue is that +# /**/sbin appear in the PATH used by the tool, but not in the one used by the +# unprivileged user who calls it. To do the right thing in the most common +# cases, we'll simply ensure that the sbin variants always appear here when not +# otherwise overridden (bash-completion's _sudo does something similar) +if (( ! $#cmdpath && $#_comp_priv_prefix )); then + cmdpath=( $path ${path/%\/bin//sbin} ) + cmdpath=( ${(u)^cmdpath}(/-N) ) +fi + +if (( $#cmdpath )); then local -a +h path local -A +h commands - path=( $cmdpath ) + path=( $cmdpath:A ) fi + _alternative -O args "$defs[@]" diff --git a/Completion/Zsh/Type/_globflags b/Completion/Zsh/Type/_globflags index 13ef14c17..d24e8f2a7 100644 --- a/Completion/Zsh/Type/_globflags +++ b/Completion/Zsh/Type/_globflags @@ -5,18 +5,26 @@ local ret=1 local -a flags +local preprefix=$IPREFIX -if compset -P a; then - _message -e number 'errors' - return -elif compset -P q; then +compset -P '([ilIUubBmMcq]|a(|<->))##' +# make sure to not consider anything before the '#' +preprefix=${IPREFIX[$#preprefix,-1]} +if [[ $preprefix = *\#q* ]]; then _globquals return -elif compset -P 'c[0-9]##,'; then - _message -e number 'max repetitions' +elif [[ $preprefix = *q* ]]; then + _message 'q flag has to be specified by itself' return -elif compset -P c; then - _message -e number 'repetitions (min or exact)' +elif [[ $preprefix = *a(|<->) ]]; then + _message -e number 'errors' + if [[ $preprefix = *a ]]; then + return + else + compset -P '<->' + fi +elif [[ $preprefix = *\#c ]]; then + _message -e range 'repetitions (min,max) or (exact)' return fi @@ -35,13 +43,20 @@ flags=( 'm:set reference to entire matched data' 'M:deactivate m flag' ) - +flags=( ${flags:#[$preprefix[(R)\#,-1]]*} ) +if [[ $IPREFIX != *'#' ]]; then + flags=( ${flags:#[se]*} ) +fi _describe -t globflags "glob flag" flags -Q -S ')' && ret=0 flags=( 'a:approximate matching' 'q:introduce glob qualifier' 'c:match repetitions of preceding pattern' ) +flags=( ${flags:#[$preprefix[(R)\#,-1]]*} ) +if [[ $IPREFIX != *'#' ]]; then + flags=( ${flags:#[cq]*} ) +fi _describe -t globflags "glob flag" flags -Q -S '' && ret=0 return ret diff --git a/Completion/Zsh/Type/_globquals b/Completion/Zsh/Type/_globquals index 915f97c1c..bc3165eba 100644 --- a/Completion/Zsh/Type/_globquals +++ b/Completion/Zsh/Type/_globquals @@ -127,16 +127,14 @@ while [[ -n $PREFIX ]]; do alts+=( "time-specifiers:time specifier:compadd -E 0 -d tdisp -S '' -a tmatch" ) fi if ! compset -P '[-+]' && [[ -z $PREFIX ]]; then - sdisp=( before exactly since ) - smatch=( - '' + ) if zstyle -t ":completion:${curcontext}:senses" verbose; then zstyle -s ":completion:${curcontext}:senses" list-separator sep || sep=-- default=" [default exactly]" - sdisp=( "- $sep before" "+ $sep since" ) - smatch=( - + ) + sdisp=( "+ $sep before (older files)" "- $sep since (newer files)" ) + smatch=( + - ) else sdisp=( before exactly since ) - smatch=( - '' + ) + smatch=( + '' - ) fi alts+=( "senses:sense${default}:compadd -E 0 -d sdisp -S '' -a smatch" ) fi diff --git a/Completion/Zsh/Type/_parameters b/Completion/Zsh/Type/_parameters index eaad3ca9d..b5da45c58 100644 --- a/Completion/Zsh/Type/_parameters +++ b/Completion/Zsh/Type/_parameters @@ -6,18 +6,44 @@ # If you specify a -g option with a pattern, the pattern will be used to # restrict the type of parameters matched. -local expl pattern fakes faked tmp pfilt - if compset -P '*:'; then _history_modifiers p return fi -pattern=(-g \*) +local i pfilt +local -i nm=$compstate[nmatches] +local -a expl pattern=( -g \* ) normal described verbose faked fakes tmp + +zstyle -t ":completion:${curcontext}:parameters" prefix-needed && + [[ $PREFIX != [_.]* ]] && + pfilt='[^_.]' +_description parameters expl parameter zparseopts -D -K -E g:=pattern -fakes=() -faked=() +if zstyle -t ":completion:${curcontext}:parameters" extra-verbose; then + described=( + "${(@M)${(@k)parameters[(R)$~pattern[2]~*(hideval|local|special)*]}:#$~pfilt*}" + ) + compadd "$@" "$expl[@]" -D described -a - described + if (( $#described )); then + # Normally, calling typeset without flags would print the values of its + # arguments. However, inside a function, it instead declare its arguments + # as local variables and outputs nothing. Thus, to force it print out + # parameter values, we pass it the -m flag. + verbose=( + ${${${(f@)"$( typeset -m ${(@b)described} )"}/=/:}[@]//'\'/'\\'} + ) + _describe -t parameters parameter verbose "$@" "$expl[@]" + fi + + normal=( + "${(@M)${(@k)parameters[(R)$~pattern[2]~^(*(hideval|special)*)~*local*]}:#$~pfilt*}" + ) +else + normal=( "${(@M)${(@k)parameters[(R)$~pattern[2]~*local*]}:#$~pfilt*}" ) +fi + if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then for i in "$tmp[@]"; do if [[ "$i" = *:* ]]; then @@ -27,13 +53,7 @@ if zstyle -a ":completion:${curcontext}:" fake-parameters tmp; then fi done fi +compadd "$@" "$expl[@]" - "$normal[@]" "${(@)fakes:|described}" \ + "${(@)${(@)${(@M)faked:#${~pattern[2]}}%%:*}:|described}" -zstyle -t ":completion:${curcontext}:parameters" prefix-needed && \ - [[ $PREFIX != [_.]* ]] && \ - pfilt='[^_.]' - -_wanted parameters expl parameter \ - compadd "$@" -Q - \ - "${(@M)${(@k)parameters[(R)${pattern[2]}~*local*]}:#${~pfilt}*}" \ - "$fakes[@]" \ - "${(@)${(@M)faked:#${~pattern[2]}}%%:*}" +(( compstate[nmatches] > nm )) diff --git a/Completion/Zsh/Type/_ps1234 b/Completion/Zsh/Type/_ps1234 index cf1982219..0ea2cdda9 100644 --- a/Completion/Zsh/Type/_ps1234 +++ b/Completion/Zsh/Type/_ps1234 @@ -38,7 +38,7 @@ if compset -P '%[FK]'; then ) _description -V ansi-colors expl 'ansi color' - grp="$expl[expl[(i)-V]+1]" + grp="$expl[expl[(i)-J]+1]" print -v ccol -f "($grp)=%s=%s" ${(kv)ansi} _comp_colors+=( $ccol ) compadd "$expl[@]" $suf $pre -k ansi && ret=0 @@ -48,10 +48,10 @@ if compset -P '%[FK]'; then (( cols = $terminfo[colors] - 1 )) (( cols = cols > 255 ? 255 : cols )) _description -V terminal-colors expl 'terminal color' - grp="$expl[expl[(i)-V]+1]" + grp="$expl[expl[(i)-J]+1]" compadd "$expl[@]" $suf $pre {0..$cols} for c in {0..$cols}; do - _comp_colors+=( "($grp)=${c}=${${$(print -P "%F{$c}")#?\[}%m}" ) + _comp_colors+=( "($grp)=${c}=${${${(%):-%F{$c\}}#?\[}%m}" ) done else _message -e terminal-colors "number" diff --git a/Completion/Zsh/Type/_vcs_info_hooks b/Completion/Zsh/Type/_vcs_info_hooks new file mode 100644 index 000000000..bad915000 --- /dev/null +++ b/Completion/Zsh/Type/_vcs_info_hooks @@ -0,0 +1,2 @@ +#autoload +compadd - ${functions[(I)+vi-*]#+vi-} diff --git a/Completion/bashcompinit b/Completion/bashcompinit index 02290a16f..adb659ca1 100644 --- a/Completion/bashcompinit +++ b/Completion/bashcompinit @@ -10,7 +10,7 @@ _bash_complete() { (( COMP_POINT = 1 + ${#${(j. .)words[1,CURRENT-1]}} + $#QIPREFIX + $#IPREFIX + $#PREFIX )) (( COMP_CWORD = CURRENT - 1)) - COMP_WORDS=( $words ) + COMP_WORDS=( "${words[@]}" ) BASH_VERSINFO=( 2 05b 0 1 release ) savejobstates=( ${(kv)jobstates} ) @@ -24,9 +24,10 @@ _bash_complete() { if [[ ${argv[${argv[(I)filenames]:-0}-1]} = -o ]]; then compset -P '*/' && matches=( ${matches##*/} ) compset -S '/*' && matches=( ${matches%%/*} ) - compadd -Q -f "${suf[@]}" -a matches && ret=0 + compadd -f "${suf[@]}" -a matches && ret=0 else - compadd -Q "${suf[@]}" -a matches && ret=0 + compadd "${suf[@]}" - "${(@)${(Q@)matches}:#*\ }" && ret=0 + compadd -S ' ' - ${${(M)${(Q)matches}:#*\ }% } && ret=0 fi fi diff --git a/Completion/compdump b/Completion/compdump index e0dc8b805..6daf92f9f 100644 --- a/Completion/compdump +++ b/Completion/compdump @@ -16,7 +16,7 @@ emulate -L zsh setopt extendedglob noshglob -typeset _d_file _d_f _d_bks _d_line _d_als _d_files _d_name _d_tmp +typeset _d_file _d_f _d_fd _d_bks _d_line _d_als _d_files _d_name _d_tmp _d_file=${_comp_dumpfile-${0:h}/compinit.dump}.$HOST.$$ [[ $_d_file = //* ]] && _d_file=${_d_file[2,-1]} @@ -33,44 +33,45 @@ if [[ -n "$_comp_secure" ]]; then (( $#_d_wdirs )) && _d_files=( "${(@)_d_files:#(${(j:|:)_d_wdirs})/*}" ) fi -print "#files: $#_d_files\tversion: $ZSH_VERSION" > $_d_file +exec {_d_fd}>$_d_file +print "#files: $#_d_files\tversion: $ZSH_VERSION" >& $_d_fd # Dump the arrays _comps, _services and _patcomps. The quoting # hieroglyphics ensure that a single quote inside a variable is itself # correctly quoted. -print "\n_comps=(" >> $_d_file +print "\n_comps=(" >& $_d_fd for _d_f in ${(ok)_comps}; do print -r - "${(qq)_d_f}" "${(qq)_comps[$_d_f]}" -done >> $_d_file -print ")" >> $_d_file +done >& $_d_fd +print ")" >& $_d_fd -print "\n_services=(" >> $_d_file +print "\n_services=(" >& $_d_fd for _d_f in ${(ok)_services}; do print -r - "${(qq)_d_f}" "${(qq)_services[$_d_f]}" -done >> $_d_file -print ")" >> $_d_file +done >& $_d_fd +print ")" >& $_d_fd -print "\n_patcomps=(" >> $_d_file +print "\n_patcomps=(" >& $_d_fd for _d_f in ${(ok)_patcomps}; do print -r - "${(qq)_d_f}" "${(qq)_patcomps[$_d_f]}" -done >> $_d_file -print ")" >> $_d_file +done >& $_d_fd +print ")" >& $_d_fd _d_tmp="_postpatcomps" -print "\n_postpatcomps=(" >> $_d_file +print "\n_postpatcomps=(" >& $_d_fd for _d_f in ${(ok)_postpatcomps}; do print -r - "${(qq)_d_f}" "${(qq)_postpatcomps[$_d_f]}" -done >> $_d_file -print ")" >> $_d_file +done >& $_d_fd +print ")" >& $_d_fd -print "\n_compautos=(" >> $_d_file +print "\n_compautos=(" >& $_d_fd for _d_f in "${(ok@)_compautos}"; do print -r - "${(qq)_d_f}" "${(qq)_compautos[$_d_f]}" -done >> $_d_file -print ")" >> $_d_file +done >& $_d_fd +print ")" >& $_d_fd -print >> $_d_file +print >& $_d_fd # Now dump the key bindings. We dump all bindings for zle widgets # whose names start with a underscore. @@ -90,15 +91,15 @@ zle -lL | print -r - ${_d_line} _d_bks+=(${_d_line[3]}) fi - done >> $_d_file + done >& $_d_fd bindkey | while read -rA _d_line; do if [[ ${_d_line[2]} = (${(j.|.)~_d_bks}) ]]; then print -r "bindkey '${_d_line[1][2,-2]}' ${_d_line[2]}" fi - done >> $_d_file + done >& $_d_fd -print >> $_d_file +print >& $_d_fd # Autoloads: look for all defined functions beginning with `_' (that also @@ -109,7 +110,7 @@ _d_als=($^fpath/(${(o~j.|.)$(typeset +fm '_*')})(N:t)) # print them out: about five to a line looks neat integer _i=5 -print -n autoload -Uz >> $_d_file +print -n autoload -Uz >& $_d_fd while (( $#_d_als )); do if (( ! $+_compautos[$_d_als[1]] )); then print -n " $_d_als[1]" @@ -119,19 +120,20 @@ while (( $#_d_als )); do fi fi shift _d_als -done >> $_d_file +done >& $_d_fd -print >> $_d_file +print >& $_d_fd local _c for _c in "${(ok@)_compautos}"; do - print "autoload -Uz $_compautos[$_c] $_c" >> $_d_file + print "autoload -Uz $_compautos[$_c] $_c" >& $_d_fd done -print >> $_d_file +print >& $_d_fd -print "typeset -gUa _comp_assocs" >> $_d_file -print "_comp_assocs=( ${(qq)_comp_assocs} )" >> $_d_file +print "typeset -gUa _comp_assocs" >& $_d_fd +print "_comp_assocs=( ${(qq)_comp_assocs} )" >& $_d_fd +exec {_d_fd}>&- mv -f $_d_file ${_d_file%.$HOST.$$} diff --git a/Completion/compinit b/Completion/compinit index f0f8421df..5cb527fac 100644 --- a/Completion/compinit +++ b/Completion/compinit @@ -60,6 +60,10 @@ # the end). This takes the dumpfile as an argument. -d (with the # default dumpfile) is now the default; to turn off dumping use -D. +# If the dumpfile is being regenerated and you don't know why, you can use +# the -w flag to see if it was because -D was passed, zsh version mismatched, +# or number of files in $fpath differed. + # The -C flag bypasses both the check for rebuilding the dump file and the # usual call to compaudit; the -i flag causes insecure directories found by # compaudit to be ignored, and the -u flag causes all directories found by @@ -71,9 +75,9 @@ emulate -L zsh setopt extendedglob typeset _i_dumpfile _i_files _i_line _i_done _i_dir _i_autodump=1 -typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name +typeset _i_tag _i_file _i_addfiles _i_fail=ask _i_check=yes _i_name _i_why -while [[ $# -gt 0 && $1 = -[dDiuC] ]]; do +while [[ $# -gt 0 && $1 = -[dDiuCw] ]]; do case "$1" in -d) _i_autodump=1 @@ -99,6 +103,10 @@ while [[ $# -gt 0 && $1 = -[dDiuC] ]]; do _i_check= shift ;; + -w) + _i_why=1 + shift + ;; esac done @@ -157,6 +165,7 @@ _comp_options=( NO_posixidentifiers NO_shwordsplit NO_shglob + NO_typesettounset NO_warnnestedvar NO_warncreateglobal ) @@ -320,7 +329,7 @@ compdef() { # and probably do autoloading. func="$1" - [[ -n "$autol" ]] && autoload -Uz "$func" + [[ -n "$autol" ]] && autoload -rUz "$func" shift case "$type" in @@ -442,7 +451,7 @@ typeset _i_wdirs _i_wfiles _i_wdirs=() _i_wfiles=() -autoload -Uz compaudit +autoload -RUz compaudit if [[ -n "$_i_check" ]]; then typeset _i_q if ! eval compaudit; then @@ -458,19 +467,17 @@ Ignore insecure $_i_q and continue [y] or abort compinit [n]? "; then return 1 fi - _i_wfiles=() - _i_wdirs=() - else - (( $#_i_wfiles )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wfiles%.zwc})}" ) - (( $#_i_wdirs )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wdirs%.zwc})/*}" ) fi + fpath=(${fpath:|_i_wdirs}) + (( $#_i_wfiles )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wfiles%.zwc})}" ) + (( $#_i_wdirs )) && _i_files=( "${(@)_i_files:#(${(j:|:)_i_wdirs%.zwc})/*}" ) fi typeset -g _comp_secure=yes fi fi # Make sure compdump is available, even if we aren't going to use it. -autoload -Uz compdump compinstall +autoload -RUz compdump compinstall # If we have a dump file, load it. @@ -484,11 +491,28 @@ if [[ -f "$_comp_dumpfile" ]]; then then builtin . "$_comp_dumpfile" _i_done=yes + elif [[ _i_why -eq 1 ]]; then + print -nu2 "Loading dump file skipped, regenerating" + local pre=" because: " + if [[ _i_autodump -ne 1 ]]; then + print -nu2 $pre"-D flag given" + pre=", " + fi + if [[ $_i_line[2] -ne $#_i_files ]]; then + print -nu2 $pre"number of files in dump $_i_line[2] differ from files found in \$fpath $#_i_files" + pre=", " + fi + if [[ $ZSH_VERSION != $_i_line[4] ]]; then + print -nu2 $pre"zsh version changed from $_i_line[4] to $ZSH_VERSION" + fi + print -u2 fi else builtin . "$_comp_dumpfile" _i_done=yes fi +elif [[ _i_why -eq 1 ]]; then + print -u2 "No existing compdump file found, regenerating" fi if [[ -z "$_i_done" ]]; then typeset -A _i_test @@ -512,7 +536,7 @@ if [[ -z "$_i_done" ]]; then fi ;; (\#autoload) - autoload -Uz "$_i_line[@]" ${_i_name} + autoload -rUz "$_i_line[@]" ${_i_name} [[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line" ;; esac @@ -544,6 +568,6 @@ if [[ ${_i_line[2]} = expand-or-complete ]] && fi unfunction compinit compaudit -autoload -Uz compinit compaudit +autoload -RUz compinit compaudit return 0 diff --git a/Completion/openSUSE/Command/_hwinfo b/Completion/openSUSE/Command/_hwinfo index aac0a05ad..7dff82805 100644 --- a/Completion/openSUSE/Command/_hwinfo +++ b/Completion/openSUSE/Command/_hwinfo @@ -5,7 +5,7 @@ _arguments \ '--version[show libhd version]' \ '--short[just a short listing]' \ '--log[write info to logfile]:logfile:_files' \ - '--debug[set debuglevel]:debuglevels:(1 2 3 4 5 6 7 8 9)' \ + '--debug[set debuglevel]:debug level:(1 2 3 4 5 6 7 8 9)' \ '--dump-db[dump hardware data base, 0: external, 1: internal]:dumpdb:(0 1)' \ '--bios' \ '--block' \ diff --git a/Completion/openSUSE/Command/_zypper b/Completion/openSUSE/Command/_zypper index 25a32c3f1..3f3402bd9 100644 --- a/Completion/openSUSE/Command/_zypper +++ b/Completion/openSUSE/Command/_zypper @@ -65,17 +65,17 @@ _zypper() { _all_repos() { local -a repos repos=( $(zypper -q lr | tail -n +3 | cut -d'|' -f 2) ) - _describe -t repos 'Available repositories' repos && return + _describe -t repos 'available repository' repos && return } _enabled_repos() { repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) ) - _describe -t repos 'Available repositories' repos && return + _describe -t repos 'available repository' repos && return } _disabled_repos() { repos=( $(zypper -x lr | grep 'enabled="0"' | cut -d\" -f 2) ) - _describe -t repos 'Available repositories' repos && return + _describe -t repos 'available repository' repos && return } _zypper_cmd_do() { @@ -107,7 +107,7 @@ _zypper_cmd_do() { case ${words[CURRENT - 1]} in --from) repos=( $(zypper -x lr | grep 'enabled="1"' | cut -d\" -f 2) ) - _describe -t repos 'Available repositories' repos && return + _describe -t repos 'available repository' repos && return ;; (--enable|-e) case $cmd in @@ -128,7 +128,7 @@ _zypper_cmd_do() { case $cmd in (if|info|se|search|in|install) types=( pattern srcpackage package patch ) - _describe -t types 'Package types' types && return + _describe -t types 'package type' types && return ;; esac ;; @@ -143,7 +143,7 @@ _zypper_cmd_do() { ;; (in|install) local expl - _description files expl 'RPM files' + _description files expl 'RPM file' _files "$expl[@]" -g '*.(#i)rpm(.)' ;; esac |