diff options
Diffstat (limited to 'Completion/Unix')
69 files changed, 1850 insertions, 778 deletions
diff --git a/Completion/Unix/Command/_ant b/Completion/Unix/Command/_ant index 19c252a4e..080ce6857 100644 --- a/Completion/Unix/Command/_ant +++ b/Completion/Unix/Command/_ant @@ -51,7 +51,7 @@ _arguments -C \ '*-listener[add an instance of specified class as a project listener]:class:->class' \ '-noinput[do not allow interactive input]' \ '(-f -file -buildfile -s -find)'{-f,-file,-buildfile}'[use specified build file]:build file:_files -g "*.xml(-.)"' \ - '*-D[specify property with value to use]:property:->property' \ + '*-D+[specify property with value to use]:property:->property' \ '(-k -keep-going)'{-keep-going,-k}'[execute all targets that do not depend on failed target(s)]' \ '-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' \ diff --git a/Completion/Unix/Command/_basename b/Completion/Unix/Command/_basename new file mode 100644 index 000000000..a826b56b0 --- /dev/null +++ b/Completion/Unix/Command/_basename @@ -0,0 +1,27 @@ +#compdef basename gbasename + +local args variant +_pick_variant -r variant gnu=GNU $OSTYPE --version + +case $variant in + gnu) + args=( -s -S -A "-*" + '(2 -a --multiple)'{-a,--multiple}'[support multiple arguments, handling each]' + '(2 -a --multiple -s --suffix)'{-s+,--suffix=}'[remove a trailing suffix]:suffix' + '(-z --zero)'{-z,--zero}'[separate output with NUL rather than newline]' + '(- *)--version[display version information]' + '(- *)--help[display help information]' + ) + ;; + darwin*|dragonfly*|freebsd*) + args=( -s -S -A "-*" + '(2)-a[support multiple arguments, handling each]' + '(-a 2)-s+[remove a trailing suffix]:suffix' + ) + ;; +esac + +_arguments $args \ + '1:file:_files' \ + '(*)2:suffix' \ + '*:file:_files' diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index 57b197038..46180f2c8 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -19,8 +19,9 @@ if _pick_variant gnu=GNU unix --version; then '*:files:_files' ) -elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then +elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then args=( + -A "-*" '(-n)-b[number non-blank output lines]' '(-v)-e[display $ at the end of each line (implies -v)]' '-n[number all output lines]' @@ -28,12 +29,27 @@ elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then '(-v)-t[display tab as ^I (implies -v)]' '-u[do not buffer output]' '-v[display non-printing chars as ^X or M-a]' - '(-)*:files:_files' + '*:files:_files' ) - [[ $OSTYPE = freebsd* ]] && args+=( + [[ $OSTYPE = (free|net)bsd* ]] && args+=( '-l[set a lock on the stdout file descriptor]' ) - + [[ $OSTYPE = netbsd* ]] && args+=( + '-B+[read with buffer of specified size]:size (bytes)' + '-f[only attempt to display regular files]' + ) +elif [[ $OSTYPE = solaris* ]]; then + args=( + -A "-*" + '(-b)-n[number all output lines]' + '(-n)-b[number non-blank output lines]' + "-u[don't buffer output]" + '-s[be silent about non-existent files]' + '-v[display non-printing chars as ^X or M-a]' + '-e[display $ at the end of each line (requires -v)]' + '-t[display tab as ^I and formfeeds and ^L (requires -v)]' + '*:files:_files' + ) else # POSIX reqires '-u', and most OSes may support '-n' args=( @@ -43,4 +59,4 @@ else ) fi -_arguments -s -S : $args +_arguments -s -S $args diff --git a/Completion/Unix/Command/_cdrdao b/Completion/Unix/Command/_cdrdao index 0c3cfb82e..ceb86267c 100644 --- a/Completion/Unix/Command/_cdrdao +++ b/Completion/Unix/Command/_cdrdao @@ -262,14 +262,14 @@ _cdrdao-copy () { __cdrdao-device () { # Use cdrdao scanbus and also check what OS we're running under and provide # additional stuff, like devices (/dev/sg0) - local -a devices + local -a expl devices devices=(${${(f)"$(_call_program devices cdrdao scanbus -v 0 2>&1)"}%% :*}) _wanted devices expl 'device' compadd -a devices } __cdrdao-drivers () { - local suf + local expl suf local -Ua drivers drivers=(${(f)"$(_call_program drivers cut -d'\|' -f4 /usr/share/cdrdao/drivers -s)"}) if compset -P \*:; then diff --git a/Completion/Unix/Command/_darcs b/Completion/Unix/Command/_darcs index d40ecda28..74734711d 100644 --- a/Completion/Unix/Command/_darcs +++ b/Completion/Unix/Command/_darcs @@ -13,6 +13,8 @@ ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. +local expl + if (($CURRENT == 2)); then # We're completing the first word after "darcs" -- the command. _wanted command expl 'darcs command' \ diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date index 731f6963b..a3e933710 100644 --- a/Completion/Unix/Command/_date +++ b/Completion/Unix/Command/_date @@ -8,14 +8,15 @@ opts=( -s -w -C ) if _pick_variant gnu="Free Software Foundation" unix --version; then local d='(-d --date -f --file -r --reference -s --set)' - local f='(-I --iso-8601 -R --rfc-2822 --rfc-3339)' + local f='(-I --iso-8601 -R --rfc-email --rfc-3339)' args=( $d{-d+,--date=}'[output date specified by string]:time string' + '--debug[annotate parsed date and warn about questionable usage]' $d{-f+,--file=}'[output dates specified in file]:file:_files' $d{-r+,--reference=}'[output last modification time of specified file]:file:_files' $d{-s+,--set=}'[set time]:time string' $f{-I-,--iso-8601=-}'[display in ISO 8601 format]::precision:(date hours minutes seconds ns)' - $f{-R,--rfc-2822}'[display in RFC2822 format]' + $f{-R,--rfc-email}'[display in RFC5322 format]' $f'--rfc-3339=-[display in RFC 3339 format]:precision:(date seconds ns)' '(-u --utc --universal)'{-u,--utc,--universal}'[display or set time in UTC]' '(- :)--help[output help and exit]' diff --git a/Completion/Unix/Command/_dbus b/Completion/Unix/Command/_dbus index fd035743f..3f106cb5c 100644 --- a/Completion/Unix/Command/_dbus +++ b/Completion/Unix/Command/_dbus @@ -22,7 +22,7 @@ case $service in _arguments -A "--*" -C \ '*:watch expression:->expressions' \ - '(bus)' \ - --system --session + --system --session \ '--address=-:bus address:->addresses' \ - '(format)' \ --monitor --profile --pcap --binary && ret=0 diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index a98180a2c..d20ddea7e 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -5,12 +5,6 @@ local -A opt_args if _pick_variant gnu=GNU unix --version; then args=( - '(-B --block-size -k)'{-B+,--block-size=}'[specify block size]:size (bytes)' - '(-B --block-size -k)-k[like --block-size=1K]' - '(-P --portability)'{-P,--portability}'[use the POSIX output format]' - '(-h --human-readable -H --si)'{-h,--human-readable}'[print sizes in human readable format]' - '(-h --human-readable -H --si)'{-H,--si}'[human readable fomat, but use powers of 1000 not 1024]' - '(-i --inodes)'{-i,--inodes}'[list inode information instead of block usage]' '--total[produce a grand total]' '(-T --print-type)'{-T,--print-type}'[print file system type]' '(-a --all)'{-a,--all}'[include dummy file systems]' @@ -22,7 +16,14 @@ if _pick_variant gnu=GNU unix --version; then '-v[(ignored)]' '(- : *)--help[display help and exit]' '(- : *)--version[output version information and exit]' - '*:files:_files' + '*:files:_umountable' + - '(format)' + {-B+,--block-size=}'[specify block size]:size (bytes)' + '-k[like --block-size=1K]' + {-P,--portability}'[use the POSIX output format]' + {-h,--human-readable}'[print sizes in human readable format]' + {-H,--si}'[human readable format, but use powers of 1000 not 1024]' + {-i,--inodes}'[list inode information instead of block usage]' ) elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then args=( @@ -38,7 +39,7 @@ elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then '-i[include inode usage statistics (default)]' '-l[only display locally-mounted file systems]' '-n[use previously obtained statistics]' - '*:files:_files' + '*:files:_umountable' ) spec='[only display file systems of specified types]:file system type:->fslist' case "$OSTYPE" in @@ -58,7 +59,7 @@ else '-k[use 1024-byte blocks]' '-P[POSIX compliant output]' '-t[include total allocated-space figures in the output]' - '*:files:_files' + '*:files:_umountable' ) fi diff --git a/Completion/Unix/Command/_diffstat b/Completion/Unix/Command/_diffstat index 9b4b2da6e..c9f8e3049 100644 --- a/Completion/Unix/Command/_diffstat +++ b/Completion/Unix/Command/_diffstat @@ -1,19 +1,32 @@ #compdef diffstat -_arguments \ +_arguments -s -S \ + '-b[ignore lines indicating binary file differences]' \ '-c[prefix each line with hash mark]' \ - '-e:error file:_files' \ - '-f:histogram format:((0\:concise 1\:normal 2\:dots 3\:dots+normal 4\:value 5\:value+normal 6\:value+dots 7\:value+dots+normal))' \ - '-h[help]' \ + '-C[use color highlighting of histogram]' \ + '-d[print debug information]' \ + '-D[specify location of patched files for unchanged count]:location:_directories' \ + '-e[redirect standard error to specified file]:error file:_files' \ + '-E[trim escape sequences, e.g. from colordiff]' \ + '-f[specify histogram format]:format:((0\:concise 1\:normal 2\:dots 3\:dots+normal 4\:value 5\:value+normal 6\:value+dots 7\:value+dots+normal))' \ + '(- *)-h[display help information]' \ '-k[suppress merging of filenames in report]' \ + '-K[resolve ambiguity of "only" filenames]' \ '-l[list only the filenames]' \ - '-n:minimum width for filenames:' \ - '-o:output file:_files' \ - '-p:number of path components:' \ - '-f:rounding code:((0\:none 1\:round 2\:round+adjustment))' \ - '-t[overrides histogram, generates csv output]' \ + '-m[merge insert/delete data in chunks as modified-lines]' \ + '-n[specify minimum width for filenames]:width [auto]' \ + '-N[specify maximum width for filenames]:width [auto]' \ + '-o[redirect standard output to specified file]:output file:_files' \ + '-p[specify number of path separators to strip]:path components [common]' \ + '-q[suppress "0 files changed" message for empty diffs]' \ + '-r[specify rounding for histogram]:rounding:((0\:none 1\:simple 2\:simple+adjustment))' \ + '(-t)-s[show only the summary line]' \ + '-S[specify location of original files for unchanged count]:location:_directories' \ + '-R[assume patch was created with old and new files swapped]' \ + '(-T -s)-t[overrides histogram, generates csv output]' \ + '(-t)-T[print amounts (like -t) in addition to histogram]' \ '-u[suppress sorting of filenames in report]' \ '-v[show progress]' \ - '-V[print version number]' \ - '-w:maximum width of histogram:' \ - '*:file specifications:_files' + '(- *)-V[print version number]' \ + '-w[specify maximumn width of output]:maximum width [80]' \ + '*:patch file:_files' diff --git a/Completion/Unix/Command/_dig b/Completion/Unix/Command/_dig index 2b851c91f..a4e175808 100644 --- a/Completion/Unix/Command/_dig +++ b/Completion/Unix/Command/_dig @@ -15,15 +15,33 @@ local -a alts args '*+'{no,}'tcp[use TCP instead of UDP for queries]' '*+'{no,}'ignore[ignore truncation in UDP responses]' '*+domain=[set search list to single domain]:domain:_hosts' + '*+dscp=[set DSCP code point for query]:code point (0..63)' '*+'{no,}'search[use search list defined in resolv.conf]' '*+'{no,}'showsearch[show intermediate results in domain search]' + '*+split[split hex/base64 fields into chunks]:width (characters) [56]' '*+'{no,}'aaonly[set aa flag in the query]' + '*+'{no,}'additional[print additional section of a reply]' '*+'{no,}'adflag[set the AD (authentic data) bit in the query]' + '*+'{no,}'badcookie[retry BADCOOKIE responses]' '*+'{no,}'cdflag[set the CD (checking disabled) bit in the query]' - '*+'{no,}'cl[display the CLASS whening printing the record]' - '*+'{no,}'ttlid[display the TTL whening printing the record]' + '*+'{no,}'class[display the CLASS whening printing the record]' + '*+'{no,}'cookie[add a COOKIE option to the request]' + '*+'{no,}'crypto[display cryptographic fields in DNSSEC records]' + '*+edns=[specify EDNS version for query]:version (0-255)' + '*+noedns[clear EDNS version to be sent]' + '*+ednsflags=[set EDNS flags bits]:flags' + '*+'{no,}'ednsnegotiation[set EDNS version negotiation]' + '*+ednsopt=[specify EDNS option]:code point' + '*+noedns[clear EDNS options to be sent]' + '*+'{no,}'expire[send an EDNS Expire option]' + '*+'{no,}'header-only[send query without a question section]' + '*+'{no,}'idnout[set conversion of IDN puny code on output]' + '*+'{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]' '*+'{no,}'nssearch[search all authoritative nameservers]' + '*+opcode[set DNS message opcode of the request]:opcode [QUERY]:(QUERY IQUERY STATUS NOTIFY UPDATE)' + '*+noopcode[clear DNS message opcode]' '*+'{no,}'trace[trace delegation down from root]' '*+'{no,}'cmd[print initial comment in output]' '*+'{no,}'short[print terse output]' @@ -34,15 +52,14 @@ local -a alts args '*+'{no,}'question[print question section of a query]' '*+'{no,}'answer[print answer section of a reply]' '*+'{no,}'authority[print authority section of a reply]' - '*+'{no,}'additional[print additional section of a reply]' '*+'{no,}'all[set all print/display flags]' - '*+time=[set query timeout]:timeout (seconds)' + '*+'{no,}'subnet[send EDNS client subnet option]:addr/prefix-length' + '*+timeout=[set query timeout]:timeout (seconds) [5]' '*+tries=[specify number of UDP query attempts]:tries' '*+retry=[specify number of UDP query retries]:retries' + '*+'{no,}'rrcomments[set display of per-record comments]' '*+ndots=[specify number of dots to be considered absolute]:dots' '*+bufsize=[specify UDP buffer size]:size (bytes)' - '*+edns=[specify EDNS version for query]:version (0-255)' - '*+noedns[clean EDNS version]' '*+'{no,}'multiline[verbose multi-line output]' '*+'{no,}'onesoa[AXFR prints only one soa record]' '*+'{no,}"fail[don't try next server on SERVFAIL]" @@ -52,6 +69,10 @@ local -a alts args '*+trusted-key=[specify file conrtaing trusted kets]: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,}'unknownformat[print RDATA in RFC 3597 "unknown" format]' + '*+'{no,}'zflag[set Z flag in query]' ) _arguments -s -C $args \ '(- *)-h[display help information]' \ diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django index 029687696..9eaa2284a 100644 --- a/Completion/Unix/Command/_django +++ b/Completion/Unix/Command/_django @@ -49,6 +49,7 @@ case $state in "sqlreset:print the DROP TABLE and CREATE TABLE statements for the given app(s)" "sqlsequencereset:print the SQL statements for resetting sequences for the given app(s)" "startapp:create Django app directory in this project's directory" + "startproject:create a Django project directory structure for a given project name" "syncdb:create database tables for apps in INSTALLED_APPS where required" "test:run the test suite for the specified app, or the entire site" "testserver:run a development server with data from the given fixture(s)" diff --git a/Completion/Unix/Command/_dmidecode b/Completion/Unix/Command/_dmidecode index 5701a9403..eb273586f 100644 --- a/Completion/Unix/Command/_dmidecode +++ b/Completion/Unix/Command/_dmidecode @@ -5,9 +5,10 @@ _arguments -s \ '(-)'{-h,--help}'[display usage information]' \ '(-q --quiet -u --dump)'{-q,--quiet}'[be less verbose]' \ '(--type -u --dump --dump-bin -s --string)'{-s+,--string=}':DMI string:(bios-vendor bios-version bios-release-date system-manufacturer system-product-name system-version system-serial-number system-uuid baseboard-manufacturer baseboard-product-name baseboard-version baseboard-serial-number baseboard-asset-tag chassis-manufacturer chassis-type chassis-version chassis-serial-number chassis-asset-tag processor-family processor-manufacturer processor-version processor-frequency)' \ - '*(-s --string --dump-bin)'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \ + '(-s --string --dump-bin)*'{-t+,--type=}'[only display entries of specified type]:entry type:(bios system baseboard chassis processor memory cache connector slot)' \ '(-q --quiet -u --dump -s --string)'{-u,--dump}"[don't decode entries]" \ '--dump-bin=[dump DMI data to a binary file]:file:_files' \ '(-d --dev-mem)--from-dump=[read DMI data from a binary file]:file:_files' \ "--no-sysfs[don't attempt to read DMI data from sysfs files]" \ + '--oem-string=[only display the value of the specified OEM string]:OEM string number' \ '(-)'{-V,--version}'[display version information]' diff --git a/Completion/Unix/Command/_entr b/Completion/Unix/Command/_entr new file mode 100644 index 000000000..8a830ae71 --- /dev/null +++ b/Completion/Unix/Command/_entr @@ -0,0 +1,9 @@ +#compdef entr + +_arguments -s -S \ + '-c[execute clear before invoking utility]' \ + '-d[track directories and exit if a new file is added]' \ + '-p[postpone first execution of the utility]' \ + '-r[reload a persistent child process]' \ + '(-):command name:_command_names -e' \ + '*::arguments:_normal' diff --git a/Completion/Unix/Command/_flex b/Completion/Unix/Command/_flex index 7ca5b0f83..80b0cd7fc 100644 --- a/Completion/Unix/Command/_flex +++ b/Completion/Unix/Command/_flex @@ -1,35 +1,52 @@ -#compdef flex +#compdef flex flex++ local curcontext="$curcontext" state line ret=1 typeset -A opt_args -_arguments -C -s \ - --help --version \ - '-b[generate backing-up information]' \ - '-d[make scanner running in debug mode]' \ - '-f[generate fast scanner (full table)]' \ - '-h[show help]' \ - '-i[generate case-insensitive scanner]' \ - '-l[maximum compatibility with lex]' \ - '-p[generate performance report]' \ - '-s[suppress default rule]' \ - '-t[write scanner to stdout]' \ - '-v[show summary of statistics about scanner]' \ - '-w[suppress warnings]' \ - '-B[generate batch scanner]' \ - '-F[use fast scanner table representation]' \ - '-I[generate interactive scanner]' \ - '-L[don'"'"'t generate #line directives]' \ - '-T[trace mode]' \ - '-V[show version]' \ - '-7[generate 7-bit scanner]' \ - '-8[generate 8-bit scanner]' \ - '-\+[generate C++ scanner class]' \ +_arguments -C -s -S \ '-C-[specify degree of table compression]:table compression:->tabcomp' \ - '-o-[specify output file]:output file:_files' \ - '-P-[change yy prefix]:prefix string:' \ - '-S-[override skeleton file]:skeleton file:_files' \ - '*:input files:_files -g "*.(#i)(f|)lex(-.)"' && ret=0 + '--align[trade off larger tables for better memory alignment]' \ + '--ecs[construct equivalence classes]' \ + '--meta-ecs[construct meta-equivalence classes]' \ + '--read[use read() instead of stdio for scanner input]' \ + '(-f --full)'{-f,--full}'[generate fast scanner (full table)]' \ + '(-F --fast)'{-F,--fast}'[use fast scanner table representation]' \ + '(-d --debug)'{-d,--debug}'[enable debug mode in scanner]' \ + '(-b --backup)'{-b,--backup}'[write backup information to lex.backup]' \ + '(-p --perf-report)'{-p,--perf-report}'[generate performance report]' \ + '(-s --nodefault)'{-s,--nodefault}'[suppress default rule to ECHO unmatched text]' \ + '(-T --trace)'{-T,--trace}'[trace mode]' \ + '(-w --nowarn)'{-w,--nowarn}'[suppress warnings]' \ + '(-v --verbose)'{-v,--verbose}'[show summary of statistics about scanner]' \ + '--hex[use hexadecimal numbers instead of octal in debug outputs]' \ + '(-o --outfile)'{-o+,--outfile=}'[specify output file]:output file:_files' \ + '(-S --skel)'{-S+,--skel=}'-[override skeleton file]:skeleton file:_files' \ + '(-t --stdout)'{-t,--stdout}'[write scanner to stdout]' \ + '--yyclass=[specify name of C++ class]:class name' \ + '--header-file=-[create a C header file in addition to the scanner]:file:_files' \ + '--tables-file=-[write tables to file]::tables file:_files' \ + '(-7 -8 --7bit --8bit)'{-7,--7bit}'[generate 7-bit scanner]' \ + '(-7 -8 --7bit --8bit)'{-8,--8bit}'[generate 8-bit scanner]' \ + '(-B --batch -I --interactive)'{-B,--batch}'[generate batch scanner]' \ + '(-i --case-insensitive)'{-i,--case-insensitive}'[generate case-insensitive scanner]' \ + '(-l --lex-compat)'{-l,--lex-compat}'[maximum compatibility with original lex]' \ + '(-X --posix-compat)'{-l,--posix-compat}'[maximum compatibility with POSIX lex]' \ + '(-B --batch -I --interactive)'{-I,--interactive}'[generate interactive scanner]' \ + '--yylineno[track line count in yylineno]' \ + '-\+[generate C++ scanner class]' \ + '-D-[define macro]:macro' \ + '(-L --noline)'{-L,--noline}"[don't generate #line directives]" \ + '(-P --prefix)'{-P+,--prefix=}'[change yy prefix]:prefix string' \ + '(-R --reentrant)'{-R,--reentrant}'[generate a reentrant C scanner]' \ + '--bison-bridge[scanner for bison pure parser]' \ + '--bison-locations[include yylloc support]' \ + '--stdinit[initialize yyin/yyout to stdin/stdout]' \ + "--nounistd[don't include <unistd.h>]" \ + "--no-[don't generate a particular function]:function" \ + '(-c -n)'{-c,-n}'[do nothing]' \ + '(- *)'{-h,--help}'[display help information]' \ + '( *)'{-V,--version}'[display version information]' \ + '*:input file:_files -g "*.(#i)(f|)lex(-.)"' && ret=0 if [[ -n "$state" ]]; then _values -s '' 'table compression' \ @@ -38,7 +55,7 @@ if [[ -n "$state" ]]; then '(m)f[generate full tables]' \ '(m)F[generate fast tables]' \ '(f F)m[construct meta-equivalence classes]' \ - 'r[don'"'"'t use stdio library]' && ret=0 + "r[don't use stdio library]" && ret=0 fi return ret diff --git a/Completion/Unix/Command/_fmt b/Completion/Unix/Command/_fmt new file mode 100644 index 000000000..759396637 --- /dev/null +++ b/Completion/Unix/Command/_fmt @@ -0,0 +1,60 @@ +#compdef fmt + +local variant +local -a args +local copt="[preserve indentation of first two lines]" +local wopt="[specify maximum line width]:width [75]" +local sopt="[don't join short lines\: split only]" + +args=( -A "-*" "(1 2)-w+$wopt" '*:file:_files' ) +_pick_variant -r variant gnu=GNU unix --version +case $variant in + gnu) + args=( + '(-c --crown-margin)'{-c,--crown-margin}$copt + '(-w --width)'{-w+,--width=}$wopt + '(-p --prefix)'{-p+,--prefix=}'[only reformat lines with specified prefix]:prefix' + '(-s --split-only)'{-s,--split-only}$sopt + '(-t --tagged-paragraph)'{-t,--tagged-paragraph}'[indentation of first line different from second]' + '(-u --uniform-spacing)'{-u,--uniform-spacing}'[use one space between words, two after sentences]' + '(-g --goal)'{-g,--goal=}'[specify goal width]:goal width [93% of width]' + '(- *)--help[display help information]' + '(- *)--version[display version information]' + '*:file:_files' + ) + ;; + solaris*) + args=( + "-c$copt" + "-s$sopt" + ) + ;; + netbsd*) + args+=( + '-C[center the text]' + '(1 2)-g+[specify goal width]:goal width' + '(1 2)-m+[specify maximum width]:maximum width' + '-r[format all lines]' + ) + ;| + darwin*|dragonfly*|freebsd*|openbsd*) + args+=( + '-c[center the text line by line]' + '-m[sensible formatting of mail header lines]' + '-n[format lines beginning with a . (dot) character]' + "-p[change in indentation doesn't start new paragraph]" + '-s[collapse whitespace inside lines]' + '-d+[specify sentence-ending characters]:sentence ends [.?!]' + '-l+[replace initial spaces with tabs]:tab width [8]' + '-t+[specify tab width of input files]:tab width [8]' + ) + ;& # fall-through + netbsd*) + args+=( ':: :_guard "[0-9]#" goal width' ) + (( ${(M)#words[1,CURRENT-1]:#[0-9]##} )) && args+=( + ':: :_guard "[0-9]#" maximum width' + ) + ;; +esac + +_arguments -s -S $args diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index 1276054db..28a2ccbda 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -94,7 +94,7 @@ romp) ;; mips*) args=( - '-mcpu=:CPU type:(r2000 r3000 r4000 r4400 r4600 r6000_' + '-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 @@ -353,7 +353,7 @@ args+=( '-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 <standard>]:standard:(c90 c89 c99 c11 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y)' + '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 c99 c11 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)' '*-include:include file:_files -g \*.h\(-.\)' '*-imacros:macro input file:_files -g \*.h\(-.\)' '*-idirafter:second include path directory:_files -/' @@ -428,7 +428,7 @@ args+=( '-Wdisabled-optimization[Warn when an optimization pass is disabled]' '-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]' + '-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 #elif and #endif]' '-Wenum-compare[Warn about comparison of different enum types]' diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b5b3e79eb..518e6d198 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -292,7 +292,7 @@ _git-branch () { declare l c m d e l='--color --no-color -r --remotes -a -v --verbose --abbrev --no-abbrev --list --points-at --sort' - c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --merged --no-merged' + c='-l --create-reflog -f --force -t --track --no-track -u --set-upstream --set-upstream-to --unset-upstream --contains --no-contains --merged --no-merged' m='-m --move -M' d='-d --delete -D' e='--edit-description' @@ -341,9 +341,10 @@ _git-branch () { "($l $m $d $e)--no-track[override the branch.autosetupmerge configuration variable]" \ "($l $m $d $e -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 $e -u --set-upstream --set-upstream-to --unset-upstream)--unset-upstream[remove upstream configuration]" \ - "($l $m $d $e)--contains=[only list branches which contain the specified commit]: :__git_committishs" \ - "($l $m $d $e)--merged=[only list branches which are fully contained by HEAD]: :__git_committishs" \ - "($l $m $d $e)--no-merged=[don't list branches which are fully contained by HEAD]: :__git_committishs" \ + "($l $m $d $e)*--contains=[only list branches that contain the specified commit]: :__git_committishs" \ + "($l $m $d $e)*--no-contains=[only list branches that don't contain the specified commit]: :__git_committishs" \ + "($l $m $d $e)--merged=[only list branches that are fully contained by HEAD]: :__git_committishs" \ + "($l $m $d $e)--no-merged=[don't list branches that are fully contained by HEAD]: :__git_committishs" \ "($c $l $m $d)--edit-description[edit branch description]" \ $dependent_creation_args \ "($l $c $d $m $e)"{-m,--move}"[rename a branch and the corresponding reflog]" \ @@ -354,6 +355,7 @@ _git-branch () { {-q,--quiet}"[be more quiet]" \ '*--sort=[specify field to sort on]: :__git_ref_sort_keys' \ '--points-at=[only list tags of the given object]: :__git_commits' \ + "($c $m $d $e -i --ignore-case)"{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \ $dependent_deletion_args } @@ -460,6 +462,7 @@ _git-checkout () { '(-)'{-p,--patch}'[interactively select hunks in diff between given tree-ish and working tree]' \ "--ignore-skip-worktree-bits[don't limit pathspecs to sparse entries only]" \ "--ignore-other-worktrees[don't check if another worktree is holding the given ref]" \ + '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ '(-q --quiet)--progress[force progress reporting]' \ '(-)--[start file arguments]' \ '*:: :->branch-or-tree-ish-or-file' && ret=0 @@ -473,32 +476,29 @@ _git-checkout () { [[ $line[CURRENT] = -* ]] && return if (( CURRENT == 1 )) && [[ -z $opt_args[(I)--] ]]; then # TODO: Allow A...B - local branch_arg='' \ + local \ remote_branch_noprefix_arg='remote-branch-names-noprefix::__git_remote_branch_names_noprefix' \ - tree_ish_arg='tree-ishs::__git_tree_ishs' \ + tree_ish_arg='tree-ishs::__git_commits_prefer_recent' \ file_arg='modified-files::__git_modified_files' if [[ -n ${opt_args[(I)-b|-B|--orphan|--detach]} ]]; then - remote_branch_noprefix_arg= - file_arg= + _alternative $tree_ish_arg && ret=0 elif [[ -n $opt_args[(I)--track] ]]; then - branch_arg='remote-branches::__git_remote_branch_names' - remote_branch_noprefix_arg= - tree_ish_arg= - file_arg= + _alternative remote-branches::__git_remote_branch_names && ret=0 elif [[ -n ${opt_args[(I)--ours|--theirs|-m|--conflict|--patch]} ]]; then - remote_branch_noprefix_arg= + _alternative $tree_ish_arg $file_arg && ret=0 + else + _alternative \ + $file_arg \ + $tree_ish_arg \ + $remote_branch_noprefix_arg \ + && ret=0 fi - _alternative \ - $branch_arg \ - $remote_branch_noprefix_arg \ - $tree_ish_arg \ - $file_arg && ret=0 elif [[ -n ${opt_args[(I)-b|-B|-t|--track|--orphan|--detach]} ]]; then _nothing - elif [[ -n $line[1] ]] && __git_is_treeish $line[1]; then - __git_ignore_line __git_tree_files ${PREFIX:-.} $line[1] && ret=0 + elif [[ -n $line[1] ]] && __git_is_treeish ${(Q)line[1]}; then + __git_ignore_line __git_tree_files ${PREFIX:-.} ${(Q)line[1]} && ret=0 else __git_ignore_line __git_modified_files && ret=0 fi @@ -628,9 +628,10 @@ _git-clone () { '*--shallow-exclude=[shallow clone excluding commits reachable from specified remote revision]:revision' \ '(--no-single-branch)--single-branch[clone only history leading up to the main branch or the one specified by -b]' \ '(--single-branch)--no-single-branch[clone history leading up to each branch]' \ + "--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]' \ + '--recurse-submodules=-[initialize submodules in the clone]::file:__git_files' \ '--separate-git-dir[place .git dir outside worktree]:path to .git dir:_path_files -/' \ '(-4 --ipv4 -6 --ipv6)'{-4,--ipv4}'[use IPv4 addresses only]' \ '(-4 --ipv4 -6 --ipv6)'{-6,--ipv6}'[use IPv6 addresses only]' \ @@ -688,7 +689,7 @@ _git-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]' \ - '(-n --no-verify)'{-n,--no-verify}'[do not look for suspicious lines the commit introduces]' \ + '(-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]' \ '--cleanup=[specify how the commit message should be cleaned up]:mode:((verbatim\:"do not change the commit message at all" @@ -726,6 +727,7 @@ _git-commit () { _git-describe () { _arguments -S -s \ '(*)--dirty=-[describe HEAD, adding mark if dirty]::mark' \ + '(*)--broken=-[describe HEAD, adding mark if broken]::mark' \ '--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]' \ @@ -734,7 +736,8 @@ _git-describe () { '(--candidates )--exact-match[only output exact matches, same as --candidates=0]' \ '--debug[display information about the searching strategy]' \ '(--abbrev)--long[always show full format, even for exact matches]' \ - '--match=[only consider tags matching glob pattern]:pattern' \ + '*--match=[only consider tags matching glob pattern]:pattern' \ + "*--exclude=[don't consider tags matching glob pattern]:pattern" \ '--always[show uniquely abbreviated commit object as fallback]' \ '--first-parent[follow only the first parent of merge commits]' \ '*: :__git_committishs' @@ -754,7 +757,8 @@ _git-diff () { $diff_options \ '(--exit-code)--quiet[disable all output]' \ $diff_stage_options \ - '(--cached --staged)'{--cached,--staged}'[show diff between index and named commit]' \ + '(--cached --staged)--no-index[show diff between two paths on the filesystem]' \ + '(--cached --staged --no-index)'{--cached,--staged}'[show diff between index and named commit]' \ '(-)--[start file arguments]' \ '*:: :->from-to-file' && ret=0 @@ -772,6 +776,12 @@ _git-diff () { return ret fi + # If "--no-index" was given, only file paths need to be completed. + if [[ -n ${opt_args[(I)--no-index]} ]]; then + _alternative 'files::_files' && ret=0 + return ret + fi + # Otherwise, more complex conditions need to be checked. case $CURRENT in (1) @@ -965,6 +975,8 @@ _git-grep () { '(--cached)--no-index[search files in current directory, not just tracked files]' \ '(--exclude-standard)--no-exclude-standard[search also in ignored files]' \ '(--no-exclude-standard)--exclude-standard[exclude files standard ignore mechanisms]' \ + '--recurse-submodules[recursively search in each submodule]' \ + "--parent-basename=[prepend parent project's basename to output]:basename" \ '--untracked[search also in untracked files]' \ '(-a --text)'{-a,--text}'[process binary files as if they were text]' \ '(--textconv --no-textconv)--textconv[honor textconv filter settings]' \ @@ -1001,7 +1013,7 @@ _git-grep () { '(1)*-e+[use the given pattern for matching]:pattern' \ $pattern_operators \ '--all-match[all patterns must match]' \ - ':pattern' \ + ': :_guard "^-*" pattern' \ '*:: :->tree-or-file' && ret=0 # TODO: If --cached, --no-index, -O, or --open-files-in-pager was given, @@ -1175,6 +1187,7 @@ _git-merge () { '( --no-rerere-autoupdate)--rerere-autoupdate[allow the rerere mechanism to update the index]' \ '(--rerere-autoupdate )--no-rerere-autoupdate[do not allow the rerere mechanism to update the index]' \ '--abort[restore the original branch and abort the merge operation]' \ + '--continue[continue the current in-progress merge]' \ '--progress[force progress reporting]' \ '*: : __git_commits -O expl:git_commit_opts' } @@ -1355,6 +1368,7 @@ _git-push () { '--recurse-submodules=[submodule handling]:submodule handling:(( check\:"refuse to push if submodule commit not to be found on remote" on-demand\:"push all changed submodules" + only\:"submodules will be recursively pushed while the superproject is left unpushed" no\:"no submodule handling"))' \ "(--no-signed --signed)--sign=-[GPG sign the push]::signing enabled:(($^^sign))" \ '(--no-signed --sign)--signed[GPG sign the push]' \ @@ -1396,6 +1410,7 @@ _git-rebase () { '(-)--abort[abort current rebase]' \ '(-)--edit-todo[edit interactive instruction sheet in an editor]' \ '(-)--skip[skip the current patch]' \ + '(-)--quit[abort but keep HEAD where it is]' \ - options \ '(-m --merge)'{-m,--merge}'[use merging strategies to rebase]' \ '(-S --gpg-sign --no-gpg-sign)'{-S-,--gpg-sign=-}'[GPG-sign the commit]::key id' \ @@ -1421,6 +1436,7 @@ _git-rebase () { '(--autostash --no-autostash)--no-autostash[do not 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]' \ '--no-ff[cherry-pick all rebased commits with --interactive, otherwise synonymous to --force-rebase]' \ '--onto=[start new branch with HEAD equal to given revision]:newbase:__git_revisions' \ ':upstream branch:__git_revisions' \ @@ -1439,6 +1455,7 @@ _git-reset () { '(--soft --mixed --merge --keep -p --patch -- *)--hard[match the working tree and index to the given tree]' \ '(--soft --mixed --hard --keep -p --patch -- *)--merge[reset out of a conflicted merge]' \ '(--soft --mixed --hard --merge -p --patch -- *)--keep[like --hard, but keep local working tree changes]' \ + '--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]' \ '(--soft --mixed --hard --merge --keep):: :__git_commits' \ @@ -1447,6 +1464,12 @@ _git-reset () { case $state in (file) local tree=HEAD + if zstyle -t :completion:${curcontext}: verbose; then + if ! tree=$(_call_program headed git rev-parse --verify HEAD); then + # well-known sha1 of the empty tree + tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904 + fi + fi if [[ -n $line[1] ]] && __git_is_treeish $line[1]; then tree=$line[1] fi @@ -1606,6 +1629,7 @@ _git-stash () { _arguments -C \ '*::: :->args' \ + '(-m --message)'{-m,--message}'[specify stash description]' \ ${save_arguments//#\(/(* } && ret=0 if [[ -n $state ]]; then @@ -1613,7 +1637,7 @@ _git-stash () { local -a commands commands=( - save:'save your local modifications to a new stash' + {push,save}:'save your local modifications to a new stash' list:'list the stashes that you currently have' show:'show the changes recorded in the stash as a diff' pop:'remove and apply a single stashed state from the stash list' @@ -1635,6 +1659,12 @@ _git-stash () { $save_arguments \ ':: :_guard "([^-]?#|)" message' && ret=0 ;; + (push) + _arguments -S \ + $save_arguments \ + '(-m --message)'{-m,--message}'[specify stash description]' \ + ':: :__git_modified_files' && ret=0 + ;; (list) local -a log_options revision_options __git_setup_log_options @@ -1693,9 +1723,10 @@ _git-status () { fi _arguments -S -s \ - '(-s --short --column --no-column)'{-s,--short}'[output in short format]' \ + '(-s --short --column --no-column --show-stash)'{-s,--short}'[output in short format]' \ $branch_opts \ '(-s --short)--porcelain=-[produce machine-readable output]:version:(v1)' \ + '(-s --short)--show-stash[show stash information]' \ '(-u --untracked-files)'{-u-,--untracked-files=-}'[show untracked files]::mode:((no\:"show no untracked files" \ normal\:"show untracked files and directories" \ all\:"also show untracked files in untracked directories (default)"))' \ @@ -1729,6 +1760,7 @@ _git-submodule () { update:'update a 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' sync:'synchronize submodule settings') _describe -t commands command commands && ret=0 @@ -1817,8 +1849,13 @@ _git-submodule () { '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ '*: :__git_ignore_line_inside_arguments __git_submodules' && ret=0 ;; + (absorbgitdirs) + _arguments -S \ + '(-q --quiet)'{-q,--quiet}'[suppress all output]' \ + '*:path:_directories' + ;; (*) - _nothing + _default ;; esac ;; @@ -1947,14 +1984,16 @@ _git-tag () { '(-l --list)'{-l,--list}'[list tags matching pattern]' \ '(--no-column)--column=-[display tag listing in columns]::column.tag option:((always\:"always show in columns" never\:"never show in columns" auto\:"show in columns if the output is to the terminal" column\:"fill columns before rows (default)" row\:"fill rows before columns" plain\:"show in one column" dense\:"make unequal size columns to utilize more space" nodense\:"make equal size columns"))' \ '(--column)--no-column[do not display in columns]' \ - '--contains=[only list tags which contain the specified commit]: :__git_commits' \ + '*--contains=[only list tags that contain the specified commit]: :__git_commits' \ + "*--no-contains=[only list tags that don't contain the specified commit]: :__git_commits" \ '--merged=-[print only tags that are merged]:: :__git_commits' \ '--no-merged=-[print only tags that are not merged]:: :__git_commits' \ '--sort=[specify how the tags should be sorted]:mode:((refname\:"lexicographic order" version\\\:refname\:"tag names are treated as version numbers"))' \ '--points-at=[only list tags of the given object]: :__git_commits' \ - '--format=[specify format to use for the output]' \ - '::pattern' \ + '--format=[specify format to use for the output]:format' \ + '(-i --ignore-case)'{-i,--ignore-case}'[sorting and filtering are case-insensitive]' \ + ':: :_guard "^-*" pattern' \ - verification \ '(-v --verify)'{-v,--verify}'[verify gpg signutare of tags]' \ '*:: :__git_ignore_line_inside_arguments __git_tags' @@ -3336,6 +3375,7 @@ _git-filter-branch () { # such. # TODO: * should be git-rev-arg and git-rev-list arguments. _arguments -S -A '-*' \ + '--setup[specify one time setup command]: :_cmdstring' \ '--env-filter[filter for modifying environment in which commit will be performed]: :_cmdstring' \ '--tree-filter[filter for rewriting tree and its contents]: :_cmdstring' \ '--index-filter[filter for rewriting index]: :_cmdstring' \ @@ -3607,6 +3647,7 @@ _git-repack () { '--window=[number of objects to consider when doing delta compression]:number of objects' \ '--window-memory=[scale window size dynamically to not use more than specified amount of memory]: : __git_guard_bytes' \ '--depth=[maximum delta depth]:maximum delta depth' \ + '--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]' } @@ -3661,7 +3702,6 @@ _git-blame () { '-s[suppress author name and timestamp]' \ '-w[ignore whitespace when finding lines]' \ '--indent-heuristic[use indent-based heuristic to improve diffs]' \ - '--compaction-heuristic[use blank-line-based heuristic to improve diffs]' \ $revision_options \ ':: :__git_revisions' \ ': :__git_cached_files' && ret=0 @@ -3714,7 +3754,8 @@ _git-difftool () { '--tool-help[print a list of diff tools that may be used with --tool]' \ '(--symlinks)--no-symlinks[make copies of instead of symlinks to the working tree]' \ '(---no-symlinks)--symlinks[make symlinks to instead of copies of the working tree]' \ - '(-g --gui)'{-g,--gui}'[use diff.guitool instead of diff.tool]' + '(-g --gui)'{-g,--gui}'[use diff.guitool instead of diff.tool]' \ + '--trust-exit-code[make git-difftool exit when diff tool returns a non-zero exit code]' } (( $+functions[_git-fsck] )) || @@ -3949,6 +3990,7 @@ _git-verify-tag () { _arguments -S -s \ '(-v --verbose)'{-v,--verbose}'[print contents of the tag object before validating it]' \ '--raw[print raw gpg status output]' \ + '--format=[specify format to use for the output]:format' \ '*: :__git_tags' } @@ -4661,6 +4703,8 @@ _git-read-tree () { $exclude_per_directory_opt \ '--index-output=[write index in the named file instead of $GIT_INDEX_FILE]: :_files' \ '--no-sparse-checkout[display sparse checkout support]' \ + '--debug-unpack[debug unpack-trees]' \ + '--recurse-submodules=-[control recursive updating of submodules]::checkout:__git_commits' \ '--empty[instead of reading tree object(s) into the index, just empty it]' \ '1:first tree-ish to be read/merged:__git_tree_ishs' \ '2::second tree-ish to be read/merged:__git_tree_ishs' \ @@ -4875,7 +4919,9 @@ _git-for-each-ref () { '*--points-at=[print only refs which point at the given object]:object:__git_commits' \ '*--merged=[print only refs that are merged]:object:__git_commits' \ '*--no-merged=[print only refs that are not merged]:object:__git_commits' \ - '*--contains=[print only refs which contain the commit]:object:__git_commits' \ + '*--contains=[print only refs that contain specified commit]:object:__git_commits' \ + "*--no-contains=[print only refs that don't contain specified commit]:object:__git_commits" \ + '--ignore-case[sorting and filtering are case-insensitive]' \ '(-s --shell -p --perl --python --tcl)'{-s,--shell}'[use string literals suitable for sh]' \ '(-s --shell -p --perl --python --tcl)'{-p,--perl}'[use string literals suitable for Perl]' \ '(-s --shell -p --perl --tcl)'--python'[use string literals suitable for Python]' \ @@ -4980,7 +5026,9 @@ _git-merge-base () { _git-name-rev () { _arguments -S \ '--tags[only use tags to name commits]' \ - '--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \ + '*--refs=[only use refs matching given pattern]: :_guard "?#" "shell pattern"' \ + '--no-refs[clear any previous ref patterns given]' \ + '*--exclude=[ignore refs matching specified pattern]:pattern' \ '(--stdin :)--all[list all commits reachable from all refs]' \ '(--all :)--stdin[read from stdin and append revision-name]' \ '--name-only[display only name of commits]' \ @@ -5159,6 +5207,7 @@ _git-send-pack () { "(--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' \ '--progress[force progress reporting]' \ '--thin[send a thin pack]' \ '--atomic[request atomic transaction on remote side]' \ @@ -5294,7 +5343,7 @@ _git-check-attr () { {-a,--all}'[list all attributes that are associated with the specified paths]' \ '--stdin[read file names from stdin instead of from command line]' \ '--cached[consider .gitattributes in the index only, ignoring the working tree.]' \ - '-z[make output format machine-parseable and treat input-paths as NUL-separated with --stdin]' \ + '-z[terminate input and output records by a NUL character]' \ $z_opt \ '(-)--[interpret preceding arguments as attributes and following arguments as path names]' \ '*:: :->attribute-or-file' && ret=0 @@ -5477,7 +5526,7 @@ __git_describe_branch () { shift 3 integer maxverbose - if zstyle -s :completion:$curcontext max-verbose maxverbose && + if zstyle -s :completion:$curcontext: max-verbose maxverbose && (( ${compstate[nmatches]} <= maxverbose )); then local __c local -a __commits @@ -6114,12 +6163,13 @@ __git_recent_branches__names() # 2. Extracts the move-source from each # 3. Eliminates duplicates # 4. Eliminates commit hashes (leaving only ref names) + # [This step is done again by the caller.] # # See workers/38592 for an equivalent long-hand implementation, and the rest # of that thread for why this implementation was chosen instead. # # Note: since we obtain the "from" part of the reflog, we only obtain heads, not tags. - reply=(${${(u)${${(0)"$(_call_program reflog git reflog -1000 -z --grep-reflog='\^checkout:\ moving\ from\ ' --pretty='%gs')"}#checkout: moving from }%% *}:#[[:xdigit:]](#c40)}) + reply=(${${(u)${${(M)${(0)"$(_call_program reflog git reflog -1000 -z --pretty='%gs')"}:#(#s)checkout: moving from *}#checkout: moving from }%% *}:#[0-9a-f](#c40)}) } (( $+functions[__git_recent_branches] )) || @@ -6156,6 +6206,10 @@ __git_recent_branches() { _describe -V -t recent-branches "recent branches" branches_colon_descriptions } +(( $+functions[__git_commits_prefer_recent] )) || +__git_commits_prefer_recent () { + _alternative 'recent-branches::__git_recent_branches' 'commits::__git_commits' +} (( $+functions[__git_commits] )) || __git_commits () { @@ -6309,11 +6363,11 @@ __git_recent_commits () { ret=1 # Resetting expl to avoid it 'leaking' from one line to the next. expl=() + _describe -V -t commits 'recent commit object name' descr && ret=0 + expl=() _wanted commit-tags expl 'commit tag' compadd "$@" -a - tags && ret=0 expl=() _wanted heads expl 'head' compadd "$@" -a - heads && ret=0 - expl=() - _describe -V -t commits 'recent commit object name' descr && ret=0 return $ret } @@ -6484,9 +6538,10 @@ __git_references () { _git_refs_cache_pwd=$PWD fi - _wanted references expl 'reference' compadd -a - _git_refs_cache + _wanted references expl 'reference' compadd -M 'r:|/=**' -a - _git_refs_cache } +# ### currently unused; are some callers of __git_references supposed to call this function? (( $+functions[__git_local_references] )) || __git_local_references () { local expl @@ -6497,7 +6552,7 @@ __git_local_references () { _git_local_refs_cache_pwd=$PWD fi - _wanted references expl 'reference' compadd -a - _git_local_refs_cache + _wanted references expl 'reference' compadd -M 'r:|/=**' -a - _git_local_refs_cache } (( $+functions[__git_remote_references] )) || @@ -6864,7 +6919,8 @@ __git_setup_diff_options () { $diff_types'--name-only[show only names of changed files]' $diff_types'--name-status[show only names and status of changed files]' '--submodule=-[select output format for submodule differences]::format:((short\:"show pairs of commit names" - log\:"list commits like git submodule does"))' + log\:"list commits like git submodule does" + diff\:"show differences"))' '( --no-color --color-words)--color=-[show colored diff]:: :__git_color_whens' '(--color --color-words)--no-color[turn off colored diff]' '--word-diff=-[show word diff]::mode:((color\:"highlight changed words using color" @@ -6908,7 +6964,7 @@ __git_setup_diff_options () { '(--no-prefix)--dst-prefix=[use given prefix for destination]: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]' + '(-c --cc)'{-c,--cc}'[combined diff format for merge commits]' # TODO: --output is undocumented. '--output[undocumented]:undocumented') diff --git a/Completion/Unix/Command/_gphoto2 b/Completion/Unix/Command/_gphoto2 index 314d83e3a..788c9702f 100644 --- a/Completion/Unix/Command/_gphoto2 +++ b/Completion/Unix/Command/_gphoto2 @@ -1,47 +1,96 @@ #compdef gphoto2 -_arguments -s \ +local curcontext="$curcontext" ret=1 +local -a state line values expl +typeset -A opt_args + +_arguments -s -C \ + '(-)'{-\?,--help}'[display help information]' \ + '(-)'{-h,--usage}'[display a short usage message]' \ '--debug[turn on debugging]' \ + '--debug-loglevel=[set debug level]:debug level:(error debug data all)' \ + '--debug-logfile=[name of file to write debug info to]:file:_files' \ '(-q --quiet)'{-q,--quiet}'[quiet output]' \ - '(-v --version)'{-v,--version}'[display version and exit]' \ - '(-h --help)'{-h,--help}'[display a short usage message]' \ - '--list-cameras[list supported camera models]' \ - '--list-ports[list supported port devices]' \ + '--hook-script=[hook script to call after downloads, captures, etc.]:file:_files' \ '--stdout[send file to stdout]' \ '--stdout-size[print filesize before data]' \ '--auto-detect[list auto-detected cameras]' \ - '--port[specify port device]:port' \ - '--speed[specify serial transfer speed]:speed' \ - '--camera[specify camera model]:camera model' \ - '--filename[specify pattern to save file as]:pattern' \ - '--usbid[override USB IDs (expert only)]:usbid' \ + '--show-exif=[show EXIF information of JPEG images]:range' \ + '--show-info=[show image information, like width, height, and capture time]:range' \ + '--summary[summary of camera status]' \ + '--manual[camera driver manual]' \ + '--about[show information about the camera driver]' \ + '--storage-info[show storage information]' \ + '--shell[start the gphoto2 shell]' \ + '(-)'{-v,--version}'[display version and exit]' \ + '--list-cameras[list supported camera models]' \ + '--list-ports[list supported port devices]' \ '(-a --abilities)'{-a,--abilities}'[display camera abilities]' \ - '(-f --folder)'{-f,--folder}'[specify camera folder]:folder' \ - '(-R --recurse --no-recurse)'{-R,--recurse}'[recursion (default for download)]' \ - '(-R --recurse)--no-recurse[no recursion (default for deletion)]' \ + '--port=[specify port device]:port:->ports' \ + '--speed=[specify serial transfer speed]:speed' \ + '--camera=[specify camera model]:camera model:->models' \ + '--usbid=[override USB IDs (expert only)]:usbid' \ + '--list-config[list configuration tree]' \ + '--list-all-config[dump full configuration tree]' \ + '--get-config=[get configuration value]:string' \ + '--set-config=[set configuration value or index in choices]:string' \ + '--set-config-index=[set configuration value index in choices]:string' \ + '--set-config-value=[set configuration value]:string' \ + '--config[start curses configuration menu]' \ + '--reset[reset device port]' \ + '--keep[keep images on camera after capturing]' \ + '--keep-raw[keep the RAW images on the camera with --capture-image-and-download]' \ + '--no-keep[remove images from camera after capturing]' \ + '--wait-event=-[wait for event from camera]::count' \ + '--wait-event-and-download=-[wait for event from camera and download new images]::count' \ + '--capture-preview[capture a quick preview]' \ + '--show-preview[capture a quick preview and display using ASCII art]' \ + '(-B --bulb)'{-B,--bulb=}'[set bulb exposure time]:exposure time (seconds)' \ + '(-F --frames)'{-F,--frames=}'[set number of frames to capture]:frames [unlimited]' \ + '(-I --interval)'{-I,--interval=}'[set capture interval in seconds]:interval (seconds)' \ + '--reset-interval[reset capture interval on signal]' \ + '--capture-image[capture an image]' \ + '--trigger-capture[trigger capture of an image]' \ + '--capture-image-and-download[capture an image and download it]' \ + '--capture-movie=-[capture a movie]:count or seconds' \ + '--capture-sound[capture an audio clip]' \ + '--capture-tethered=-[wait for shutter release on the camera and download]::count' \ '(-l --list-folders)'{-l,--list-folders}'[list folders in folder]' \ '(-L --list-files)'{-L,--list-files}'[list files in folder]' \ - '(-m --mkdir)'{-m,--mkdir}'[create a directory]:directory' \ - '(-r --rmdir)'{-r,--rmdir}'[remove a directory]:directory' \ - '(-n --num-files)'{-n,--num-files}'[sisplay number of files]' \ - '(-p --get-file)'{-p,--get-file}'[get files given in range]:range' \ + '(-m --mkdir)'{-m,--mkdir=}'[create a directory]:directory' \ + '(-r --rmdir)'{-r,--rmdir=}'[remove a directory]:directory' \ + '(-n --num-files)'{-n,--num-files}'[display number of files]' \ + '(-p --get-file)'{-p,--get-file=}'[get files given in range]:range' \ '(-P --get-all-files)'{-P,--get-all-files}'[get all files from folder]' \ - '(-t --get-thumbnail)'{-t,--get-thumbnail}'[get thumbnails given in range]:range' \ + '(-t --get-thumbnail)'{-t,--get-thumbnail=}'[get thumbnails given in range]:range' \ '(-T --get-all-thumbnails)'{-T,--get-all-thumbnails}'[get all thumbnails from folder]' \ - '(-r --get-raw-data)'{-r,--get-raw-data}'[get raw data given in range]:range' \ + '--get-metadata=[get metadata given in range]:range' \ + '--get-all-metadata[get all metadata from folder]' \ + '--upload-metadata=[upload metadata for file]:string' \ + '--get-raw-data=[get raw data given in range]:range' \ '--get-all-raw-data[get all raw data from folder]' \ - '--get-audio-data[get audio data given in range]:range' \ + '--get-audio-data=[get audio data given in range]:range' \ '--get-all-audio-data[get all audio data from folder]' \ - '--delete-file[delete files given in range]:range' \ - '--delete-all-files[delete all files in folder]' \ - '(-u --upload-file)'{-u,--upload-file}'[upload a file to camera]:file:_files' \ - '--capture-preview[capture a quick preview]' \ - '--capture-image[capture an image]' \ - '--capture-movie[capture a movie]' \ - '--capture-sound[capture an audio clip]' \ - '--show-info[show info about given range]:range' \ - '--summary[summary of camera status]' \ - '--manual[camera driver manual]' \ - '--about[show information about the camera driver]' \ - '--shell[start the gphoto2 shell]' + '(-d --delete-file)'{-d,--delete-file=}'[delete files in given range]:range' \ + '(-D --delete-all-files)'{-D,--delete-all-files}'[delete all files in folder]' \ + '(-u --upload-file)'{-u,--upload-file=}'[upload a file to camera]:file:_files' \ + '--filename=[specify pattern to save file as]:pattern:_date_formats' \ + '(-f --folder)'{-f,--folder=}'[specify camera folder]:folder [/]' \ + '(-R --recurse --no-recurse)'{-R,--recurse}'[recursion (default for download)]' \ + '(-R --recurse)--no-recurse[no recursion (default for deletion)]' \ + '--new[process new files only]' \ + '--force-overwrite[overwrite files without asking]' \ + '--skip-existing[skip files that already exist on local filesystem]' && ret=0 + +case $state in + models) + _wanted models expl 'camera model' compadd \ + ${${${(f)"$(_call_program models $words[1] --list-cameras)"}[3,-1]#*\"}%%\"*} && ret=0 + ;; + ports) + values=( ${${${(f)"$(gphoto2 --list-ports)"}[4,-1]/:/\\:}/ ##/:} ) + _describe -t ports 'port' values + ;; +esac +return ret diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep index 5d548b567..5f45ce9a8 100644 --- a/Completion/Unix/Command/_grep +++ b/Completion/Unix/Command/_grep @@ -1,7 +1,6 @@ -#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep -value-,GREP_OPTIONS,-default- -# Ulrik Haugen 2001 +#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep -value-,GREP_OPTIONS,-default- -local arguments matchers command +local arguments matchers command variant if [[ $service = *GREP_OPT* ]]; then compset -q @@ -9,7 +8,7 @@ if [[ $service = *GREP_OPT* ]]; then (( CURRENT++ )) command=grep else - arguments=( '(-e --regexp -f --file)1: :_guard "^--*" pattern' ) + arguments=( '(-e --regexp -f --file)1: :_guard "^-*" pattern' ) if [[ $service = z* ]]; then arguments+=( '*:files:_files -g "*.gz(-.)"' ) else @@ -18,13 +17,12 @@ else command="$words[1]" fi -if [[ $service != (|z)[ef]grep ]]; then +if [[ $service != (|g)(|z)[ef]grep ]]; then matchers='(--extended-regexp --fixed-strings --basic-regexp --perl-regexp -E -F -G -P)' arguments+=( $matchers{--extended-regexp,-E}'[use extended regular expression]' $matchers{--fixed-strings,-F}'[use literal strings]' $matchers{--basic-regexp,-G}'[use basic regular expression]' - $matchers{--perl-regexp,-P}'[use perl regular expression]' ) fi @@ -32,14 +30,11 @@ arguments+=( '(--after-context -A)'{--after-context=,-A+}'[specify lines of trailing context]:lines' '(--text -a --binary-files -I)'{--text,-a}'[process binary file as if it were text]' '(--before-context -B)'{--before-context=,-B+}'[specify lines of leading context]:lines' - '(--context,-C)'{--context=,-C-}'[specify lines of context]:lines' + '(--context -C)'{--context=,-C-}'[specify lines of context]:lines' '(--color --colour)--'{color,colour}'=-[distinguish matching string]::when:(always never auto)' - '(--no-group-separator)--group-separator=[specify separator between blocks of context]:separator [--]' - "(--group-separator)--no-group-separator[don't separate context blocks]" '(--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]' - '(-T --initial-tab)'{-T,--initial-tab}'[make tabs line up (if needed)]' '(--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' @@ -50,30 +45,75 @@ arguments+=( '--line-buffered[flush output on every line]' '(--text -a --binary-files)-I[process binary files as if non-matching]' '(--ignore-case -i -y)'{--ignore-case,-i,-y}'[case-insensitive]' - '(--files-without-match -L --file-with-matches -l --no-filename -h)'{--files-without-match,-L}"[output non-matching files' names only]" - '(--files-with-matches -l --files-without-match -L --no-filename -h)'{--files-with-matches,-l}"[output matching files' names only]" - '(--max-count -m)'{--max-count=,-m+}'[stop after specified no of matches]:max number of matches' + '(--files-without-match -L --file-with-matches -l --no-filename -h -o --only-matching)'{--files-without-match,-L}"[output non-matching files' names only]" + '(--files-with-matches -l --files-without-match -L --no-filename -h -o --only-matching)'{--files-with-matches,-l}"[output matching files' names only]" + '(--max-count -m)'{--max-count=,-m+}'[stop after specified no of matches in each file]:max number of matches' '(--line-number -n -c)'{--line-number,-n}'[prefix output with line numbers]' - '(--only-matching -o)'{--only-matching,-o}'[show only matching part of line]' + '(--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]' - '(--recursive -r --dereference-recursive -R -d --directories)'{--dereference-recursive,-R}'[recurse subdirectories, following symlinks]' '*--include=[examine files matching specified pattern]:file pattern' '*--exclude=[skip files matching specified pattern]:file pattern' - '*--exclude-from=[skip files matching pattern in specified file]:file:_files' '*--exclude-dir=[skip directories matching specified pattern]:directory pattern' '(--no-messages -s)'{--no-messages,-s}'[suppress messages about unreadable]' '(--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]' '(--line-regexp -x --word-regexp -w)'{--line-regexp,-x}'[force pattern to match only whole lines]' - '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after FILE name]' - '--help[display help]' + '(-)--help[display help information]' ) -# remove long options? -_pick_variant -c "$command" gnu=gnu unix --help || - arguments=( ${arguments:#(|*\)(\*|))--*} ) +_pick_variant -r variant -c "$command" gnu=gnu gpl2=2.5.1 unix --version +case $variant:$OSTYPE in + (gnu:*|gpl2:freebsd*)) + [[ $service != (|g)(|z)[ef]grep ]] && arguments+=( + $matchers{--perl-regexp,-P}'[use perl regular expression]' + ) + ;| + (gnu:*|gpl2:(free|net)bsd*)) + arguments+=( + '*--exclude-from=[skip files matching pattern in specified file]:file:_files' + '(-z --null-data)'{-z,--null-data}'[input data separated by 0 byte, not newline]' + ) + ;| + gpl2:freebsd*) + arguments+=( + '(--null --no-filename -h)--null[print 0 byte after each filename]' + ) + ;| + gpl2:(freebsd|darwin)*) + arguments+=( + '(-Z --decompress -J --bz2decompress)'{-J,--bz2decompress}"[decompress bzip2'ed input before searching]" + '(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]" + ) + ;| + (gnu:*|gpl2:netbsd*)) + arguments+=( + '(--null -Z --no-filename -h)'{--null,-Z}'[print 0 byte after each filename]' + ) + ;| + gnu:*) + arguments+=( + '(--no-group-separator)--group-separator=[specify separator between blocks of context]:separator [--]' + "(--group-separator)--no-group-separator[don't separate context blocks]" + '(-T --initial-tab)'{-T,--initial-tab}'[make tabs line up (if needed)]' + '(--recursive -r --dereference-recursive -R -d --directories)'{--dereference-recursive,-R}'[recurse subdirectories, following symlinks]' + ) + ;; + gpl2:*) arguments=( ${${arguments:#*\)-r}/\)-r/\)-R} ) ;; + *:openbsd*) + arguments=( + ${(M)arguments:#((#s)|*\))--(context|binary-files|line-buffered)*} + ${${arguments:#((#s)|*\))(\*|)-[d-]*}/\)-r/\)-R} + "-U[search binary files but don't print them]" + '-Z[behave as zgrep]' + ) + ;; + *) + # remove long options and GNU specific short opts, this is right for solaris + arguments=( ${arguments:#((#s)|*\))(\*|)-[aABCdDfGHILmorVy-]*} ) + ;; +esac _arguments -S -s $arguments[@] diff --git a/Completion/Unix/Command/_gsettings b/Completion/Unix/Command/_gsettings index 72f015729..890b56403 100644 --- a/Completion/Unix/Command/_gsettings +++ b/Completion/Unix/Command/_gsettings @@ -13,7 +13,7 @@ if [[ $state = subargs ]]; then curcontext="${curcontext%:*}-$words[1]:" case $words[1] in help) state=subcmds;; - get|range|reset|writable|monitor) + describe|get|range|reset|writable|monitor) _arguments ':schema:->schemata' ':key:->keys' ;; set) diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg index 8d31cd377..8eaa457c8 100644 --- a/Completion/Unix/Command/_hg +++ b/Completion/Unix/Command/_hg @@ -876,7 +876,7 @@ _hg_cmd_qdiff() { _hg_cmd_qfold() { _arguments -s : $_hg_global_opts $_h_commit_opts \ - '(--keep,-k)'{-k,--keep}'[keep folded patch files]' \ + '(--keep -k)'{-k,--keep}'[keep folded patch files]' \ '*:unapplied patch:_hg_qunapplied' } diff --git a/Completion/Unix/Command/_iftop b/Completion/Unix/Command/_iftop index 41ffb4ea1..05db3fa03 100644 --- a/Completion/Unix/Command/_iftop +++ b/Completion/Unix/Command/_iftop @@ -1,9 +1,16 @@ #compdef iftop _interfaces () { - _wanted interfaces expl 'network interface' \ - _net_interfaces - _values "Pseudo-device that captures on all interfaces" "any" + local disp expl sep + _description interfaces expl 'network interface' + _net_interfaces "$expl[@]" + if zstyle -t ":completion:${curcontext}:interfaces" verbose; then + zstyle -s ":completion:${curcontext}:interfaces" list-separator sep || sep=-- + disp=( "any $sep capture on all interfaces" ) + compadd "$expl[@]" -ld disp any + else + compadd "$expl[@]" any + fi } _arguments \ @@ -14,7 +21,7 @@ _arguments \ -P'[turn on port display]' \ -b"[don't display bar graphs of traffic]" \ -B'[display bandwidth rates in bytes/sec rather than bits/sec]' \ - -i'[interface]:network interface:_interfaces' \ - -f'[filter]:BPF filter' \ - -F'[net/mask]:network/mask' \ - -c'[config file]:config file:_files' + '-i+[interface]:network interface:_interfaces' \ + '-f+[filter]:BPF filter' \ + '-F+[net/mask]:network/mask' \ + '-c+[config file]:config file:_files' diff --git a/Completion/Unix/Command/_ip b/Completion/Unix/Command/_ip index 1ca3f1ade..6e1cc3b78 100644 --- a/Completion/Unix/Command/_ip +++ b/Completion/Unix/Command/_ip @@ -172,7 +172,7 @@ _regex_words \ link-set-commands 'link set commands' \ 'dev:specify device:$subcmd_dev' \ 'u*p:change state to up' \ - 'do*wn:change state do down' \ + 'do*wn:change state to down' \ 'ar*p:change ARP flag on device:$subcmd_onoff' \ 'mu*lticast:change MULTICAST flag on device:$subcmd_onoff' \ 'pr*omisc:set promiscuous mode:$subcmd_onoff' \ diff --git a/Completion/Unix/Command/_irssi b/Completion/Unix/Command/_irssi index fd64b5efc..ee1e1ef43 100644 --- a/Completion/Unix/Command/_irssi +++ b/Completion/Unix/Command/_irssi @@ -30,7 +30,6 @@ _arguments -s \ '--noconnect[disable autoconnect]' \ '(-n --nick)'{-n,--nick=}'[set nick name]:nick:_irssi_nick' \ '(-h --hostname)'{-h,--hostname=}'[specify hostname]:hostname:_hosts' \ - '(-d --dummy)'{-d,--dummy}'[use the dummy terminal mode]' \ '(-)'{-v,--version}'[display version information]' \ '(-)'{-\?,--help}'[display help information]' \ '(-)--usage[display usage]' diff --git a/Completion/Unix/Command/_java b/Completion/Unix/Command/_java index 7a1224677..30231c5ee 100644 --- a/Completion/Unix/Command/_java +++ b/Completion/Unix/Command/_java @@ -65,7 +65,7 @@ java) '-D-[specify a property]:property:->property' \ \*{-enableassertions,-ea}-::class \ \*{-disableassertions,-da}-::class \ - '(-enablesystemassertions,-esa,-disablesystemassertions,-dsa)'{-enablesystemassertions,-esa,-disablesystemassertions,-dsa} \ + '(-enablesystemassertions -esa -disablesystemassertions -dsa)'{-enablesystemassertions,-esa,-disablesystemassertions,-dsa} \ '(-verbose:class)-verbose[print class information]' \ '(-verbose)-verbose\:class[print class information]' \ '-verbose\:gc[print gc information]' \ diff --git a/Completion/Unix/Command/_kvno b/Completion/Unix/Command/_kvno index 782d9e6fc..9664e187b 100644 --- a/Completion/Unix/Command/_kvno +++ b/Completion/Unix/Command/_kvno @@ -3,15 +3,17 @@ local curcontext="$curcontext" state line ret=1 _arguments -C \ - '(-4)-c[specify credentials cache to use]:cache:_files' \ - '(-4)-e[specify encryption type]:encryption type' \ + '-c[specify credentials cache to use]:cache:_files' \ + '-e[specify encryption type]:encryption type' \ '-q[suppress printing]' \ '(- :)-h[display help information]' \ - '(-c -e)-4[kerberos 4 tickets]' \ + '-P[acquire credentials for the principal during S4U2Self]' \ + '-S[specify the service name of the principal]:service' \ + '-U[specify user for S4U2Self]:user:_users' \ ':principal:->principal' && ret=0 if [[ $state = principal ]]; then - if compset -P host/; then + if compset -P '*/'; then _hosts && ret=0 else _alternative \ diff --git a/Completion/Unix/Command/_lha b/Completion/Unix/Command/_lha index c2d5e7d8d..e8d47fcdb 100644 --- a/Completion/Unix/Command/_lha +++ b/Completion/Unix/Command/_lha @@ -1,5 +1,7 @@ #compdef lha +local expl + if (( CURRENT == 2 )); then compset -P - diff --git a/Completion/Unix/Command/_libvirt b/Completion/Unix/Command/_libvirt index 1aa8ed817..a3ab5a68a 100644 --- a/Completion/Unix/Command/_libvirt +++ b/Completion/Unix/Command/_libvirt @@ -20,6 +20,7 @@ typeset -A dom_opts dom_opts=( console " " destroy " " + edit " " managedsave " " reboot " " reset " " @@ -95,7 +96,7 @@ case $service in '(- *)'{-h,--help}'[print help information and exit]' \ '(- *)'{-v,--version}'[print version information and exit]' \ '(- *)'{-q,--quiet}'[quiet mode]' \ - '1:hv-type:(qemu lxc)' && return + '1:hv-type:(qemu lxc bhyve)' && return ;; virt-pki-validate) _arguments -A "-*" -S \ @@ -197,7 +198,7 @@ case $state in return 1 fi # Allow passing domain without --domain with few of the most used commands - if [[ $cmd == (destroy|reboot|reset|start|shutdown) ]]; then + if [[ $cmd == (destroy|edit|reboot|reset|start|shutdown) ]]; then if [[ $words[CURRENT-1] == $cmd ]]; then values=( $(_call_program domains "noglob virsh $conn_opt list ${dom_opts[$cmd]:-"--all"} --name") ) [[ -n $values ]] && _wanted domains expl domain compadd ${=values} && return 0 diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 694f506c3..23305f798 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -1,132 +1,96 @@ -#compdef locate mlocate slocate +#compdef locate mlocate slocate glocate -# Decide if we are using mlocate or slocate. -local ltype basename=${words[1]:t} input -# If we can't, use this guess. -local best_guess=mlocate +local variant=$service +local -a args +[[ $service = locate ]] && + _pick_variant -r variant glocate=findutils mlocate=mlocate slocate=secure $OSTYPE -V +args=( '(-)'{-V,--version}'[display version information]' ) -case $basename in - ([ms]locate) - ltype=$basename - ;; - - (locate) - input="$(_call_program locate $words[1] -V 2>&1)" - case $input in - (*mlocate*) - ltype=mlocate - ;; - - (*(#i)secure locate*) - ltype=slocate - ;; - - (*(#i)gnu locate*|*findutils*gnu*) - ltype=gnu - ;; - - (*"illegal option"*) - if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then - ltype=bsd - else - ltype=$best_guess - fi - ;; - - # guess - (*) - ltype=$best_guess - ;; - esac - ;; - - (*) - # too dangerous to run: guess - ltype=$best_guess -esac +case $variant in + [mg]locate) + args+=( + '(-A --all)'{-A,--all}'[only print entries that match all patterns]' + '(-E --non-existing -e --existing)'{-e,--existing}'[restrict display to existing files]' + '(-c --count)'{-c,--count}'[output the number of matching entries]' + '(-i --ignore-case)'{-i,--ignore-case}'[ignore case distinctions in patterns]' + '(-w --wholename -b --basename)'{-w,--wholename}'[match entire file path (default)]' + '(-w --wholename -b --basename)'{-b,--basename}'[match only the basename of files in the database]' + '(-P -H --no-follow -L --follow)'{-P,-H,--nofollow}"[don't follow symbolic links]" + '(-P -H --no-follow -L --follow)'{-L,--follow}'[follow symbolic links to find existing files (default)]' + '(-0 --null)'{-0,--null}'[output separated by NUL characters]' + '(-S --statistics)'{-S,--statistics}'[show database statistics]' + ) + ;| -case $ltype in (mlocate) - # actually, -d can take a colon-separate list # -r/--regexp mean no normal arguments, so shouldn't complete # -m and --mmap are ignored, so don't bother # -s and --stdio likewise - _arguments -s -S : \ - {-b,--basename}'[match only the basename of files in the database]' \ - {-c,--count}'[output the number of matching entries]' \ - {-d,--database=}'[use alternative database]:database:_files' \ - {-e,--existing}'[restrict display to existing files]' \ - {-L,--follow}'[follow symbolic links to find existing files (default)]' \ - {-h,--help}'[show help]' \ - {-i,--ignore-case}'[ignore case distinctions in patterns]' \ - {-l,-n,--limit=}'[limit search results]:file limit: ' \ - {-P,-H,--nofollow}'[don'\''t follow symbolic links]' \ - {-0,--null}'[output separated by NUL characters]' \ - {-S,--statistics}'[show database statistics]' \ - {-q,--quiet}'[don'\''t report errors]' \ - {-r,--regexp=}'[search for given basic regexp]:basic regexp: ' \ - --regex'[patterns are extended regexps]' \ - {-V,--version}'[show version]' \ - {-w,--wholename}'[match entire file path (default)]' \ - '*:pattern: ' + args=( -s -S : $args + \*{-d,--database=}'[use alternative database]:database:_sequence -s \: _files' + '(-)'{-h,--help}'[display help information]' + '(-l -n --limit)'{-l,-n,--limit=}'[limit search results]:file limit' + '(-q --quiet)'{-q,--quiet}"[don't report errors]" + '(:)*'{-r,--regexp=}'[search for given basic regexp]:basic regexp' + '--regex[patterns are extended regexps]' + ) ;; (slocate) # -d can take path # -e can take a comma-separated list of directories. # -f should complete list of file system types like mount - _arguments -s -S : \ - -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 -/' \ - -f'[exclude file system types from db with -u, -U]:file system:_file_systems' \ - -l'[security level]:level:(0 1)' \ - -q'[quiet mode]' \ - -n'[limit search results]:file limit: ' \ - -i'[case insensitive search]' \ - {-r,--regexp=}'[use basic regular expression]:regexp: ' \ - {-o,--output=}'[specify database to create]:database:_files' \ - {-d,--database=}'[specify database to search]:database:_files' \ - {-h,--help}'[display help]' \ - {-v,--verbose}'[display files when creating database]' \ - {-V,--version}'[display version]' \ - '*:pattern: ' + args=( -s -S : $args + -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 -/' + -f'[exclude file system types from db with -u, -U]:file system:_file_systems' + -l'[security level]:level:(0 1)' + -q'[quiet mode]' + -n'[limit search results]:file limit ' + -i'[case insensitive search]' + {-r,--regexp=}'[use basic regular expression]:regexp' + {-o,--output=}'[specify database to create]:database:_files' + {-d,--database=}'[specify database to search]:database:_files' + '(-)'{-h,--help}'[display help information]' + {-v,--verbose}'[display files when creating database]' + ) ;; - (gnu) - _arguments -s : \ - {-d,--database=}'[use alternative database]:database:_files' \ - {-e,--existing}'[restrict display to existing files]' \ - {-E,--non-existing}'[allow display of nonexistent files (default)]' \ - {-i,--ignore-case}'[ignore case distinctions in patterns]' \ - {-w,--wholename}'[match entire file path (default)]' \ - {-b,--basename}'[match only the basename of files in the database]' \ - {-l,-n,--limit=}'[limit search results]:file limit: ' \ - {-S,--statistics}'[show database statistics]' \ - {-0,--null}'[output separated by NUL characters]' \ - {-c,--count}'[output the number of matching entries]' \ - {-P,-H,--nofollow}'[don'\''t follow symbolic links]' \ - {-L,--follow}'[follow symbolic links to find existing files (default)]' \ - {-A,-all}'[match all arguments instead of at least one]' \ - {-p,--print}'[include search results with statistics or count]' \ - {-r,--regex=}'[patterns are regular expressions]:basic regexp: ' \ - --regextype='[select type of regular expression]' \ - {-V,--version}'[show version]' \ - --help'[show help]' \ - '*:pattern: ' + (glocate) + args=( -s : $args + \*{-d,--database=}'[use alternative database]:database:_files' + '(-E --non-existing -e --existing)'{-E,--non-existing}'[restrict display to nonexistent files]' + '(-l --limit)'{-l,--limit=}'[limit search results]:file limit: ' + '--max-database-age[specify database age at which warning should be issued]:age (days) [8]' + '(-p --print)'{-p,--print}'[include search results with statistics or count]' + \*{-r,--regex=}'[patterns are regular expressions]:regexp' + --regextype='[select type of regular expression]:regex type [basic]:(findutils-default awk egrep ed emacs gnu-awk grep posix-awk posix-basic posix-egrep posix-extended posix-minimal-basic sed)' + '(-)'--help'[display help information]' + ) ;; - (bsd) - _arguments -s -S -A '-*' \ - '(-S)-0[separate file names by NUL characters]' \ - '(- *)-S[show database statistics and exit]' \ - '(-S)-c[output the number of matching file names]' \ - '(-S)*-d[specify database to search]:database:_files' \ - '(-S)-i[ignore case distinctions in pattern and database]' \ - '(-S)-l[limit output to specified number of file names]:file limit: ' \ - '(-S)-m[use mmap(2) instead of stdio(3) (default)]' \ - '(-S)-s[use stdio(3) instead of mmap(2)]' \ - '*:pattern: ' - ;; + (freebsd|openbsd|dragonfly|darwin)*) + args=( -s -S -A '-*' + '(-S)-c[output the number of matching file names]' + '(-S)-i[ignore case distinctions in pattern and database]' + '(-S)-l[limit output to specified number of file names]:file limit ' + '(- *)-S[show database statistics and exit]' + ) + ;| + openbsd*) + args+=( '(-S)-b[match only the basename of files in the database]' ) + ;| + (freebsd|dragonfly|darwin)*) + args+=( + '(-S)-0[separate file names by NUL characters]' + '(-S)-m[use mmap(2) instead of stdio(3) (default)]' + '(-S)-s[use stdio(3) instead of mmap(2)]' + ) + ;| + (*) args+=( '(-S)*-d[specify database to search]:database:_files' ) ;; + esac + +_arguments $args '*: :_guard "^-*" pattern' diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index 74f317ad1..955b0894d 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -11,10 +11,10 @@ if ! _pick_variant gnu=gnu unix --help; then '-R[list subdirectories recursively]' '(-k)-h[print sizes in human readable form]' + '(-h)-k[print sizes in kilobytes]' '-i[print file inode numbers]' '(-l -g -1 -C -m -x)-l[long listing]' - '(-l -1 -C -m -x)-g[long listing but without owner information]' '(-l -g -C -m -x)-1[single column output]' '(-l -g -1 -m -x)-C[list entries in columns sorted vertically]' '(-l -g -1 -C -x)-m[comma separated]' @@ -27,6 +27,7 @@ if ! _pick_variant gnu=gnu unix --help; then '-r[reverse sort order]' + '(-t)-S[sort by size]' '(-S)-t[sort by modification time]' '(-p)-F[append file type indicators]' @@ -34,31 +35,80 @@ if ! _pick_variant gnu=gnu unix --help; then '-n[numeric uid, gid]' - '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]' '(-B -b -w -q)-q[hide control chars]' '*:files:_files' ) if [[ "$OSTYPE" = (netbsd*|dragonfly*|freebsd*|openbsd*|darwin*) ]]; then arguments+=( - '(-h)-k[print sizes of 1k]' - '(-t)-S[sort by size]' '-T[show complete time information]' - '-o[display file flags]' - '-f[output is not sorted]' - '(-B -b -w -q)-w[print raw characters]' + '(-a -A -r -S -t)-f[output is not sorted]' + ) + fi + if [[ $OSTYPE = (netbsd*|dragonfly*|freebsd*|openbsd*) ]]; then + arguments+=( '-o[display file flags]' ) + fi + if [[ $OSTYPE = (netbsd*|dragonfly*|freebsd*|darwin*) ]]; then + arguments+=( '(-B -b -w -q)-B[print octal escapes for control characters]' + '(-B -b -w -q)-b[as -B, but use C escape codes whenever possible]' + '(-B -b -w -q)-w[print raw characters]' + '-W[display whiteouts when scanning directories]' ) fi - if [[ "$OSTYPE" = (freebsd*|darwin*) ]]; then + if [[ $OSTYPE = (netbsd*|openbsd*|darwin*|solaris*) ]]; then + arguments+=( + '(-l -1 -C -m -x)-g[long listing but without owner information]' + ) + fi + if [[ $OSTYPE = netbsd* ]]; then + arguments+=( + '-M[output file sizes in comma-separated form]' + '-O[output only leaf (non-directory) files]' + '-P[print full pathname for each file]' + "-X[don't cross mount points when recursing]" + ) + fi + if [[ $OSTYPE = (dragonfly*|freebsd*|openbsd*|darwin*) ]]; then + arguments+=( '-H[follow symlinks on the command line]' ) + fi + if [[ $OSTYPE = (dragonfly*|freebsd*|darwin*) ]]; then arguments+=( '-G[enable colorized output]' - '-H[follow symlinks on the command line]' '-P[do not follow symlinks]' ) fi + if [[ $OSTYPE = (dragonfly*|freebsd*) ]]; then + arguments+=( + '(-A)-I[prevent -A from being automatically set for the super-user]' + ) + fi + if [[ $OSTYPE = dragonfly* ]]; then + arguments+=( '-y[display FSMID in long listing]' ) + fi + if [[ $OSTYPE = (freebsd*|darwin*) ]]; then + arguments+=( '(-c -u)-U[file creation time]' ) + fi + if [[ $OSTYPE = freebsd* ]]; then + arguments+=( + '-,[print file sizes grouped and separated by thousands]' + '-D+[specify format for date]:format: _date_formats' + '-y[with -t, sort filenames in the same order as the time]' + '-Z[display MAC label]' + ) + fi + if [[ $OSTYPE = darwin* ]]; then + arguments+=( + '-@[display extended attribute keys and sizes in long listing]' + '-e[display ACL in long listing]' + '(-l -1 -C -m -x)-o[long listing but without group information]' + '-O[display file flags]' + '-v[print raw characters]' + ) + fi if [[ $OSTYPE = solaris* ]]; then arguments+=( + '(-q)-b[print octal escapes for control characters]' '(-l -1 -C -m -x)-o[long listing but without group information]' '(-l -t -s -r -a)-f[interpret each argument as a directory]' '(-E -l)-e[long listing with full and consistent date/time]' @@ -78,14 +128,15 @@ else '(--ignore-backups -B)'{--ignore-backups,-B}"[don't list entries ending with ~]" '(--directory -d)'{--directory,-d}'[list directory entries instead of contents]' '(--dired -D)'{--dired,-D}"[generate output designed for Emacs' dired mode]" - '(--ignore,-I)'{--ignore,-I}"[don't list entire matching pattern]:pattern:" - '(--dereference -L --dereference-command-line --dereference-command-line-symlink-to-dir)'{--dereference,-L}'[list referenced file for sym link]' - '(--dereference -L --dereference-command-line --dereference-command-line-symlink-to-dir)'{--dereference-command-line,--dereference-command-line-symlink-to-dir} + '*'{--ignore=,-I+}"[don't list entries matching pattern]:pattern: " + '(--dereference -L --dereference-command-line -H --dereference-command-line-symlink-to-dir)'{--dereference,-L}'[list referenced file for sym link]' + '(--dereference -L --dereference-command-line -H --dereference-command-line-symlink-to-dir)'{--dereference-command-line,-H}'[follow symlink on the command line]' + '(--dereference -L --dereference-command-line -H)'--dereference-command-line-symlink-to-dir '(--recursive -R)'{--recursive,-R}'[list subdirectories recursively]' '(--no-group -G)'{--no-group,-G}'[inhibit display of group information]' - '(--human-readable -h -H --si)'{--human-readable,-h}'[print sizes in human readable form]' - '(--si -H -h --human-readable)'{--si,-H}'[sizes in human readable form; powers of 1000]' + '(--block-size --human-readable -h --si --kilobytes -k)'{--human-readable,-h}'[print sizes in human readable form]' + '(--block-size --human-readable -h --si --kilobytes -k)--si[sizes in human readable form; powers of 1000]' '(--inode -i)'{--inode,-i}'[print file inode numbers]' '(--format -l -g -o -1 -C -m -x)-l[long listing]' @@ -96,7 +147,7 @@ else '(--format -l -g -o -1 -m -x)-C[list entries in columns sorted vertically]' '(--format -l -g -o -1 -C -x)-m[comma separated]' '(--format -l -g -o -1 -C -m)-x[sort horizontally]' - '(-l -g -o -1 -C -m -x)--format=:format:(verbose long commas horizontal across vertical single-column)' + '(-l -g -o -1 -C -m -x)--format=[specify output format]:format:(verbose long commas horizontal across vertical single-column)' '(--size -s -f)'{--size,-s}'[display size of each file in blocks]' @@ -106,34 +157,35 @@ else '--time-style=[show times using specified style]:style: _alternative "time-styles\:time style\:(full-iso long-iso iso locale)" $datef' '(-a --all -U -l --format -s --size -t --sort --full-time)-f[unsorted, all, short list]' - '(--reverse)'{--reverse,-r}'[reverse sort order]' + '(--reverse -r -U -f)'{--reverse,-r}'[reverse sort order]' '(--sort -t -U -v -X)-S[sort by size]' '(--sort -S -U -v -X)-t[sort by modification time]' '(--sort -S -t -v -X)-U[unsorted]' '(--sort -S -t -U -X)-v[sort by version (filename treated numerically)]' '(--sort -S -t -U -v)-X[sort by extension]' - '(-S -t -U -v -X)--sort=:sort:(size time none version extension)' + '(-S -t -U -v -X)--sort=[specify sort key]:sort key:(size time none version extension)' '--color=-[control use of color]:color:(never always auto)' - "--hide=[don't list entries matching pattern]:pattern" + "*--hide=[like -I, but overridden by -a or -A]:pattern: " '(--classify -F --indicator-style -p --file-type)'{--classify,-F}'[append file type indicators]' - '(--file-type -p --indicator-style -F --classify)'{--file-type,-p}'[append file type indicators except *]' - '(-F --classify -p --file-type)--indicator-style=:indicator style:(none file-type classify slash)' + '(--file-type -p --indicator-style -F --classify)--file-type[append file type indicators except *]' + '(--file-type -p --indicator-style -F --classify)-p[append / to directories]' + '(-F --classify -p --file-type)--indicator-style=[specify indicator style]:indicator style:(none file-type classify slash)' '(-f)--full-time[list both full date and full time]' - '(--kilobytes -k --block-size)'{--kilobytes,-k}'[use block size of 1k]' - '(-k --kilobytes)--block-size=[specify block size]:block size (bytes):(1024)' + '(--block-size --human-readable -h --si --kilobytes -k)'{--kilobytes,-k}'[use block size of 1k]' + '(--human-readable -h --si --kilobytes -k)--block-size=[specify block size]:block size (bytes):(1024)' '(--numeric-uid-gid -n)'{--numeric-uid-gid,-n}'[numeric uid, gid]' '(--tabsize -T)'{--tabsize=,-T+}'[specify tab size]:tab size' '(--width -w)'{--width=,-w+}'[specify screen width]:screen width' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--escape,-b}'[print octal escapes for control characters]' - '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print raw characters]' + '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print entry names without quoting]' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--quote-name,-Q}'[quote names]' - '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)' + '(-b --escape -N --literal -Q --quote-name)--quoting-style=[specify quoting style]:quoting style:(literal shell shell-always c escape clocale locale)' '(--hide-control-chars -q --show-control-chars)'{--hide-control-chars,-q}'[hide control chars]' '(-q --hide-control-chars)--show-control-chars' @@ -148,4 +200,4 @@ else fi fi -_arguments -s $arguments +_arguments -s -S : $arguments diff --git a/Completion/Unix/Command/_lsof b/Completion/Unix/Command/_lsof index c12b9910a..bbb6eab59 100644 --- a/Completion/Unix/Command/_lsof +++ b/Completion/Unix/Command/_lsof @@ -1,6 +1,6 @@ #compdef lsof -local curcontext="$curcontext" state line fields args +local curcontext="$curcontext" state line expl fields args case $OSTYPE in linux*) args=( '-X[skip reporting of info on network connections]' ) ;; diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index b2aaeaf7e..67810e1dc 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -51,7 +51,11 @@ _man() { sect="${sect//:/|}" sect="${sect//,/|}" elif (( CURRENT > 2 )); then - sect=$words[2] + case $words[2] in + (-a) sect='*';; + (-*) ;; + (*) sect=$words[2];; + esac fi if [[ $sect = (<->*|1M|l|n) || $sect = *\|* ]]; then diff --git a/Completion/Unix/Command/_mount b/Completion/Unix/Command/_mount index 7c5605016..03cc01f8d 100644 --- a/Completion/Unix/Command/_mount +++ b/Completion/Unix/Command/_mount @@ -619,7 +619,7 @@ if (( ! $+_fs_any )); then 'longnames[force Windows 95 long filenames to be visible]' 'nowin95[completely ignore Windows 95 extended file information]' ) - if [[ "${OSTYPE}" =~ freebsd.* ]]; then + if [[ "${OSTYPE}" = freebsd* ]]; then _fs_msdosfs=( "$_fs_msdos[@]" ) fi ;; @@ -931,42 +931,7 @@ devordir) esac ;; udevordir) - local dev_tmp dpath_tmp mp_tmp mline - - case "$OSTYPE" in - linux*|irix*) - tmp=( "${(@f)$(< /etc/mtab)}" ) - dev_tmp=( "${(@)${(@)tmp%% *}:#none}" ) - mp_tmp=( "${(@)${(@)tmp#* }%% *}" ) - ;; - freebsd*|dragonfly*) - /sbin/mount | while read mline; do - dev_tmp+=( $mline[(w)1] ) - mp_tmp+=( $mline[(w)3] ) - done - ;; - darwin*) - tmp=( "${(@f)$(/sbin/mount)}" ) - dev_tmp=( "${(@)${(@)tmp%% *}:#map}" ) - mp_tmp=( "${(@)${(@)tmp#* on }%% \(*}" ) - ;; - *) - /sbin/mount | while read mline; do - mp_tmp+=( $mline[(w)1] ) - dev_tmp+=( $mline[(w)3] ) - done - ;; - esac - - local MATCH MBEGIN MEND - mp_tmp=("${(@g::)mp_tmp}") - dpath_tmp=( "${(@Mg::)dev_tmp:#/*}" ) - dev_tmp=( "${(@g::)dev_tmp:#/*}" ) - - _alternative \ - 'device-labels:device label:compadd -a dev_tmp' \ - 'device-paths: device path:_canonical_paths -A dpath_tmp -N -M "r:|/=* r:|=*" device-paths device\ path' \ - 'directories:mount point:_canonical_paths -A mp_tmp -N -M "r:|/=* r:|=*" directories mount\ point' && ret=0 + _umountable ;; labels) _wanted labels expl 'disk label' compadd /dev/disk/by-label/*(:t) && ret=0 diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc index 11eab8463..e0c6888b0 100644 --- a/Completion/Unix/Command/_mpc +++ b/Completion/Unix/Command/_mpc @@ -131,7 +131,7 @@ _mpc_helper_songnumbers() { (( $+functions[_mpc_helper_playlists] )) || _mpc_helper_playlists() { local list expl - list=($(mpc lsplaylists)) + list=(${(f)"$(mpc lsplaylists)"}) _wanted list expl playlist compadd -M $MPC_PLAYLIST_MATCHER $expl -a list } diff --git a/Completion/Unix/Command/_mysql_utils b/Completion/Unix/Command/_mysql_utils index 6532d0a7b..f1ad97bcd 100644 --- a/Completion/Unix/Command/_mysql_utils +++ b/Completion/Unix/Command/_mysql_utils @@ -212,7 +212,7 @@ _mysql_utils() { '--defaults-extra-file=[read specified file after the global files]:defaults file:_files' '(-S --socket)'{-S+,--socket=}'[specify socket file to use for connection]:server socket file:_files' '(-h --host)'{-h+,--host=}'[specify server hostname]:hostname:_mysql_hosts' - '(-P,--port)'{-P+,--port=}'[specify port number for connection]:server port:_mysql_ports' + '(-P --port)'{-P+,--port=}'[specify port number for connection]:server port:_mysql_ports' '(-u --user)'{-u+,--user=}'[specify username for login]:server username:_mysql_users' '(-p --password)'{-p-,--password=}'[specify password to use for connection]:server password' '(-C --compress)'{-C,--compress}'[use compression in server/client protocol]' diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 73d7508b4..146a69e8a 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -5,79 +5,130 @@ local args files variant files="*:object file:_object_files" args=( '(-A -o --print-file-name)'{-A,-o,--print-file-name}'[print name of input file on each line]' - '(--demangle)-C[decode symbol names]' + '(--demangle --no-demangle)-C[decode symbol names]' '(-D --dynamic)'{-D,--dynamic}'[display dynamic symbols instead of normal ones]' '(-g --extern-only)'{-g,--extern-only}'[display only global symbols]' '(-t --radix -o -x)'{-t,--radix}'[specify radix for numeric values]:radix:((d\:decimal o\:octal x\:hexadecimal))' ) if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfutils unix -V; then - compset -P '@' && files='*:options file:_files' args+=( '(- *)--help[display help information]' - '(- *)--version[display version information]' + '(- *)'{-V,--version}'[display version information]' '(-f --format -P --portability)-B[same as --format=bsd]' - '(-C --no-demangle)--demangle=-[decode symbol names]::style:(auto gnu lucid arm hp edg gnu-v3 java gnat)' - "(-C --demangle)--no-demangle[don't decode symbol names]" '(-u --undefined-only)--defined-only[display only defined symbols]' '(-f --format -P)--format=[specify output format]:format:(bsd sysv posix)' '(-n --numeric-sort -p --no-sort --size-sort -v)'{-n,--numeric-sort}'[sort symbols numerically by address]' - '(-p --no-sort -n --numeric-sort -r -P --reverse-sort --size-sort)'{-p,--no-sort}'[do not sort symbols]' + '(-p --no-sort -n -v --numeric-sort -r --reverse-sort --size-sort)'{-p,--no-sort}'[do not sort symbols]' '(-P --portability -B -f --format)'{-P,--portability}'[same as --format=posix]' - '(-r --reverse-sort -p --no-sort --size-sort -v)'{-r,--reverse-sort}'[reverse sort order]' + '(-r --reverse-sort -p --no-sort)'{-r,--reverse-sort}'[reverse sort order]' '(-u --undefined-only --defined-only)'{-u,--undefined-only}'[display only undefined symbols]' '(-a --debug-syms)'{-a,--debug-syms}'[display debugger-only symbols]' '(-S --print-size)'{-S,--print-size}'[print size of defined symbols]' '(-s --print-armap)'{-s,--print-armap}'[include index for symbols from archive members]' - '(-p --no-sort -n --numeric-sort -r -v)--size-sort[sort symbols by size]' ) case $variant in elftoolchain|binutils) args+=( '(-l --line-numbers)'{-l,--line-numbers}'[display source file and line numbers from debug information]' + "(-C --demangle)--no-demangle[don't decode symbol names]" + '(-p --no-sort -n -v --numeric-sort)--size-sort[sort symbols by size]' + '(-n --numeric-sort -p --no-sort --size-sort)-v[sort symbols numerically by address]' + '(- *)-h[display help information]' ) ;| elftoolchain) - args=( ${args:#*--(portability|extern-only)\[*} - '(- *)-h[display help information]' - '(-t -x)-o[print values in octal]' - '(-t -o)-x[print values in hexadecimal]' - '(--size-sort)-v[sort output by value]' + args=( ${args:#*(-C|-o|--portability)\[*} + '(-C --demangle)'{-C,--demangle=-}'[decode symbol names]::style:(auto gnu-v2 gnu-v3 arm)' + '(-g --extern-only)-e[only display global and static symbols]' + '(--format -P)-F+[specify output format]:format:(bsd sysv posix)' + '-o[with -P, same as -t o; otherwise same as -A]' + '(-t --radix)-x[print values in hexadecimal]' ) ;; elfutils) args+=( '--mark-special[mark special symbols]' '--color=[use color in output]:color:(always auto never)' + '(-C)--demangle[decode symbol names]' + '(--format -P)-f+[specify output format]:format:(bsd sysv posix)' + '(- *)--usage[give a short usage message]' + '(- *)-\\?[display help information]' ) ;; binutils) + compset -P '@' && files='*:options file:_files' args+=( '(-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)' '--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:*}##*: })" + '--with-symbol-versions[display version strings after symbol names]' ) ;; esac else - # following flags are accurate for Solaris - args=( ${args:#(|*\)(\*|))-[o-]*} - "-h[don't display column headers]" - '-l[distinguish WEAK symbols with * character]' - '(-t -x)-o[print values in octal]' - '(-v)-n[sort symbols by name]' - '(-P)-p[produce parsable output]' - '(-p)-P[portable output format]' - '(-r)-R[print archive name, object file and symbol name]' - '-r[prepend name of input file to each symbol name]' - '-s[print section name instead of index]' - '-u[print undefined symbols only]' - '(-n)-v[sort external symbols by value]' - '-V[display version of the nm command]' - '(-o -t)-x[print values in hexadecimal]' - ) + case $OSTYPE in + (darwin*|openbsd*) + args=( + '(-A -o)'{-A,-o}'[prepend file name to each output line]' + '(-g)-a[display all symbols including those for debuggers]' + '(-a)-g[display only global symbols]' + '(-U)-u[display only undefined symbols]' + '(-p)-n[sort numerically rather than alphabetically]' + "(-n -r)-p[don't sort; display in symbol-table order]" + '(-p)-r[sort in reverse order]' + '(-j)-P[print information in a portable format]' + '(-j)-t[specify radix for numeric values (used with -P)]:radix:((d\:decimal o\:octal x\:hexadecimal))' + );| + (darwin*) + args+=( + "(-u)-U[don't display undefined symbols]" + '-f[display symbol table of dynamic library flat]' + '(-P -t -m)-j[just display symbol names (no value or type)]' + '-l[display .section_start if no symbol is in the section (used with -s)]' + '(-j)-m[use verbose format for Mach-O symbols]' + '-s[list only symbols in the specified section]:segment name: :section name: ' + "-x[display symbol table entry's fields in hexadecimal]" + '*-arch[select architecture from universal file]:architecture:(all i386 x86_64)' + );; + (openbsd*) + args+=( + '-C[decode low-level symbol names]' + '-D[display dynamic symbol table instead of normal symbol table]' + '-e[output extended information]' + '-s[show archive index]' + '-w[warn about non-object archive members]' + );; + (solaris*) + args=( ${args:#(|*\)(\*|))-[o-]*} + "-h[don't display column headers]" + '-l[distinguish WEAK symbols with * character]' + '(-t -x)-o[print values in octal]' + '(-v)-n[sort symbols by name]' + '(-P)-p[produce parsable output]' + '(-p)-P[portable output format]' + '(-r)-R[print archive name, object file and symbol name]' + '-r[prepend name of input file to each symbol name]' + '-s[print section name instead of index]' + '-u[print undefined symbols only]' + '(-n)-v[sort external symbols by value]' + '-V[display version of the nm command]' + '(-o -t)-x[print values in hexadecimal]' + );; + (*) + # minimal POSIX + args=( + '-A[print name of input file on each line]' + '(-u)-g[display only global symbols]' + '-P[print information in a portable format]' + '-t[specify radix for numeric values]:radix:((d\:decimal o\:octal x\:hexadecimal))' + '(-g)-u[display only undefined symbols]' + '-v[sort symbols by value instead of by name]' + );; + esac fi -_arguments -s "$args[@]" $files +_arguments -s -S : "$args[@]" $files diff --git a/Completion/Unix/Command/_openstack b/Completion/Unix/Command/_openstack index 39fa30c3a..fcb704ac8 100644 --- a/Completion/Unix/Command/_openstack +++ b/Completion/Unix/Command/_openstack @@ -1,4 +1,4 @@ -#compdef openstack aodh barbican ceilometer cinder cloudkitty designate glance gnocchi heat ironic keystone magnum manila mistral monasca murano neutron nova sahara senlin swift trove +#compdef openstack aodh barbican ceilometer cinder cloudkitty designate freezer glance gnocchi heat ironic keystone magnum manila mistral monasca murano neutron nova sahara senlin tacker trove vitrage watcher zun # https://wiki.openstack.org/wiki/OpenStackClients # http://docs.openstack.org/user-guide/common/cli-install-openstack-command-line-clients.html @@ -23,8 +23,8 @@ local -a clnts_compl_new clnts_compl_old clnts_swift_like # # 3) Swift, slightly different from 2) # -clnts_compl_new=( aodh barbican designate gnocchi openstack ) -clnts_compl_old=( ceilometer cinder cloudkitty glance heat ironic keystone magnum manila mistral monasca murano neutron nova sahara senlin trove ) +clnts_compl_new=( aodh barbican designate freezer gnocchi openstack vitrage watcher ) +clnts_compl_old=( ceilometer cinder cloudkitty glance heat ironic keystone magnum manila mistral monasca murano neutron nova sahara senlin tacker trove zun ) clnts_swift_like=( swift ) # Python clients take quite some time to start up and some (openstack(1)) diff --git a/Completion/Unix/Command/_paste b/Completion/Unix/Command/_paste new file mode 100644 index 000000000..6efe8eacb --- /dev/null +++ b/Completion/Unix/Command/_paste @@ -0,0 +1,19 @@ +#compdef paste + +local -a args +local dopt='[specify delimiter list]:delimiter list [tab]' +local sopt='[paste one file at a time instead of in parallel]' + +if _pick_variant gnu=GNU unix --version; then + args=( + '(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line delimiter instead of newline]' + "(-d)--delimiters=$dopt" + "(-s)--serial$sopt" + '(- *)--help[display help information]' + '(- *)--version[display version information]' + ) +else + args=( -A "-?*" ) +fi + +_arguments -s $args "(--delimiters)-d+$dopt" "(--serial)-s$sopt" '*:file:_files' diff --git a/Completion/Unix/Command/_patchutils b/Completion/Unix/Command/_patchutils index 323c0a730..50ea3e4c4 100644 --- a/Completion/Unix/Command/_patchutils +++ b/Completion/Unix/Command/_patchutils @@ -43,6 +43,7 @@ case $service in '(-F --files)'{-F+,--files=}'[only list files within specified range]:range' '--strip=[remove specified number of pathname components before displaying]:components' '--addprefix=[insert specified path prefix before displaying path names]:prefix:_directories' + '*:diff file:_files' ) ;| grepdiff|lsdiff) @@ -58,7 +59,6 @@ case $service in \*{-v,--verbose}'[verbose operation]' '(-H --with-filename -h --no-filename)'{-H,--with-filename}'[print the name of the patch file containing each patch]' '!--filter' '!--grep' - '*:diff file:_files' ) ;; grepdiff|filterdiff) @@ -71,7 +71,7 @@ case $service in '--as-numbered-lines=[display lines of selected hunks]:line numbers:(before after)' "--remove-timestamps[don't include timestamps in output]" ) - ;; + ;| filterdiff) args+=( '(-X --exclude-from-file)'{-X+,--exclude-from-file=}'[exclude files matching any pattern listed in specified file]:file:_files' diff --git a/Completion/Unix/Command/_perforce b/Completion/Unix/Command/_perforce index db91e11af..3cd99d519 100644 --- a/Completion/Unix/Command/_perforce +++ b/Completion/Unix/Command/_perforce @@ -3,7 +3,7 @@ # Maintainer: Peter Stephenson <pws@csr.com>. # Increasingly loosely based on _cvs version 1.17. -# Completions currently based on Perforce release 2010.2. +# Completions currently based on Perforce release 2016.1. # Styles, tags and contexts # ========================= @@ -460,7 +460,7 @@ _perforce_call_p4() { # This is for our own use for parsing, and we need English output, # so... local +x P4LANGUAGE - _call_program $cp_tag p4 "${_perforce_global_options[@]}" "$@" + _call_program $cp_tag command p4 "${_perforce_global_options[@]}" "$@" } @@ -1656,11 +1656,12 @@ _perforce_variables() { (( $+functions[_perforce_cmd_add] )) || _perforce_cmd_add() { _arguments -s : \ - '-c+[select by change]:change:_perforce_changes -tc' \ - '-d[reopen removed file for add (downgrade)]' \ + '-c[add files to change]:change:_perforce_changes -tc' \ + '-d[reopen files for add]' \ '-f[allow filenames with wild cards]' \ - '-n[display operation without doing it]' \ - '-t+[set file type]:file type:_perforce_filetypes' \ + '-I[do not perform ignore checking]' \ + '-n[preview add]' \ + '-t[set file type]:file type:_perforce_filetypes' \ '*:file:_perforce_files -tu' } @@ -1682,15 +1683,15 @@ _perforce_cmd_admin() { shift words (( CURRENT-- )) _arguments -s : \ - '-z[gzip journal file]' \ - '1::journal file prefix: ' + '-z[gzip journal file]' \ + '1::journal file prefix: ' ;; (dbstat) shift words (( CURRENT -- )) _arguments -s : \ - '-s[show sizes]' + '-s[show sizes]' esac fi } @@ -1701,11 +1702,17 @@ _perforce_cmd_annotate() { # New in release 2002.2. # -c was new in about 2003.2. _arguments -s : \ - '-a[all, show both added and deleted lines]' \ - '-c[output change numbers instead of revisions]' \ - '-i[follow branches (integration records)]' \ - '-I[follow integrations to get change numbers]' \ - '-q[quiet, suppress one-line file header]' \ + '-a[include deleted files and lines]' \ + '-c[output change numbers]' \ + '-d-[select whitespace option]:whitespace option:(( +b\:ignore\ whitespace\ changes +w\:ignore\ whitespace +l\:ignore\ line\ endings))' \ + '-i[follow branches]' \ + '-I[follow all integrations]' \ + '-q[suppress one-line header]' \ + '-t[display binary files]' \ + '-u[output user and date]' \ '*::file:_perforce_files -tR' } @@ -1718,11 +1725,12 @@ _perforce_cmd_attribute() { # If -f is present, search unopened files, else don't [[ ${words[(I)-f]} -eq 0 ]] && limit=" -to" _arguments -s : \ - '-e[value is in hex]' \ - '-f[set the attribute on a submitted file]' \ - '-n[set name of attribute]:attribute: ' \ - '-p[propagate attribute when opened for edit etc.]' \ - '-v[set value of attribute]:value: ' \ + '-n[attribute name]:name: ' \ + '-v[attribute value]:value: ' \ + '-e[use hex value]' \ + '-f[set attribute on submitted file]' \ + '-p[propagate attribute when opened]' \ + '(-v)-i[read attribute from standard input]' \ "*::file:_perforce_files$limit" } @@ -1730,10 +1738,12 @@ _perforce_cmd_attribute() { (( $+functions[_perforce_cmd_branch] )) || _perforce_cmd_branch() { _arguments -s : \ - '(-o)-f[force operation by superuser]' \ - '(-o -i)-d[delete branch]' \ - '(-d -i -f)-o[write specification to standard output]' \ - '(-d -o)-i[read specification from standard input]' \ + '(-o -S -P)-f[force operation]' \ + '(-o -i -S -P)-d[delete branch]' \ + '(-d -i -f)-o[write branch spec to standard output]' \ + '(-d -o -S -P)-i[read branch spec from standard input]' \ + '(-f -d -i)-S[expose internally generated mapping]:stream: ' \ + '(-f -d -i)-P[treat stream as a child of parent stream]:parent stream: ' \ '(-i)*::branch name:_perforce_branches' } @@ -1741,9 +1751,11 @@ _perforce_cmd_branch() { (( $+functions[_perforce_cmd_branches] )) || _perforce_cmd_branches() { _arguments -s : \ - '-e[limit by wildcard]:wildcard on branches: ' \ - '-u+[select by user]:user:_perforce_users' \ - '-m+[set maximum to show]:max branches: ' + '(-E)-e[list branches that match pattern]:pattern: ' \ + '(-e)-E[list branches that match case-insensitive pattern]:case-insensitive pattern: ' \ + '-u[list branches owned by user]:user:_perforce_users' \ + '-m[limit output to max branches]:max branches: ' \ + '-t[display time and date]' } @@ -1761,14 +1773,18 @@ _perforce_cmd_change() { fi fi _arguments -s : \ - '(-o)-f[allow force by superuser]' \ - '-s[joblist includes the fix status]' \ - '(-o -i)-d[discard newly created pending change]' \ - '(-d -i -f)-o[output specification to standard output]' \ - '(-d -o)-i[read specification from standard input]' \ - '(-d -o)-u[force change of jobs or description by owner]' \ - "(-i)1::change:_perforce_changes$ctype" \ - '-t[specify visibility type]:visibility type:(public restricted)' + '-f[force update of change]' \ + '-s[include fix status in job list]' \ + '(-u -I -o -i -t -U)-d[delete change]' \ + '(-u -d -o -i -t -U --serverid)-o[write change spec to the standard output]' \ + '(-O -I -d -o -i -t -U --serverid)-i[read change spec from the standard input]' \ + '(-s -d -o -i --serverid)-t[set type of change]:type:(public restricted)' \ + '-U[set user of empty change]:user:_perforce_users' \ + '-O[change is original number before submit]' \ + '-I[change is number of Identity field]' \ + '-u[force update of submitted change]' \ + '(-s -u -O -I -o -i -t -U)--serverid[specify server]:server ID: ' \ + "(-i)1::change:_perforce_changes$ctype" } @@ -1782,13 +1798,15 @@ _perforce_cmd_changelist() { _perforce_cmd_changes() { _arguments -s : \ '-i[include integrated changes]' \ - '-t[output time as well as date]' \ - '-l[long output, full change text]' \ - '-L[long output, truncated change text]' \ - '-c+[select by client]:client:_perforce_clients' \ - '-m+[most recent N changes]:max changes: ' \ - '-s+[select by status]:status:(pending shelved submitted)' \ - '-u+[select by user]:user:_perforce_users' \ + '-t[display time and date]' \ + '-l[display full change text]' \ + '-L[display truncated change text]' \ + '-f[view restricted changes]' \ + '-c[display changes submitted by client]:client:_perforce_clients' \ + '-e[display changes above this change]:change:_perforce_changes' \ + '-m[limit to max changes]:max changes: ' \ + '-s[limit output to changes with status]:status:(pending shelved submitted)' \ + '-u[display changes owned by user]:user:_perforce_users' \ '*::file:_perforce_files -tR' } @@ -1799,14 +1817,33 @@ _perforce_cmd_changelists() { } +(( $+functions[_perforce_cmd_clean] )) || +_perforce_cmd_clean() { + _arguments -s : \ + '-e[clean modified files]' \ + '-a[clean added files]' \ + '-d[clean deleted files]' \ + '-I[do not perform ignore checking]' \ + '-l[output relative paths]' \ + '-n[preview clean]' \ + '*:file:_perforce_files -tu' +} + + + (( $+functions[_perforce_cmd_client] )) || _perforce_cmd_client() { _arguments -s : \ - '(-o)-f[force modification by superuser]' \ - '-t[use template]:template client:_perforce_clients' \ - '(-o -i -t)-d[delete client]' \ - '(-d -i -f)-o[print to standard output]' \ - '(-d -o -t)-i[read from standard input]' \ + '-f[force update of client]' \ + '-Fs[force delete with shelved changes]' \ + '(-t -o -S -c -s -i)-d[delete client]' \ + '(-f -d -Fs -s -i --serverid)-o[write client spec to standard output]' \ + '(-t -d -Fs -i --serverid)-S[create new client dedicated to stream]:stream: ' \ + '(-d -Fs -o -c -i --serverid)-s[switch client view without opening editor]' \ + '(-t -d -Fs -o -S -c -s --serverid)-i[read client spec from standard input]' \ + '-t[use client as template]:client:_perforce_clients' \ + '(-f -t -d -Fs -s -i --serverid)-c[yield client spec for stream at moment change was recorded]:change:_perforce_changes -ts' \ + '--serverid[specify server]:server ID: ' \ '1::file:_perforce_clients' } @@ -1814,34 +1851,59 @@ _perforce_cmd_client() { (( $+functions[_perforce_cmd_clients] )) || _perforce_cmd_clients() { _arguments -s : \ - '-e[limit by wildcard]:wildcard on clients: ' \ - '-u+[select by user]:user:_perforce_users' \ - '-m+[set maximum to show]:max clients: ' + '-t[display time and date]' \ + '-u[list clients owned by user]:user:_perforce_users' \ + '(-E)-e[list clients that match pattern]:pattern: ' \ + '(-e)-E[list clients that match case-insensitive pattern]:case-insensitive pattern: ' \ + '-m[limit to max clients]:max clients: ' \ + '-S[limit output to clients dedicated to stream]:stream: ' \ + '-U[list unloaded clients]' \ + '(-s)-a[display all clients]' \ + '(-a)-s[display clients dedicated to server]:server ID: ' } (( $+functions[_perforce_cmd_copy] )) || _perforce_cmd_copy() { - local range - # If -s is present, the first normal argument can't have revRange. - [[ ${words[(I)-s]} -eq 0 ]] && range=" -tR" + local -a fileargs + if [[ ${words[(I)-b*]} -ne 0 ]]; then + if [[ ${words[(I)-*s*]} -eq 0 ]]; then + # with -b and no -s, all files are to-files (but -s may come later) + fileargs=('*::to file:_perforce_files -tR') + else + # with -b and -s we have one from-file and any number of to-files + fileargs=('*::to file:_perforce_files') + fi + elif [[ ${words[(I)-(S|P)]} -ne 0 ]]; then + fileargs=('*::file:_perforce_files -tR') + else + # with no -b we have one from-file and one to-file + fileargs=('1::from file:_perforce_files -tR' + '2::to file:_perforce_files') + fi _arguments -s : \ - '-b[select branch]:branch:_perforce_branches' \ - '-c[select change for copy]:change:_perforce_changes -tc' \ - '-n[no action, dummy run]' \ - '-r[reverse direction of copy with branch]' \ - '-s[select source with -b]:source file:_perforce_files -tR' \ - '-v[leave newly copied files uncopied till sync]' \ - "1:file:_perforce_files$range" \ - '*::file:_perforce_files' + '-b[use branch view'\''s source and target]:branch:_perforce_branches' \ + '-s[select source file, use branch view as target]:source file:_perforce_files -tR' \ + '-r[reverse direction of copy]' \ + '-c[open files in change]:change:_perforce_changes -tc' \ + '-f[force creation of extra revisions]' \ + '-n[preview copy]' \ + '-m[limit copy to max files]:max files: ' \ + '-q[suppress normal output messages]' \ + '-v[do not modify client files]' \ + '(-b -s)-S[copy from stream to its parent]:stream: ' \ + '(-b -s)-P[generate branch view using a parent stream]:parent stream: ' \ + '(-b -s)-F[copy against stream'\''s expected flow]' \ + $fileargs } (( $+functions[_perforce_cmd_counter] )) || _perforce_cmd_counter() { _arguments -s : \ '-d[delete counter]' \ - '-f[force setting of internal counter]' \ - '-i[increment by one atomically]' \ + '-f[set or delete internal counter]' \ + '-i[increment counter by 1]' \ + '-m[allow multiple operations]' \ '1:counter:_perforce_counters' \ '(-d -i)2::numeric value:_perforce_counter_values' } @@ -1849,8 +1911,9 @@ _perforce_cmd_counter() { (( $+functions[_perforce_cmd_counters] )) || _perforce_cmd_counters() { - # No arguments - _arguments -s : + _arguments -s : \ + '-e[list counters that match pattern]:pattern: ' \ + '-m[limit to max counters]:max counters: ' } @@ -1884,8 +1947,10 @@ _perforce_cmd_dbstat() { (( $+functions[_perforce_cmd_delete] )) || _perforce_cmd_delete() { _arguments -s : \ - '-c[select change for deletion]:change:_perforce_changes -tc' \ - '-n[show deletions without doing them]' \ + '-c[delete files for change]:change:_perforce_changes -tc' \ + '-n[preview delete]' \ + '-k[perform delete on server]' \ + '-v[delete unsynced files]' \ '*::file:_perforce_files' } @@ -1893,9 +1958,11 @@ _perforce_cmd_delete() { (( $+functions[_perforce_cmd_depot] )) || _perforce_cmd_depot() { _arguments -s : \ - '-d[delete depot]' \ - '-o[print to stdout]' \ - '-i[read name from stdin]' \ + '(-t -o -i)-d[delete depot]' \ + '(-t -o -i)-f[force delete]' \ + '(-d -o -i)-t[insert value into type]:type: ' \ + '(-t -d -i -f)-o[write depot spec to standard output]' \ + '(-t -d -o -f)-i[read depot spec from standard input]' \ '(-i)*::depot name:_perforce_depots' } @@ -1910,9 +1977,20 @@ _perforce_cmd_depots() { (( $+functions[_perforce_cmd_describe] )) || _perforce_cmd_describe() { _arguments -s : \ - '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ - '-s[short form]' \ - '-S[show shelved changes]' \ + '-d-[diff options]:diff options:(( +n\:RCS +c\:context +s\:summary +u\:unified +b\:ignore\ whitespace\ changes +w\:ignore\ whitespace +l\:ignore\ line\ endings))' \ + '-s[omit diffs]' \ + '-S[list shelved files]' \ + '-f[force display of restricted change]' \ + '-O[change is original number before submit]' \ + '-I[change is number of Identity field]' \ + '-m[limit output to max files]:max files: ' \ '*::change:_perforce_changes' } @@ -1920,17 +1998,27 @@ _perforce_cmd_describe() { (( $+functions[_perforce_cmd_diff] )) || _perforce_cmd_diff() { local limit - [[ ${words[(I)-(f|sd|se)]} -eq 0 ]] && limit=" -to" - _arguments -s : \ - '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context l\:ignore\ line\ endings n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ + [[ ${words[(I)-(f|sd|se|sl)]} -eq 0 ]] && limit=" -to" + _arguments -s : \ + '-d-[diff options]:diff options:(( +n\:RCS +c\:context +s\:summary +u\:unified +b\:ignore\ whitespace\ changes +w\:ignore\ whitespace +l\:ignore\ line\ endings))' \ '-f[diff every file]' \ - '-m+[set maximum files to show]:max files: ' \ - '(-sd -se -sl -sr)-sa[opened files, different or missing]' \ - '(-sa -se -sl -sr)-sd[unopened files, missing]' \ - '(-sa -sd -sl -sr)-se[unopened files, different]' \ - '(-sa -sd -se -sr)-sl[all unopened files with status]' \ - '(-sa -sd -se -sl)-sr[opened files, same as depot]' \ - '-t[include non-text files]' \ + '-m[limit output to max files]:max files: ' \ + '-Od[limit output to files that differ]' \ + '-s-[filter options]:filter options:(( +a\:list\ opened\ files\ that\ differ\ from\ depot +b\:list\ modified\ integrated\ files +d\:list\ unopened\ missing\ files +e\:list\ unopened\ files\ that\ differ\ from\ depot +l\:list\ all\ unopened\ files\ with\ status +r\:list\ opened\ files\ that\ do\ not\ differ\ from\ depot))' \ + '-t[diff binary files]' \ "*::file:_perforce_files$limit" } @@ -1938,22 +2026,33 @@ _perforce_cmd_diff() { (( $+functions[_perforce_cmd_diff2] )) || _perforce_cmd_diff2() { _arguments -s : \ - '-b[specify branch view]:branch name:_perforce_branches' \ - '-d-[select diff option]:diff option:((b\:ignore\ blanks c\:context n\:RCS s\:summary u\:unified w\:ignore\ all\ whitespace))' \ - '-q[only list different files]' \ - '-t[include non-text files]' \ - '-u[use patch-friendly output]' \ - '1::first file:_perforce_files' \ - '2::second file:_perforce_files' + '-b[use branch view'\''s source and target]:branch:_perforce_branches' \ + '-d-[diff options]:diff options:(( +n\:RCS +c\:context +s\:summary +u\:unified +b\:ignore\ whitespace\ changes +w\:ignore\ whitespace +l\:ignore\ line\ endings))' \ + '-Od[limit output to files that differ]' \ + '-q[omit identical files]' \ + '-t[diff binary files]' \ + '-u[use GNU diff -u format]' \ + '(-b)-S[use generated branch view from stream]:stream: ' \ + '(-b)-P[use generated branch view from parent stream]:parent stream: ' \ + '1::from file:_perforce_files' \ + '2::to file:_perforce_files' } (( $+functions[_perforce_cmd_dirs] )) || _perforce_cmd_dirs() { _arguments -s : \ - '-C[only dirs on current client]' \ - '-D[include dirs with deleted files]' \ - '-H[only dirs on the `have'\'' list]' \ + '-C[list only directories in current client]' \ + '-D[include directories with only deleted files]' \ + '-H[list directories with synced files]' \ + '-S[limit output to depot directories mapped to stream'\''s client]:stream: ' \ '*::directory:_perforce_files -td' } @@ -1961,10 +2060,10 @@ _perforce_cmd_dirs() { (( $+functions[_perforce_cmd_edit] )) || _perforce_cmd_edit() { _arguments -s : \ - '-c[set change for edit]:change:_perforce_changes -tc' \ - '-k[no resync from server]' \ - '-n[show files to edit without opening them]' \ - '-t[set filetype]:filetype:_perforce_filetypes' \ + '-c[edit files for change]:change:_perforce_changes -tc' \ + '-t[specify filetype]:filetype:_perforce_filetypes' \ + '-n[preview edit]' \ + '-k[edit files on server]' \ '*::file:_perforce_files' } @@ -1986,14 +2085,15 @@ _perforce_cmd_export() { (( $+functions[_perforce_cmd_filelog] )) || _perforce_cmd_filelog() { _arguments -s : \ - '-c[select by changelist]:change:_perforce_changes -ts' \ - '-h[follow branc/copy from records]' \ - '-i[follow branches]' \ - '-l[long output, full change text]' \ - '-L[long output, truncated change text]' \ - '-m[set maximum number of revisions to show]:max revisions: ' \ - '-s[short output]' \ - '-t[include time with date]' \ + '-c[display files at change]:change:_perforce_changes -ts' \ + '-i[include inherited file history]' \ + '-h[display file content history]' \ + '-t[display time and date]' \ + '-l[display full change text]' \ + '-L[display truncated change text]' \ + '-m[display max number of revisions]:max revisions: ' \ + '-p[do not follow content of promoted task streams]' \ + '-s[display shortened form]' \ '*::file:_perforce_files' } @@ -2001,7 +2101,11 @@ _perforce_cmd_filelog() { (( $+functions[_perforce_cmd_files] )) || _perforce_cmd_files() { _arguments -s : \ - '-a[display all revisions in given range]' \ + '-a[display all revisions in range]' \ + '-A[display files in archive depots]' \ + '-e[do not display deleted, purged or archived files]' \ + '-m[limit output to max files]:max files: ' \ + '-U[display files in unload depot]' \ '*::file:_perforce_files -tR' } @@ -2024,10 +2128,9 @@ _perforce_cmd_fix() { fi _arguments -s : \ - '-d[delete the fix]' \ - '-s[set job status]:status:_perforce_statuses' \ - '1::-c required:(-c)' \ - '2::change:_perforce_changes' \ + '-d[delete fix]' \ + '-s[set status]:status:_perforce_statuses' \ + '-c[display jobs fixed by change]:change:_perforce_changes -ts' \ "*::job:_perforce_jobs$job" } @@ -2035,10 +2138,10 @@ _perforce_cmd_fix() { (( $+functions[_perforce_cmd_fixes] )) || _perforce_cmd_fixes() { _arguments -s : \ + '-j[list fixes for job]:job:_perforce_jobs' \ + '-c[list fixes for change]:change:_perforce_changes -tR' \ '-i[include integrated changes]' \ - '-j[select by job]:job:_perforce_jobs' \ - '-c[select by change]:change:_perforce_changes' \ - '-m[set max fixes to show]:max fixes: ' \ + '-m[limit output to max fixes]:max fixes: ' \ '*::fixed file:_perforce_files -tR' } @@ -2047,8 +2150,12 @@ _perforce_cmd_fixes() { _perforce_cmd_flush() { _arguments -s : \ '-f[force resynchronisation]' \ - '-k[bypass client file update]' \ - '-n[show operations but don'\''t perform them]' \ + '-L[use full depot syntax, including revision number]' \ + '-n[preview flush]' \ + '-N[preview flush with summary]' \ + '-q[suppress normal output messages]' \ + '-r[reopen moved files in new location]' \ + '-m[limit sync to max files]:max files: ' \ '*::file:_perforce_files -tR' } @@ -2058,26 +2165,46 @@ _perforce_cmd_fstat() { local Oattr Aattr if [[ ${_perforce_cmd_list[(r)attribute:*]} != '' ]]; then # Unsupported feature, try not to show if not present - Oattr=' a\:show\ attributes d\:attributes\ digest e\:attributes\ in\ hex' + Oattr=' a\:output\ attributes d\:output\ digest e\:output\ values\ in\ hex' Aattr='-A[restrict attributes by pattern]:attribute pattern: ' fi _arguments -s : \ - '-c+[affected since change]:change:_perforce_changes -ts' \ - '-e+[affected by change]:change:_perforce_changes -ts' \ - '-C[select mapped files (-Rc)]' \ - '-F[pick filter for files]:filter:_perforce_fstat_fields -tv' \ - '-H[select synced files (-Rh)]' \ - '-W[select opened files (-Ro)]' \ - '-l[include fileSize, possibly slow (-Ol)]' \ - '-m[set max files to show]:max files: ' \ - "-O-[select output type]:output type:((f\:all\ revisions l\:fileSize p\:client\ path\ format r\:pending\ integrations s\:exclude\ local\ path$Oattr))" \ - '-P[output clientFile in full Perforce syntax (deprecated: use -Op)]' \ - '-r[show in reverse order]' \ - '-R-[restrict selected files]:restriction:((c\:mapped\ in\ client h\:synced\ to\ client n\:not\ synced\ to\ head o\:opened r\:resolved s\:shelved u\:unresolved))' \ - '-s[shorten, no client-related data (deprecated: use -Os)]' \ - '-S-[changes sort order]:sort criterion:((t\:filetype d\:date r\:head\ revision h\:have\ revision s\:filesize))' \ - '-T[select output fields]:output field:_perforce_fstat_fields' \ $Aattr \ + '-F[list only files satisfying filter]:filter:_perforce_fstat_fields -tv' \ + '-L[use full depot syntax, including revision number]' \ + '-T[return specified fields]:output field:_perforce_fstat_fields' \ + '-m[limits output to max files]:max files: ' \ + '-r[sort output in reverse order]' \ + '-c[display files modified by or after change]:change:_perforce_changes -ts' \ + '-e[list files modified by change]:change:_perforce_changes -ts' \ + "-O-[output options]:output options:(( +f\:all\ revisions +l\:fileSize\ and\ digest +p\:local\ file\ path +r\:pending\ integration +s\:exclude\ local\ path +$Oattr))" \ + '-R-[restrict files]:file restrictions:(( +c\:mapped\ in\ client +h\:synced\ to\ client +n\:opened\ not\ at\ head\ revision +o\:opened +r\:resolved +s\:shelved +u\:unresolved))' \ + '-S-[sort order]:sort by:(( +t\:filetype +d\:date +r\:head\ revision +h\:have\ revision +s\:filesize))' \ + '-U[display info about unload files in unload depot]' \ + '-C[limit output to mapped files (-Rc)]' \ + '-H[limit output to synced files (-Rh)]' \ + '-W[limit output to opened files (-Ro)]' \ + '-l[output fileSize and digest (-Ol)]' \ + '-P[output local file paths (-Op)]' \ + '-s[exclude local file paths (-Os)]' \ '*::file:_perforce_files' } @@ -2085,22 +2212,21 @@ _perforce_cmd_fstat() { (( $+functions[_perforce_cmd_grep] )) || _perforce_cmd_grep() { _arguments -s : \ + '-e[search pattern]:pattern: ' \ '-a[search all revisions]' \ '-i[case insensitive match]' \ - '-n[display matching line]' \ - '-v[display file name]' \ - '-F[interpret as fixed string]' \ - '-G[interpret as regexp (default)]' \ - '-L[list non-matching file/revisions]' \ - '-l[list matching file/revisions]' \ - '-s[suppresses errors on long lines]' \ - '-t[treat all files as text]' \ - '-A[]:trailing context lines: ' \ - '-V[]:leading context lines: ' \ - '-C[]:context lines: ' \ - '1:-e required before pattern:(-e)' \ - '2:pattern: ' \ - '*::file:_perforce_files' + '-n[display matching line number]' \ + '-v[display files with non-matching lines]' \ + '-F[interpret pattern as fixed string]' \ + '-G[interpret pattern as regexp]' \ + '-L[display non-matching files]' \ + '-l[display matching files]' \ + '-s[suppress errors on long lines]' \ + '-t[search binary files]' \ + '-A[display N lines of trailing context]:lines: ' \ + '-B[display N lines of leading context]:lines: ' \ + '-C[display N lines of output context]:lines: ' \ + '*::file:_perforce_files -tR' } @@ -2108,9 +2234,10 @@ _perforce_cmd_grep() { _perforce_cmd_group() { _arguments -s : \ '-d[delete group]' \ - '-o[output to stdout]' \ - '-i[read from stdin]' \ - '(-o)-a[allow non-super owner to modify group]' \ + '-o[write group spec to standard output]' \ + '-i[read group spec from standard input]' \ + '(-o -A)-a[allow owner to modify group]' \ + '(-a -d)-A[allow admin user to add new group]' \ '1::perforce group:_perforce_groups' } @@ -2118,10 +2245,13 @@ _perforce_cmd_group() { (( $+functions[_perforce_cmd_groups] )) || _perforce_cmd_groups() { _arguments -s : \ - '-i[show indirect membership by subgroups]' \ - '-m[set max groups to show]:max groups: ' \ - '-v[show summary data]' \ - '1::user or group name:_perforce_users_or_groups' + '-i[display indirect membership by subgroups]' \ + '-m[limit output to max groups]:max groups: ' \ + '-v[display group data]' \ + '(-u -o)-g[display group with name]:group:_perforce_groups' \ + '(-g -o)-u[display all groups for user]:user:_perforce_users' \ + '(-g -u)-o[display all groups for owner]:owner:_perforce_users' \ + '(-g -u -o)1::user or group name:_perforce_users_or_groups' } @@ -2141,7 +2271,7 @@ _perforce_cmd_help() { _perforce_help_list=($_perforce_cmd_list) _perforce_call_p4 help help | while read -A hline; do if [[ $hline[1] = p4 && $hline[2] = help ]]; then - _perforce_help_list+=("$hline[3]:${hline[4,-1]}") + _perforce_help_list+=("$hline[3]:${hline[4,-1]}") fi done if [[ -z ${_perforce_help_list[(r)undoc:*]} ]]; then @@ -2155,7 +2285,7 @@ _perforce_cmd_help() { (( $+functions[_perforce_cmd_info] )) || _perforce_cmd_info() { _arguments -s : \ - '-s[don'\''t check for unknown users or clients]' + '-s[short output]' } @@ -2165,24 +2295,26 @@ _perforce_cmd_integrate() { # If -s is present, the first normal argument can't have revRange. [[ ${words[(I)-s]} -eq 0 ]] && range=" -tR" _arguments -s : \ - '-b[select branch]:branch:_perforce_branches' \ - '-c[select change for integration]:change:_perforce_changes -tc' \ - '-f[force reintegration]' \ - '-d[reintegrate deleted files]' \ - '-D-[specify allowed deletions]:deletion type:(( -t\:rebranch\ on\ deleted\ file -s\:delete\ modified\ target\ file -i\:ignore\ readded\ source\ file -))' \ - '-h[integrate to revision had on client]' \ - '-i[integrate if no common file base]' \ - '-I[same as -i from 2004.2]' \ - '-n[no action, dummy run]' \ - '-o[display base file name for subsequent resolve]' \ - '-r[reverse direction of integration with branch]' \ - '-s[select source with -b]:source file:_perforce_files -tR' \ - '-t[propagate type changes]' \ - '-v[leave newly branched files uncopied till sync]' \ + '-b[use branch view'\''s source and target]:branch:_perforce_branches' \ + '(-r)-s[select source file, use branch view as target]:source file:_perforce_files -tR' \ + '-f[force integration]' \ + '-O-[output more information]:output options:(( +b\:show\ base\ revision\ for\ merge +r\:show\ scheduled\ resolves))' \ + '-R-[specify resolve schedule]:schedule:(( +b\:branch\ resolves +d\:delete\ resolves +s\:skip\ cherry-picked\ revisions\ already\ integrated))' \ + '-Di[retain revisions of deleted files]' \ + '-h[leave files at revision currently synced]' \ + '-m[limit integration to max files]:max files: ' \ + '-n[preview integration]' \ + '-q[suppress normal output messages]' \ + '-c[open in change]:change:_perforce_changes -tc' \ + '-v[do not modify client files]' \ + '-r[reverse direction of mapping]' \ + '-S[use generated branch view from stream]:stream: ' \ + '-P[use generated branch view from parent stream]:parent stream: ' \ "1:file:_perforce_files$range" \ '*::file:_perforce_files' } @@ -2196,8 +2328,8 @@ _perforce_cmd_integ() { (( $+functions[_perforce_cmd_integrated] )) || _perforce_cmd_integrated() { _arguments -s : \ - '-r[reverse mapping in branch view with -b]' \ - '-b[select files integrated via branch]:branch:_perforce_branches' \ + '-r[reverse mapping in branch view]' \ + '-b[list files integrated from branch view]:branch:_perforce_branches' \ '*::file:_perforce_files -ti' } @@ -2211,34 +2343,51 @@ _perforce_cmd_interchanges() { if [[ ${words[(I)-b*]} -ne 0 ]]; then if [[ ${words[(I)-*s*]} -eq 0 ]]; then # with -b and no -s, all files are to-files (but -s may come later) - fileargs=('-s[specify source file]' - '*::to file:_perforce_files -tR') + fileargs=('*::to file:_perforce_files -tR') else # with -b and -s we have one from-file and any number of to-files - fileargs=('1::from file:_perforce_files -tR' - '*::to file:_perforce_files') + fileargs=('*::to file:_perforce_files') fi + elif [[ ${words[(I)-(S|P)]} -ne 0 ]]; then + fileargs=('*::file:_perforce_files -tR') else # with no -b we have one from-file and one to-file fileargs=('1::from file:_perforce_files -tR' '2::to file:_perforce_files') fi _arguments -s : \ - '-f[show individual files]' \ - '-l[long changelist description]' \ - '-b[select files integrated via branch]:branch:_perforce_branches' \ - '-r[reverse branch mapping]' \ + '-f[list files that require integration]' \ + '-l[display full change text]' \ + '-t[display time and date]' \ + '(-S -P)-b[use branch view'\''s source and target]:branch:_perforce_branches' \ + '(-S -P)-s[select source file, use branch view as target]:source file:_perforce_files -tR' \ + '-u[limit files submitted by user]:user:_perforce_users' \ + '-r[reverse mapping direction]' \ + '-S[use generated branch view from stream]:stream: ' \ + '-P[use generated branch view from parent stream]:parent stream: ' \ + '-F[ignore stream'\''s expected flow]' \ $fileargs } +(( $+functions[_perforce_cmd_istat] )) || +_perforce_cmd_istat() { + _arguments -s : \ + '-a[show status of integration in both directions]' \ + '-c[assume cache is stale]' \ + '-r[show status of integration from parent]' \ + '-s[show cached state without refreshing stale data]' \ + '1::stream: ' +} + + (( $+functions[_perforce_cmd_job] )) || _perforce_cmd_job() { _arguments -s : \ '(-d -o -i)-f[force setting of readonly fields]' \ '(-f -o -i)-d[delete job]' \ - '(-f -d -i)-o[print to stdout]' \ - '(-d -o)-i[read from stdin]' \ + '(-f -d -i)-o[write job spec to standard output]' \ + '(-d -o)-i[read job spec from standard input]' \ '(-i)1::job:_perforce_jobs' } @@ -2246,12 +2395,12 @@ _perforce_cmd_job() { (( $+functions[_perforce_cmd_jobs] )) || _perforce_cmd_jobs() { _arguments -s : \ - '-e[select by jobview]:jobview:_perforce_jobviews' \ - '-i[included integrated changes]' \ - '-l[long output, full job descriptions]' \ - '-r[reverse order of job names]' \ - '-m[limit to most recent N jobs]:number of most recent jobs: ' \ - '(-e -i -l -m)-R[rebuild jobs table on upgrade]' \ + '-e[list jobs matching parameter]::_perforce_jobviews' \ + '-i[include integrated changes]' \ + '-l[display full job text]' \ + '-m[limit output to max jobs]:max jobs: ' \ + '-r[sort in reverse order]' \ + '(-e -i -l -m)-R[rebuild jobs table]' \ '*::file:_perforce_files -tR' } @@ -2264,14 +2413,41 @@ _perforce_cmd_jobspec() { } +(( $+functions[_perforce_cmd_key] )) || +_perforce_cmd_key() { + local -a keyargs + if [[ ${words[(I)-(d|i)]} -ne 0 ]]; then + keyargs=('1::name: ') + elif [[ ${words[(I)-m]} -ne 0 ]]; then + keyargs=('*::name value pairs: ') + else + keyargs=('1::name: ' '2::value: ') + fi + _arguments -s : \ + '(-i -m)-d[delete key]' \ + '(-d -m)-i[increment key value by 1]' \ + '(-d -i)-m[allow mulitple operations]' \ + $keyargs +} + + +(( $+functions[_perforce_cmd_keys] )) || +_perforce_cmd_keys() { + _arguments -s : \ + '-e[list keys that match pattern]:pattern: ' \ + '-m[limit output to max keys]:max keys: ' +} + + (( $+functions[_perforce_cmd_label] )) || _perforce_cmd_label() { _arguments -s : \ '-f[force operation]' \ - '-t+[copy template]:template: ' \ + '-t[copy view and options from label]:label:_perforce_labels' \ '(-o -i -t)-d[delete label]' \ - '(-d -f -i)-o[write to standard output]' \ - '(-o -d -t)-i[read from standard input]' \ + '(-d -f -i -g)-o[write label spec to standard output]' \ + '(-o -d -t)-i[read label spec from standard input]' \ + '-g[update global label]' \ '*::label:_perforce_labels' } @@ -2279,10 +2455,14 @@ _perforce_cmd_label() { (( $+functions[_perforce_cmd_labels] )) || _perforce_cmd_labels() { _arguments -s : \ - '-e[limit by wildcard]:label wildcard: ' \ - '-m+[set maximum to show]:max labels: ' \ - '-t[output time as well as date]' \ - '-u+[select by user]:user:_perforce_users' \ + '-t[display time and date]' \ + '-u[list labels owned by user]:user:_perforce_users' \ + '(-E)-e[list labels that match pattern]:pattern: ' \ + '(-e)-E[list labels that match case-insensitive pattern]:case-insensitive pattern: ' \ + '-m[limit output to max labels]:max labels: ' \ + '(-s)-a[display all labels]' \ + '(-a)-s[display labels from server]:server ID: ' \ + '-U[list unloaded labels]' \ '1::file or revisions which must contain label:_perforce_files -tR' } @@ -2290,11 +2470,23 @@ _perforce_cmd_labels() { (( $+functions[_perforce_cmd_labelsync] )) || _perforce_cmd_labelsync() { _arguments -s : \ + '-l[specify label]:label:_perforce_labels' \ '-a[add files to label]' \ '-d[delete files from label]' \ - '-n[no effect, dummy run]' \ - '-l[specify label]:label:_perforce_labels' \ - '-q[suppress informational messages]' \ + '-n[preview labelsync]' \ + '-q[suppress normal output messages]' \ + '-g[update global label]' \ + '*::file:_perforce_files -tR' +} + + +(( $+functions[_perforce_cmd_list] )) || +_perforce_cmd_list() { + _arguments -s : \ + '-l[use temporary list name]:list name: ' \ + '(-C)-d[delete list]' \ + '-C[limit files to client]' \ + '-M[forward list to master server]' \ '*::file:_perforce_files -tR' } @@ -2310,7 +2502,8 @@ _perforce_cmd_license() { (( $+functions[_perforce_cmd_lock] )) || _perforce_cmd_lock() { _arguments -s : \ - '-c[select by change]:change:_perforce_changes -tc' \ + '-c[lock files for change]:change:_perforce_changes -tc' \ + '-g[lock files globally]' \ '*::file:_perforce_files -to' } @@ -2324,8 +2517,8 @@ _perforce_cmd_lockstat() { (( $+functions[_perforce_cmd_logger] )) || _perforce_cmd_logger() { _arguments -s : \ - '-c[limit by counter no]:number: ' \ - '-t[use counter instead of logger]:counter:_perforce_counters' + '-c[list events after sequence]:sequence: ' \ + '-t[list events after counter]:counter:_perforce_counters' } @@ -2333,9 +2526,11 @@ _perforce_cmd_logger() { (( $+functions[_perforce_cmd_login] )) || _perforce_cmd_login() { _arguments -s : \ - '-a[ticket valid on all machines]' \ + '-a[issue ticket on all host machines]' \ + '-h[issue ticket on host]:host: ' \ '-p[display ticket, do not store]' \ - '-s[show status of ticket]' \ + '-r[forward login to server]:remote spec: ' \ + '(-a -p -h)-s[display status of current ticket]' \ '(-s)1::user:_perforce_users' } @@ -2362,6 +2557,27 @@ _perforce_cmd_logtail() { } +(( $+functions[_perforce_cmd_merge] )) || +_perforce_cmd_merge() { + local -a fileargs + if [[ ${words[(I)--from]} -ne 0 ]]; then + fileargs=('1:to file:_perforce_files -tR') + else + fileargs=('1:from file:_perforce_files -tR' + '2:to file:_perforce_files') + fi + _arguments -s : \ + '-F[merge against stream'\''s expected flow]' \ + '-Ob[show base revision for merge]' \ + '-q[suppress normal output messages]' \ + '--from[merge from stream other than the parent stream]:stream: ' \ + '-m[limit merge to max files]:max files: ' \ + '-n[preview merge]' \ + '-c[open in change]:change:_perforce_changes -tc' \ + $fileargs +} + + (( $+functions[_perforce_cmd_monitor] )) || _perforce_cmd_monitor() { if (( CURRENT > 2 )); then @@ -2397,25 +2613,25 @@ _perforce_cmd_monitor() { (( $+functions[_perforce_cmd_move] )) || _perforce_cmd_move() { _arguments -s : \ - '-c[specify new change list]:change:_perforce_changes -tc' \ - '-f[force move when already synced]' \ - '-k[no resync from server]' \ + '-c[reopen in change]:change:_perforce_changes -tc' \ + '-f[force move]' \ '-t[specify new file type]:filetype:_perforce_filetypes' \ - '-n[show files to move without moving them]' \ - '1::source file, wildcards allowed:_perforce_files -to' \ - '2::destination file, wildcards match source:_perforce_files' + '-n[preview move]' \ + '-k[perform move on server]' \ + '1::from file:_perforce_files -to' \ + '2::to file:_perforce_files -tu' } (( $+functions[_perforce_cmd_obliterate] )) || _perforce_cmd_obliterate() { if [[ ${words[(I)-y]} -gt 0 ]]; then - _message \ + _message \ ": don't complete after -y; run obliterate without, then add the -y" else - _arguments -s : \ - '-y[actually perform the operation]' \ - '*::file:_perforce_files -tR' + _arguments -s : \ + '-y[actually perform the operation]' \ + '*::file:_perforce_files -tR' fi } @@ -2427,11 +2643,14 @@ _perforce_cmd_opened() { # -tp, but currently Perforce doesn't allow that, so -tc is correct. # This is true even if -a is also given. _arguments -s : \ - '-a[list for all clients]' \ - '-c+[select by change]:change:_perforce_changes -tc' \ - '-C[select by client]:client:_perforce_clients' \ - '-m[max files to show]:max files: ' \ - '-u[select by user]:user name:_perforce_users' \ + '-a[list files for all clients]' \ + '-c[list files opened in change]:change:_perforce_changes -tc' \ + '-C[list files open in client]:client:_perforce_clients' \ + '-u[list files opened by user]:user name:_perforce_users' \ + '-m[limit output to max files]:max files: ' \ + '-s[short output]' \ + '-x[list exclusive files]' \ + '-g[list files opened on Commit Server]' \ '*::file:_perforce_files -to' } @@ -2458,12 +2677,49 @@ _perforce_cmd_ping() { } +(( $+functions[_perforce_cmd_populate] )) || +_perforce_cmd_populate() { + local -a fileargs + if [[ ${words[(I)-b*]} -ne 0 ]]; then + if [[ ${words[(I)-*s*]} -eq 0 ]]; then + # with -b and no -s, all files are to-files (but -s may come later) + fileargs=('*::to file:_perforce_files -tR') + else + # with -b and -s we have one from-file and any number of to-files + fileargs=('*::to file:_perforce_files') + fi + elif [[ ${words[(I)-(S|P)]} -ne 0 ]]; then + fileargs=('*::file:_perforce_files -tR') + else + # with no -b we have one from-file and one to-file + fileargs=('1::from file:_perforce_files -tR' + '2::to file:_perforce_files') + fi + _arguments -s : \ + '(-S -P)-b[use branch view'\''s source and target]:branch:_perforce_branches' \ + '(-S -P)-s[select source file, use branch view as target]:source file:_perforce_files -tR' \ + '-r[reverse mapping direction]' \ + '-S[use generated branch view from stream]:stream: ' \ + '-P[use generated branch view from parent stream]:parent stream: ' \ + '-d[description for submitted change]:description: ' \ + '-f[force deleted files to branch into target]' \ + '-n[preview populate]' \ + '-o[display files created by populate]' \ + '-m[limit max actions]:max actions: ' \ + $fileargs +} + + (( $+functions[_perforce_cmd_print] )) || _perforce_cmd_print() { _arguments -s : \ - '-a[display all revisions in a range]' \ - '-o[select output file]:output file:_files' \ + '-a[print all revisions in range]' \ + '-A[print files in archive depots]' \ + '-k[suppress keyword expansion]' \ + '-o[redirect output to file]:file:_files' \ '-q[suppress header]' \ + '-m[limit max files]:max files: ' \ + '-U[print files in unload depot]:unload file:_perforce_files' \ '*::file:_perforce_files -tR' } @@ -2471,23 +2727,31 @@ _perforce_cmd_print() { (( $+functions[_perforce_cmd_protect] )) || _perforce_cmd_protect() { _arguments -s : \ - '-o[write spec to stdout]' \ - '-i[read spec from stdin]' + '-o[write protection table to standard output]' \ + '-i[read protection table from standard input]' } (( $+functions[_perforce_cmd_protects] )) || _perforce_cmd_protects() { _arguments -s : \ - '(-g -u)-a[show for all users]' \ - '(-a -u)-g[select by group]:perforce group:_perforce_groups' \ - '(-a -g)-u[select by user]:perforce user:_perforce_users' \ - '-h[limit to host]:host:_perforce_hosts' \ - '-m[single word summary]' \ + '(-g -u)-a[display protection lines for all users]' \ + '(-a -u)-g[display protection lines for group]:perforce group:_perforce_groups' \ + '(-a -g)-u[display protection lines for user]:perforce user:_perforce_users' \ + '-h[display protection lines for host]:host:_perforce_hosts' \ + '-m[report single word summary]' \ '*:file:_perforce_files' } +(( $+functions[_perforce_cmd_prune] )) || +_perforce_cmd_prune() { + _arguments -s : \ + '-y[execute prune]' \ + '-S[stream to prune]:stream: ' +} + + (( $+functions[_perforce_cmd_pull] )) || _perforce_cmd_pull() { _arguments -s : \ @@ -2497,6 +2761,37 @@ _perforce_cmd_pull() { '-J[specify prefix for journal file]:journal file prefix: ' } + +(( $+functions[_perforce_cmd_reconcile] )) || +_perforce_cmd_reconcile() { + _arguments -s : \ + '-n[preview reconcile]' \ + '-c[open files for change]:change:_perforce_changes -tc' \ + '-e[open modified files for edit]' \ + '-a[open new files for add]' \ + '-d[open removed files for delete]' \ + '-f[reformat filenames with wildcard characters]' \ + '-I[do not perform ignore checking]' \ + '-l[output relative paths]' \ + '-m[check file modification times]' \ + '-w[force client files to be updated to match depot]' \ + '-k[reconcile have list with client]' \ + '*:file:_perforce_files -tu' +} + + +(( $+functions[_perforce_cmd_rec] )) || +_perforce_cmd_rec() { + _perforce_cmd_reconcile "$@" +} + + +(( $+functions[_perforce_cmd_rename] )) || +_perforce_cmd_rename() { + _perforce_cmd_move "$@" +} + + (( $+functions[_perforce_cmd_reopen] )) || _perforce_cmd_reopen() { # Assume user doesn't want to reopen to same changelist. @@ -2508,8 +2803,8 @@ _perforce_cmd_reopen() { fi _arguments -s : \ - '-c+[select change to reopen on]:change:_perforce_changes -tc' \ - '-t+[set file type]:file type:_perforce_filetypes' \ + '-c[reopen files for change]:change:_perforce_changes -tc' \ + '-t[specify new file type]:filetype:_perforce_filetypes' \ '*::file:_perforce_files -to' } @@ -2533,13 +2828,32 @@ _perforce_cmd_replicate() { (( $+functions[_perforce_cmd_resolve] )) || _perforce_cmd_resolve() { _arguments -s : \ - '-a-[select automatic merge type]:automation type:((f\:force\ acceptance m\:skip\ conflicts s\:safe t\:use\ theirs y\:use\ yours))' \ - '-d-[select diff option]:diff option:((b\:ignore\ blanks w\:ignore\ all\ whitespace))' \ - '-f[force re-resolution]' \ - '-n[no action, just list]' \ + '-A-[limit resolve attempts]:resolve attempts:(( +a\:resolve\ attributes +b\:resolve\ file\ branching +c\:resolve\ file\ content\ changes +d\:resolve\ file\ deletions +m\:resolve\ moved\ and\ renamed\ files +t\:resolve\ filetype\ changes +Q\:resolve\ charset\ changes +))' \ + '-a-[set automatic resolve]:resolve:(( +s\:skip\ files\ that\ need\ merging +m\:skip\ files\ with\ conflicts +f\:accept\ merged\ files\ with\ conflicts +t\:use\ theirs +y\:use\ yours))' \ + '-d-[control whitespace merging]:whitespace option:(( +b\:ignore\ whitespace\ changes +w\:ignore\ whitespace\ altogether +l\:ignores\ line\ endings))' \ + '-f[re-resolve files]' \ + '-n[preview resolve]' \ + '-N[preview resolve with summary]' \ '-o[display base file name and revision for merge]' \ - '-t[force textual merge on binary files]' \ - '-v[verbose, mark all changes]' \ + '-t[force textual merge]' \ + '-v[insert markers for all changes]' \ + '-c[limit resolve to change]:change:_perforce_changes -tc' \ '*::file:_perforce_files -to' } @@ -2555,10 +2869,12 @@ _perforce_cmd_resolved() { (( $+functions[_perforce_cmd_revert] )) || _perforce_cmd_revert() { _arguments -s : \ - '-a[revert unaltered files]' \ - '-c[limit reversions to change]:change:_perforce_changes -tc' \ - '-k[bypass client refresh]' \ - '-n[no action, show effect only]' \ + '-a[revert open unchanged files]' \ + '-n[preview revert]' \ + '-k[mark files as reverted on server]' \ + '-w[delete new files]' \ + '-c[revert files opened in change]:change:_perforce_changes -tc' \ + '-C[specify client]:client:_perforce_clients' \ '*::file:_perforce_files -to' } @@ -2566,15 +2882,16 @@ _perforce_cmd_revert() { (( $+functions[_perforce_cmd_review] )) || _perforce_cmd_review() { _arguments -s : \ - '-c[select change for counter]:change:_perforce_changes -ts' \ - '-t[limit change number by counter]:counter:_perforce_counters' + '-c[specify change]:change:_perforce_changes -ts' \ + '-t[specify counter]:counter:_perforce_counters' } (( $+functions[_perforce_cmd_reviews] )) || _perforce_cmd_reviews() { _arguments -s : \ - '-c[show users by change]:change:_perforce_changes -ts' \ + '-c[limit files submitted in change]:change:_perforce_changes -ts' \ + '-C[limit files opened in client]:client:_perforce_clients' \ '*::file:_perforce_files' } @@ -2583,8 +2900,9 @@ _perforce_cmd_reviews() { _perforce_cmd_set() { # Only works under Windoze but maybe we are on Cygwin. _arguments -s : \ + '-q[remove origin]' \ '-s[set for whole system]' \ - '-S[set for specified service]:service: ' \ + '-S[specify service]:service: ' \ "*::environment variable:_perforce_variables" } @@ -2592,26 +2910,80 @@ _perforce_cmd_set() { (( $+functions[_perforce_cmd_shelve] )) || _perforce_cmd_shelve() { _arguments -s : \ - '(-i)-c[specify changelist if not default]:change:_perforce_changes -tc' \ - '(-i -r)-d[delete shelved files]' \ - '(-r)-f[force by admin user or force to overwrite]' \ - '(-c)-i[read from standard input]' \ - '(-d)-r[replace shelved files in changelist]' \ + '-i[read change spec from standard input]' \ + '(-i)-c[shelve files in change]:change:_perforce_changes -tc' \ + '-f[overwrite existing shelved files]' \ + '-r[replace shelved files in change]' \ + '-a[handle unchanged files]:option:(submitunchanged leaveunchanged)' \ + '(-p -a -i -r)-d[delete shelved files]' \ + '-p[promote shelved change to commit server]' \ '(-i -r)*::file:_perforce_files -to' } +(( $+functions[_perforce_cmd_status] )) || +_perforce_cmd_status() { + _arguments -s : \ + '-c[list files in change]:change:_perforce_changes -tc' \ + '-A[list all new, modified, and removed files]' \ + '-e[list modified files]' \ + '-a[list new files]' \ + '-d[list removed files]' \ + '-f[reformat filenames with wildcard characters]' \ + '-s[summarize output for new files]' \ + '-I[do not perform ignore checking]' \ + '-m[check file modification times]' \ + '-k[reconcile have list with client]' \ + '*:file:_perforce_files -tuo' +} + + (( $+functions[_perforce_cmd_sizes] )) || _perforce_cmd_sizes() { _arguments -s : \ - '-a[show for all revisions]' \ - '-b[set blocksize]:blocksize in bytes: ' \ + '-a[list all revisions in range]' \ + '-b[specify blocksize]:blocksize in 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: ' \ '-s[sum the file sizes]' \ - '-S[show sizes of shelved files]' \ + '-S[display sizes for shelved files]' \ + '-z[omit lazy copies]' \ + '(-z -S)-A[display files in archive depots]' \ + '-U[display sizes for unload files]' \ '*:file:_perforce_files -tR' } +# TODO Add more logic for subcommands +#p4 stream edit +#p4 stream resolve [-a<flag>] [-n] [-o] +#p4 stream revert +(( $+functions[_perforce_cmd_stream] )) || +_perforce_cmd_stream() { + _arguments -s : \ + '(-o -v)-d[delete stream]' \ + '(-f)-o[write stream spec to standard output]' \ + '(-o -v)-P[insert value into parent field]:parent stream: ' \ + '(-o -v)-t[insert value into type field]:type: ' \ + '(-o -v)-i[read stream spec from standard input]' \ + '(-o -v)-f[force modification]' \ + '(-f)-v[expose client view]' \ + '1:stream name: ' +} + + +(( $+functions[_perforce_cmd_streams] )) || +_perforce_cmd_streams() { + _arguments -s : \ + '-F[limit files to pattern]:file pattern: ' \ + '-T[limit fields to list]:field list: ' \ + '-m[limit max streams]:max streams: ' \ + '-U[list unloaded task streams]' \ + '*:stream path: ' +} + + (( $+functions[_perforce_cmd_spec] )) || _perforce_cmd_spec() { _arguments -s : \ @@ -2623,26 +2995,40 @@ label spec trigger typemap user)" } +# TODO Figure out how --parallel will work +#p4 submit -i [-r -s -f option] --parallel=threads=N[,batch=N][,min=N] (( $+functions[_perforce_cmd_submit] )) || _perforce_cmd_submit() { _arguments -s : \ - '-r[files open for add or edit remain open]' \ - '-s[include fix status in list]' \ + '(-s -d -e -i)-c[submit change]:change:_perforce_changes -tc' \ + '(-r -s -f -d -c -i --noretransfer)-e[submit shelved change]:change:_perforce_changes -tS' \ + '(-s -c -e -i --noretransfer)-d[specify description]:description: ' \ + '(-d -c -e --noretransfer)-i[read change spec from standard input]' \ '-f[override submit option]:submit option:_perforce_submit_options' \ - '(-s -i)-c[submit specific change]:change:_perforce_changes -tc' \ - '(-s -c)-d[specify description on command line]:description: ' \ - '(-c)-i[read change spec from stdin]' \ + '-r[reopen submitted files]' \ + '(-d -c)-s[include fix status in list]' \ + '--parallel[parallel file transfer options]:parallel options: ' \ + '--noretransfer[do not re-transfer submitted files]:no re-transfer?:(0 1)' \ '*::file:_perforce_files -to -tr' } +# TODO Figure out how --parallel will work +#--parallel=threads=N[,batch=N][,batchsize=N][,min=N][,minsize=N] (( $+functions[_perforce_cmd_sync] )) || _perforce_cmd_sync() { _arguments -s : \ '-f[force resynchronisation]' \ - '-n[show operations but don'\''t perform them]' \ - '-k[bypass client file update]' \ - '-q[suppress informational messages]' \ + '-L[use full depot syntax]' \ + '-n[preview sync]' \ + '-N[preview sync with summary]' \ + '(-s -p)-k[update server without syncing files]' \ + '(-f -k -r -s)-p[sync client without updating server]' \ + '-q[suppress normal output messages]' \ + '(-s -p)-r[reopen moved files in new location]' \ + '(-f -k -r -p)-s[do not clobber modified files]' \ + '-m[limit max files to sync]:max files: ' \ + '--parallel[parallel file transfer options]:parallel options: ' \ '*::file:_perforce_files -tR' } @@ -2651,7 +3037,9 @@ _perforce_cmd_sync() { _perforce_cmd_tag() { _arguments -s : \ '-d[delete association between label and files]' \ - '-n[show what files would be tagged]' \ + '-n[preview tag]' \ + '-g[update global label]' \ + '-U[create label with autoreload option]' \ '-l[specify label]:label:_perforce_labels' \ '*::file:_perforce_files -tR' } @@ -2683,8 +3071,10 @@ _perforce_cmd_typemap() { (( $+functions[_perforce_cmd_unlock] )) || _perforce_cmd_unlock() { _arguments -s : \ - '-c[non-default change to unlock]:change:_perforce_changes -tc' \ - '-f[allow superuser to unlock any file]' \ + '-s[unlock files from shelved change]:change:_perforce_changes -tS' \ + '-c[unlock files from change]:change:_perforce_changes -tc' \ + '-x[unlock exclusive files]' \ + '-f[unlock files owned by other users]' \ '*::file:_perforce_files' } @@ -2692,21 +3082,37 @@ _perforce_cmd_unlock() { (( $+functions[_perforce_cmd_unshelve] )) || _perforce_cmd_unshelve() { _arguments -s : \ - '-s[specify shelving change]:change:_perforce_changes -tS' \ - '-c[specify change for unshelve]:change:_perforce_changes -tc' \ + '-s[unshelve files from change]:change:_perforce_changes -tS' \ + '-c[unshelve files to change]:change:_perforce_changes -tc' \ '-f[force clobbering of writeable files]' \ '-n[preview unshelve]' \ + '-b[use branch view for unshelve]:branch:_perforce_branches' \ + '-S[use generated branch view from stream]:stream: ' \ + '-P[use generated branch view from parent stream]:parent stream: ' \ '*::file, pattern allowed:_perforce_files' } +(( $+functions[_perforce_cmd_update] )) || +_perforce_cmd_update() { + _arguments -s : \ + '-f[force resynchronisation]' \ + '-L[use full depot syntax]' \ + '-n[preview update]' \ + '-N[preview update with summary]' \ + '-q[suppress normal output messages]' \ + '-m[limit max files to update]:max files: ' \ + '*::file:_perforce_files -tR' +} + + (( $+functions[_perforce_cmd_user] )) || _perforce_cmd_user() { _arguments -s : \ - '(-o)-f[force edit by superuser]' \ '(-o -i)-d[delete user]' \ - '(-o -d)-i[read form from stdin]' \ - '(-f -i -d)-o[write form to stdout]' \ + '(-f -i -d)-o[write user spec to standard output]' \ + '(-o -d)-i[read user spec from standard input]' \ + '(-o)-f[force edit of user]' \ '(-i)1::username:_perforce_users' } @@ -2714,7 +3120,11 @@ _perforce_cmd_user() { (( $+functions[_perforce_cmd_users] )) || _perforce_cmd_users() { _arguments -s : \ - '-m[set max users to show]:max users: ' \ + '-m[limit output to max users]:max users: ' \ + '-a[output service and operator users]' \ + '-l[long output]' \ + '-r[list only replica users]' \ + '-c[list only central server users]' \ '*::username:_perforce_users' } diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep index 0b7d23d4d..714bf095b 100644 --- a/Completion/Unix/Command/_pgrep +++ b/Completion/Unix/Command/_pgrep @@ -28,6 +28,7 @@ arguments=('-P[parent process id]:parent process id:->ppid' '-q[do not write anything to standard output]' '-S[search also in system processes]' '-v[negate matching]' + '-w[show thread ids instead of pids]' '-x[match exactly]' '-z[match only in zones]:zone:_zones') @@ -41,7 +42,7 @@ fi local optchars case "$OSTYPE" in linux*) - optchars="cflvxdnoPgsuUGt" + optchars="cflvxdnoPgsuUGtw" ;; freebsd*) optchars="LSafilnoqvxFGMNPUdgjstu" diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config index dd73c79e9..43773967e 100644 --- a/Completion/Unix/Command/_pkg-config +++ b/Completion/Unix/Command/_pkg-config @@ -1,6 +1,6 @@ #compdef pkg-config -local arguments packages curcontext="$curcontext" state line ret=1 +local arguments packages curcontext="$curcontext" state line expl ret=1 declare -A opt_args # Up-to-date as of pkg-config 0.29-4 (debian package) man page synopsis diff --git a/Completion/Unix/Command/_rake b/Completion/Unix/Command/_rake index 7fed949ab..8814edaa5 100644 --- a/Completion/Unix/Command/_rake +++ b/Completion/Unix/Command/_rake @@ -22,7 +22,7 @@ _arguments -C -s -S \ \*{--require,-r}'[require specified module before executing rakefile]:library:->library' \ '(- *)--rules[trace the rules resolution]' \ '(--quiet -q --silent -s --verbose -v)'{--silent,-s}"[like --quiet, but also suppresses the 'in directory' announcement]" \ - '(--system,-g)'{--system,-g}'[using system wide (global) rakefiles (usually '~/.rake/*.rake')]' \ + '(--system -g)'{--system,-g}'[using system wide (global) rakefiles (usually '~/.rake/*.rake')]' \ '(- *)'{--tasks,-T}'[display the tasks (matching the specified pattern) with descriptions, then exit]:pattern::' \ '(--trace -t)'{--trace,-t}'[turn on invoke/execute tracing, enable full backtrace]' \ '(--quiet -q --silent -s --verbose -v)'{--verbose,-v}'[log message to standard output (default)]' \ diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 15d5145c5..46da00cc4 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -34,6 +34,7 @@ case $variant in '(-g --section-groups)'{-g,--section-groups}'[show section groups]' '(-t --section-details)'{-t,--section-details}'[show section details]' '(-e --headers)'{-e,--headers}'[show file, program and sections headers]' + '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]' '(-u --unwind)'{-u,--unwind}'[show unwind info (if present)]' '(-D --use-dynamic)'{-D,--use-dynamic}'[use dynamic section info when showing symbols]' ) @@ -52,6 +53,8 @@ case $variant in '(-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)' ) ;; esac diff --git a/Completion/Unix/Command/_rrdtool b/Completion/Unix/Command/_rrdtool index 9d097bd77..96bdaf0db 100644 --- a/Completion/Unix/Command/_rrdtool +++ b/Completion/Unix/Command/_rrdtool @@ -1,23 +1,25 @@ #compdef rrdtool -_arguments \ +local curcontext="$curcontext" state line expl ret=1 + +_arguments -C \ ':rrdtool command:(create update updatev graph dump restore last lastupdate first help info fetch tune resize xport)' \ - '*::subcmd:->subcmd' && return 0 + '*:: :->subcmds' && ret=0 +curcontext="${curcontext%:*}-$words[1]:" case "$state" in - (subcmd) - - case "$words[1]" in + (subcmds) + case "$words[1]" in (help) - _wanted -V 'subcommands' expl 'subcommand' compadd \ - create update updatev graph dump restore last lastupdate \ - first help info fetch tune resize xport - ;; + _wanted -V 'subcommands' expl 'subcommand' compadd \ + create update updatev graph dump restore last lastupdate \ + first help info fetch tune resize xport + ;; (*) - _files - ;; - esac + _files + ;; + esac ;; esac diff --git a/Completion/Unix/Command/_ruby b/Completion/Unix/Command/_ruby index 49a1170ef..bb0558fde 100644 --- a/Completion/Unix/Command/_ruby +++ b/Completion/Unix/Command/_ruby @@ -35,11 +35,12 @@ 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:((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))' '(-v --verbose)'{-v,--verbose}'[print version number, then turn on verbose mode]' '-x-[strip off text before #!ruby line and perhaps cd to directory]:directory:_files -/' '(1 * -)--copyright[print the copyright]' - --{en,dis}able-{gems,rubyopt,all} + --{en,dis}'able=[enable or disable features]:feature:(gems did_you_mean rubyopt frozen_string_literal all)' + \!--{en,dis}able-{gems,rubyopt,all} --{external,internal}'-encoding=:charset:->charsets' '!'{-y,--yydebug} '!--dump=:target:(version copyright usage yydebug syntax parsetree parsetree_with_comment insns)' @@ -113,7 +114,7 @@ case "$state" in charsets=( $(_call_program charsets $RUBY -e 'puts\ Encoding.list' 2>/dev/null) ) # could also add Encoding.aliases.map(&:first) for aliases desc='charset' - if [[ $curcontext = *option-E-1 ]]; then + if [[ $curcontext = *option-(E|-encoding)-1 ]]; then if compset -P '*:'; then desc='internal charset' else diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index 259477f93..222798b8a 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -23,8 +23,9 @@ elif _pick_variant gnu=GNU unix --version; then '(-i --in-place)'{-i-,--in-place=-}$inplace '(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]' '(-r)--posix[disable GNU extensions]' - '(-r --regexp-extended)'{-r,--regexp-extended}$extended + '(-E -r --regexp-extended)'{-E,-r,--regexp-extended}$extended '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]' + '--sandbox[block commands that can affect the system (r/w/W/e)]' '(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]' '(-z --null-data)'{-z,--null-data}'[separate lines by NUL characters]' '(- 1 :)--help[print program usage]' diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite index 05027c603..df673894c 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+=( csv ) +(( $+sqlite3 )) && output_modes+=( csv quote ) exclusive=( $^dashes-${^output_modes:l} ) for display_opt in $output_modes ; do # finagle the description to match the way SQLite's -help formats them @@ -32,8 +32,8 @@ for display_opt in $output_modes ; do done options+=( - $^dashes'-separator[set output field separator]:string to separate output fields:' - $^dashes'-nullvalue[set null value string]:string for NULL values:' + $^dashes'-separator[set output field separator]:output field separator [|]' + $^dashes'-nullvalue[set text string for null values]:string' '(- :)'$^dashes'-version[show SQLite version]' '(- :)'$^dashes'-help[show help]' '1:SQLite database file:_files' @@ -42,9 +42,12 @@ options+=( (( $+sqlite3 )) && options+=( $^dashes'-bail[stop after hitting an error]' + $^dashes'-cmd[run specified command before reading stdin]:sqlite meta-command' '(-*batch -*interactive)'$^dashes'-batch[force batch I/O]' '(-*batch -*interactive)'$^dashes'-interactive[force interactive I/O]' + $^dashes'-mmap[set default mmap size]:size' $^dashes'-stats[print memory stats before each finalize]' + $^dashes'-vfs[use specified default VFS]:vfs:(unix-dotfile unix-excl unix-none unix-namedsem)' ) _arguments $options diff --git a/Completion/Unix/Command/_ssh b/Completion/Unix/Command/_ssh index 6763e24e7..984c96e93 100644 --- a/Completion/Unix/Command/_ssh +++ b/Completion/Unix/Command/_ssh @@ -51,7 +51,7 @@ _ssh () { '(-1)-m+[specify mac algorithms]:mac spec:->macs' \ '(-1)-N[do not execute a remote command (protocol version 2 only)]' \ '-n[redirect stdin from /dev/null]' \ - '-O:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R"))' \ + '-O[control an active connection multiplexing master process]:multiplex control command:((check\:"check master process is running" exit\:"request the master to exit" forward\:"request forward without command execution" stop\:"request the master to stop accepting further multiplexing requests" cancel\:"cancel existing forwardings with -L and/or -R" proxy))' \ '-P[use non privileged port]' \ '-p+[specify port on remote host]:port number on remote host' \ '(-v)*-q[quiet operation]' \ @@ -150,7 +150,7 @@ _ssh () { "$p1($cmn)-E[specify hash algorithm for displayed fingerprints]:hash algorithim:(md5 sha256)" \ - create \ '(-P -m)-q[silence ssh-keygen]' \ - "(-P -m)-t[specify the type of the key to create]:key type:(rsa1 rsa dsa ecdsa ed25519)" \ + "(-P -m)-t[specify the type of the key to create]:key type:(rsa dsa ecdsa ed25519)" \ - dns \ "($cmn)-r[print DNS resource record]:hostname:_hosts" \ "$p1($cmn)-g[use generic DNS format]" \ @@ -680,17 +680,23 @@ _ssh_hosts () { config="$HOME/.ssh/config" fi if [[ -r $config ]]; then - local key hosts host - while IFS=$'=\t ' read -r key hosts; do - if [[ "$key" == (#i)host ]]; then - for host in ${(z)hosts}; do - case $host in - (*[*?]*) ;; - (*) config_hosts+=("$host") ;; - esac - done - fi - done < "$config" + local key line host + local -a lines=("${(@f)$(<"$config")}") 2>/dev/null + while (($#lines)); do + IFS=$'=\t ' read -r key line <<<"${lines[1]}" + case "$key" in + ((#i)include) + lines[1]=("${(@f)$(cd $HOME/.ssh; cat ${(z)~line})}") 2>/dev/null;; + ((#i)host(|name)) + for host in ${(z)line}; do + case $host in + (*[*?]*) ;; + (*) config_hosts+=("$host") ;; + esac + done ;& + (*) shift lines;; + esac + done if (( ${#config_hosts} )); then _wanted hosts expl 'remote host name' \ compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" $config_hosts diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit index f313f651a..e31af460a 100644 --- a/Completion/Unix/Command/_stgit +++ b/Completion/Unix/Command/_stgit @@ -4,7 +4,7 @@ typeset -a subcmds subcmds=( ${${${(M)${(f)"$(stg help 2> /dev/null)"}## *}# }/#(#b)([^[:space:]]##)[[:space:]]##(*)/$match[1]:$match[2]} ) -local curcontext="$curcontext" +local curcontext="$curcontext" expl local subcmd local ret=1 @@ -18,17 +18,17 @@ else case $subcmd in (push) - _wanted -V "unapplied patches" expl "patch" \ + _wanted -V unapplied-patches expl "patch" \ compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##- *}#- } \ && ret=0 ;; (pop) - _wanted -V "applied patches" expl "patch" \ + _wanted -V applied-patches expl "patch" \ compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \ && ret=0 ;; - (edit|files|goto|rename|log|float|delete|sink|mail|sync|show|pick|hide) - _wanted -V "patches" expl "patch" \ + (edit|files|goto|rename|log|float|delete|sink|mail|sync|show|pick|hide|squash) + _wanted -V patches expl "patch" \ compadd $(stg series --noprefix 2> /dev/null) \ && ret=0 ;; @@ -36,7 +36,7 @@ else last_word="$words[$CURRENT-1]" refresh_patch_options=( -p --patch ) if [[ -n ${refresh_patch_options[(r)$last_word]} ]]; then - _wanted -V "applied patches" expl "patch" \ + _wanted -V applied-patches expl "patch" \ compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \ && ret=0 else diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index 726d87c2b..f244b0ace 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -16,11 +16,12 @@ if _pick_variant gnu=GNU solaris --version; then fi args=( '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames' - '--help[display usage information and exit]' - '--info[display list of architectures and object formats]' + '(-)--help[display usage information]' + '(-)--info[display list of architectures and object formats]' '(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames' '(-O --output-target)'{-I+,--output-target=}'[object code format of output]:bfd name:->bfdnames' '*'{-R+,--remove-section=}'[remove given sections]:section name' + '--remove-relocations=[remove relocations from specified section]:section' '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]' '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]' '--strip-unneeded[remove symbols not needed for relocation processing]' @@ -33,7 +34,7 @@ if _pick_variant gnu=GNU solaris --version; then '(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]' '--keep-file-symbols[retain symbols specifying source file names]' '--only-keep-debug[remove everything except debugging information]' - '(-V --version)'{-V,--version}'[display version information and exit]' + '(-)'{-V,--version}'[display version information and exit]' '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]') else args=( diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index b0c032024..b4ccccfae 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -36,7 +36,12 @@ _svn () { _svn_cmds=( ${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) - _store_cache svn-cmds _svn_cmds + if (( $? == 0 )); then + _store_cache svn-cmds _svn_cmds + else + # Ensure we enter this block again on the next <TAB>. + unset _svn_cmds + fi fi fi @@ -135,7 +140,7 @@ _svn () { ) ;; (mergeinfo) - args[(r)--show-revs:arg:]=( '--show-revs=:revisions:(merged eligible)' ) + args[(r)--show-revs=:arg:]=( '--show-revs=:revisions:(merged eligible)' ) ;; (propget|propedit|propdel) args+=( @@ -145,7 +150,8 @@ _svn () { ;; (propset) args=( - ':propname:(svn:ignore svn:keywords svn:executable svn:eol-style svn:mime-type svn:externals svn:needs-lock)' + ':propname:(svn:ignore svn:keywords svn:executable svn:eol-style svn:mime-type svn:externals svn:needs-lock svn:global-ignores svn:auto-props)' + ':propval:->propset_propval' ${args/(#b)(*--file*):arg:/$match[1]:file:_files} '*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"' ) @@ -174,6 +180,28 @@ _svn () { esac _arguments "$args[@]" && ret=0 + case $state in + (propset_propval) + case $words[2] in + (svn:executable|svn:needs-lock) compadd yes;; + (svn:keywords) + compset -q + # '_values -w' only excludes words in argv[1] or later, so + # install a dummy argv[0]. This affects Foo in [[svn propset + # svn:keywords 'Foo Bar Baz <TAB>]]. + words=( dummy $words ); (( ++CURRENT )) + _values -s ' ' -w "keywords (or custom)" \ + '(URL HeadURL)'{URL,HeadURL}'[URL for the head version of the file]' \ + '(Author LastChangedBy)'{Author,LastChangedBy}'[last person to modify the file]' \ + '(Date LastChangedDate)'{Date,LastChangedDate}'[date/time the file was last modified]' \ + '(Rev Revision LastChangedRevision)'{Rev,Revision,LastChangedRevision}'[last revision the file changed]' \ + Id'[compressed summary of URL,Revision,Date,Author]' \ + Header"[like 'Id' but includes the full URL]";; + (svn:eol-style) compadd - CR LF CRLF native;; + (svn:mime-type) _mime_types;; + (*) _message 'property value';; + esac + esac else _message "unknown svn command: $words[1]" diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo index aa7a1a498..ec293d469 100644 --- a/Completion/Unix/Command/_sudo +++ b/Completion/Unix/Command/_sudo @@ -26,6 +26,7 @@ args=( '(-r --role)'{-r+,--role=}'[create SELinux security context with specified role]:role' '(-S --stdin)'{-S,--stdin}'[read password from standard input]' '(-t --type)'{-t+,--type=}'[create SELinux security context with specified type]:type' + '(-T --command-timeout)'{-T+,--command-timeout=}'[terminate command after specified time limit]:timeout' '(-U --other-user)'{-U+,--other-user=}'[in list mode, display privileges for user]:user:_users' '(-u --user)'{-u+,--user=}'[run command (or edit file) as specified user]:user:_users' '(-)'{-V,--version}'[display version information and exit]' diff --git a/Completion/Unix/Command/_swaks b/Completion/Unix/Command/_swaks new file mode 100644 index 000000000..a0ffb53ad --- /dev/null +++ b/Completion/Unix/Command/_swaks @@ -0,0 +1,40 @@ +#compdef swaks + +_arguments \ + '(-s --server -p --port)'{-s+,--server=}'[target host[:port\]]:host[\:port]:_hosts' \ + '(-p --port)'{-p+,--port=}'[target port number]:port number:(25 465 587)' \ + '--copy-routing[derive target host:port from email address domain part]:email address domain part' \ + '(-t --to)'{-t+,--to=}':envelope recipient(s):_sequence _email_addresses -c' \ + '(-f --from)'{-f+,--from=}':envelope sender:_email_addresses -c' \ + '(--ehlo --lhlo -h --helo)'{-h+,--ehlo,--helo,--lhlo}':HELO string:_hosts' \ + '(-q --quit-after)'{-q+,--quit-after=}'[stop transaction early]:stop point:(( + CONNECT\:banner BANNER\:banner + FIRST-HELO\:first\ HELO FIRST-EHLO\:first\ HELO + XCLIENT\:XCLIENT + TLS\:TLS\ negotiation + HELO\:second\ HELO EHLO\:second\ HELO + AUTH\:authentication + MAIL\:MAIL\ FROM FROM\:MAIL\ FROM + RCPT\:RCPT\ TO TO\:RCPT\ TO + ))' \ + '--protocol=:protocol variant:(( + SMTP\:HELO\ 25 + SSMTP\:EHLO\ 465 + SSMTPA\:EHLO\ 465\ authenticated + SMTPS\:HELO\ 465 + ESMTP\:EHLO\ 25 + ESMTPA\:EHLO\ 25\ authenticated + ESMTPS\:EHLO\ STARTTLS\ 25 + ESMTPSA\:EHLO\ STARTTLS\ 25\ authenticated + ))' \ + '-tls[TLS required]' \ + '(-tlsos --tls-optional-strict)'{-tlsos,--tls-optional-strict}'[TLS iff offered by target]' \ + '(-tlsc --tls-on-connect)'{-tlsc,--tls-on-connect}'[TLS on connect (port 465)]' \ + '(-tlsp --tls-protocol)'{-tlsp,--tls-protocol=}':TLS protocol:(sslv2 sslv3 tlsv1 tlsv1_1 tlsv1_2)' \ + '-tls-cipher:OpenSSL cipher string: ' \ + '--tls-verify[verify TLS certificates]' \ + '--tls-ca-path=:OpenSSL CAfile or CAdir:_files' \ + '--tls-get-peer-cert=-:file to write (omit for STDOUT)' \ + '(-d --data)'{-d+,--data=}'[specify DATA payload]:filename (or string with tokens):_files' \ + '*'{-ah,--add-header=}'[add headers]:<Header>\: Value' \ + '*'{-h,--header=}'[replace headers]:<Header>\: Value' diff --git a/Completion/Unix/Command/_swift b/Completion/Unix/Command/_swift new file mode 100644 index 000000000..6776f0dea --- /dev/null +++ b/Completion/Unix/Command/_swift @@ -0,0 +1,123 @@ +#compdef swift swiftc + +# swift(1) and swiftc(1) are part of the Swift programming language. +# https://swift.org/ + +local -a common_options swiftc_mode_options swiftc_additional_options +local -A swiftc_modes + +common_options=( + '-assert-config[specify the assert_configuration replacement]:config:(Debug Release Unchecked DisableReplacement)' + '*-D[marks a conditional compilation flag as true]:flag:' + '*-framework[specifies a framework which should be linked against]:framework:' + '*-F[add directory to framework search path]:path:_files -/' + '(-gnone)-gdwarf-types[emit full DWARF type info]' + '(-gnone)-gline-tables-only[emit minimal debug info for backtraces only]' + '(-gdwarf-types -gline-tables-only -g)-gnone[do not emit debug info]' + '(-gnone)-g[emit debug info]' + '(- : *)-help[display available options]' + '-index-store-path[store indexing data to the specified path]:directory:_files -/' + '*-I[add directory to the import search path]:path:_files -/' + '-j[number of commands to execute in parallel]:count:' + '*-L[add directory to library link search path]:path:_files -/' + '*-l-[specifies a library which should be linked against]:library:' + '-module-cache-path[specifies the Clang module cache path]:path:_files -/' + '-module-link-name[library to link against when using this module]:name:' + '-module-name[name of the module to build]:name:' + '-nostdimport[do not search the standard library import path for modules]' + '-num-threads[enable multi-threading and specify number of threads]:count:' + '(-Ounchecked -O)-Onone[compile without any optimization]' + '(-Onone)-Ounchecked[compile with optimizations and remove runtime safety checks]' + '(-Onone)-O[compile with optimizations]' + '-sdk[compile against SDK]:sdk:_files -/' + '-static-stdlib[statically link the Swift standard library]' + '-suppress-warnings[suppress all warnings]' + '-target-cpu[generate code for a particular CPU variant]:cpu' + '-target[generate code for the given target]:target' + '-use-ld=-[specifies the linker to be used]:linker:_files -/' + '(- : *)-version[print version information and exit]' + '-v[show commands to run and use verbose output]' + '-warnings-as-errors[treat warnings as errors]' + '*-Xcc[pass argument to the C/C++/Objective-C compiler]:arg:' + '*-Xlinker[specifies an option which should be passed to the linker]:option:' +) + +swiftc_modes=( + -dump-ast 'parse and type-check input file(s) and dump AST(s)' + -dump-parse 'parse input file(s) and dump AST(s)' + -dump-type-refinement-contexts + 'type-check input file(s) and dump type refinement contexts(s)' + -emit-assembly 'emit assembly file(s) (-S)' + -emit-bc 'emit LLVM BC file(s)' + -emit-executable 'emit a linked executable' + -emit-ir 'emit LLVM IR file(s)' + -emit-library 'emit a linked library' + -emit-object 'emit object file(s) (-c)' + -emit-sibgen 'emit serialized AST + raw SIL file(s)' + -emit-sib 'emit serialized AST + canonical SIL file(s)' + -emit-silgen 'emit raw SIL file(s)' + -emit-sil 'emit canonical SIL file(s)' + -parse 'parse input file(s)' + -print-ast 'parse and type-check input file(s) and pretty print AST(s)' +) +local mode +for mode in ${(k)swiftc_modes}; do + # Mode options are mutually exclusive + swiftc_mode_options+=("(${(k)swiftc_modes})${mode}[$swiftc_modes[$mode]]") +done + +swiftc_additional_options=( + '-application-extension[restrict code to those available for App Extensions]' + '-embed-bitcode-marker[embed placeholder LLVM IR data as a marker]' + '-embed-bitcode[embed LLVM IR bitcode as data]' + '-emit-dependencies[emit basic Make-compatible dependencies files]' + '-emit-module-path[emit an importable module to the specified path]:path:_files -/' + '-emit-module[emit an importable module]' + '-emit-objc-header-path[emit an Objective-C header file to the specified path]:path:_files -/' + '-emit-objc-header[emit an Objective-C header file]' + '-fixit-all[apply all fixits from diagnostics without any filtering]' + '-fixit-code[get compiler fixits as code edits]' + '-import-underlying-module[implicitly imports the Objective-C half of a module]' + '-output-file-map[a file which specifies the location of outputs]:path:_files' + '-o[write output to specified file]:path:_files' + '-parse-as-library[parse the input file(s) as libraries, not scripts]' + '-parse-sil[parse the input file as SIL code, not Swift source]' + '-parseable-output[emit textual output in a parseable format]' + '-profile-coverage-mapping[generate coverage data for use with profiled execution counts]' + '-profile-generate[generate instrumented code to collect execution counts]' + '-sanitize-coverage=-[specify the type of coverage instrumentation for Sanitizers and additional options separated by commas]:type:' + '*-sanitize=-[turn on runtime checks for erroneous behavior]:check:' + '-save-temps[save intermediate compilation results]' + '-serialize-diagnostics[serialize diagnostics in a binary format]' + '-tools-directory[look for external executables (ld, clang, binutils) in the specified directory]:directory:_files -/' + '-whole-module-optimization[optimize input files together instead of individually]' +) + +case "$words[1]" in + swift) + # The name swift conflicts with the command with the same name from the + # OpenStack project. We delegate completion to _openstack if swift(1) is + # detected to be from OpenStack. + local variant + _pick_variant -r variant openstack=OpenStack swiftlang='Swift compiler' unknown --help + case $variant in + openstack) + _openstack "$@" + ;; + swiftlang) + _arguments \ + "$common_options[@]" \ + '*:input:_files' + ;; + *) + _default "$@" + esac + ;; + swiftc) + _arguments \ + "$swiftc_mode_options[@]" \ + "$common_options[@]" \ + "$swiftc_additional_options[@]" \ + '*:input:_files' + ;; +esac diff --git a/Completion/Unix/Command/_tcpdump b/Completion/Unix/Command/_tcpdump index d73956154..2c1d82226 100644 --- a/Completion/Unix/Command/_tcpdump +++ b/Completion/Unix/Command/_tcpdump @@ -2,10 +2,17 @@ typeset -A opt_args -_interfaces () { - _wanted interfaces expl 'network interface' \ - _net_interfaces - _values "Pseudo-device that captures on all interfaces" "any" +_interfaces() { + local disp expl sep + _description interfaces expl 'network interface' + _net_interfaces "$expl[@]" + if zstyle -t ":completion:${curcontext}:interfaces" verbose; then + zstyle -s ":completion:${curcontext}:interfaces" list-separator sep || sep=-- + disp=( "any $sep capture on all interfaces" ) + compadd "$expl[@]" -ld disp any + else + compadd "$expl[@]" any + fi } _esp_secrets () { diff --git a/Completion/Unix/Command/_texinfo b/Completion/Unix/Command/_texinfo index 7b66d6304..57e13bdc2 100644 --- a/Completion/Unix/Command/_texinfo +++ b/Completion/Unix/Command/_texinfo @@ -227,7 +227,7 @@ esac if [[ -n $state ]]; then local chr cache file q - local -a suf tags + local -a expl suf tags local -i36 hash=5381 local -aU infopath=( /usr/share/info ${commands[info]:h:h}/share/info ${(s.:.)INFOPATH} $infodirs ) infopath=( $^infopath(N) ) diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux index 08d80374f..7ef20c666 100644 --- a/Completion/Unix/Command/_tmux +++ b/Completion/Unix/Command/_tmux @@ -526,7 +526,7 @@ _tmux-new-session() { '-t+[specify target session]:session:__tmux-sessions' \ '-x[specify width]:width' \ '-y[specify height]:height' \ - '*:: :_cmdstring' + '*:: :_cmdambivalent' } _tmux-new-window() { @@ -540,7 +540,7 @@ _tmux-new-window() { '-n+[specify a window name]:window name' \ '-P[print information about new window after it is created]' \ '-t+[specify target window]:window:__tmux-windows' \ - '*:: :_cmdstring' + '*:: :_cmdambivalent' } _tmux-next-layout() { @@ -628,7 +628,7 @@ _tmux-respawn-pane() { _arguments -s -A "-*" -S \ '-k[kill window if it is in use]' \ '-t+[specify target pane]:pane:__tmux-pane' \ - ':command:_cmdstring' + ':command:_cmdambivalent' } _tmux-respawn-window() { @@ -636,7 +636,7 @@ _tmux-respawn-window() { _arguments -s -A "-*" -S \ '-k[kill window if it is in use]' \ '-t+[specify target window]:window:__tmux-windows' \ - ':command:_cmdstring' + ':command:_cmdambivalent' } _tmux-rotate-window() { @@ -669,7 +669,7 @@ _tmux-select-layout() { '-o[revert to previous layout]' \ '-p[behave like previous-layout]' \ '-t+[specify a target window]:target window:__tmux-windows' \ - ':layout:(even-horizontal even-vertical main-horizontal main-vertical)' + ':layout:(even-horizontal even-vertical main-horizontal main-vertical tiled)' } _tmux-select-pane() { @@ -855,7 +855,7 @@ _tmux-split-window() { "-l[define new pane's size]:size" \ "-p[define new pane's size in percent]:size (percentage)" \ '-t+[specify target pane]:pane:__tmux-panes' \ - ':command:_cmdstring' + ':command:_cmdambivalent' # Yes, __tmux-panes is correct here. The behaviour was changed # in recent tmux versions and makes more sense. Except that # changing the command's name might annoy users. So it stays like diff --git a/Completion/Unix/Command/_units b/Completion/Unix/Command/_units index d049d22ab..bea77ae67 100644 --- a/Completion/Unix/Command/_units +++ b/Completion/Unix/Command/_units @@ -1,6 +1,6 @@ #compdef units -local curcontext="$curcontext" state line +local curcontext="$curcontext" state line expl integer ret=1 typeset -A opt_args diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin index f0777729c..7eeec7e9b 100644 --- a/Completion/Unix/Command/_user_admin +++ b/Completion/Unix/Command/_user_admin @@ -125,7 +125,7 @@ case ${service%???}:${(M)service%???}:$OSTYPE in ;| group:*) args+=( - '(-g,--gid)'{-g+,--gid=}'[specify gid]:gid' + '(-g --gid)'{-g+,--gid=}'[specify gid]:gid' '(-o --non-unique)'{-o,--non-unique}'[allow non unique gid]' ) ;| diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget index b89f12353..8a9cc871a 100644 --- a/Completion/Unix/Command/_wget +++ b/Completion/Unix/Command/_wget @@ -32,7 +32,7 @@ _arguments -C -s \ '(--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)' \ - '(--wait,-w)'{--wait=,-w+}'[specify wait between retrievals]:time (seconds)' \ + '(--wait -w)'{--wait=,-w+}'[specify wait between retrievals]:time (seconds)' \ '(--random-wait)--waitretry=:time (seconds)' \ '(--waitretry)--random-wait[random wait time between retrievals]' \ '(--proxy -Y --no-proxy)'{--proxy=,-Y+}'[explicitly turn on proxy]' \ diff --git a/Completion/Unix/Command/_xz b/Completion/Unix/Command/_xz index 028285a35..a4dfea1f5 100644 --- a/Completion/Unix/Command/_xz +++ b/Completion/Unix/Command/_xz @@ -2,7 +2,6 @@ local decompress files expl state line curcontext="$curcontext" ret=1 typeset -A opt_args -local decomp="(-z --compress --decompress -d --test -t --list -l --single-stream --no-sparse)" files=( '(--files --files0)*:files:->files' ) case "$service" in @@ -14,53 +13,55 @@ case "$service" in ;& xz) decompress=no;& unxz) _arguments -C -s -S "$files[@]" \ + '--robot[use machine-parsable messages]' \ + + 'common' \ + '(I -k --keep)'{-k,--keep}"[keep (don't delete) input files]" \ + '(I -f --force)'{-f,--force}'[force overwrite]' \ + '(I -c --stdout)'{-c,--stdout}'[write on standard output]' \ + '(I)*'{-q,--quiet}'[suppress all warnings]' \ + '(I)*'{-v,--verbose}'[verbose mode]' \ + '(I * --files --files0)--files=-[read list of files to process from file]::file:_files' \ + '(I * --files --files0)--files0=-[read null terminated list of files to process from file]::file:_files' \ + '(I -F --format)'{-F,--format}'=[specify file format]:format:(auto xz lzma raw)' \ + '(I -T --threads)'{-T+,--threads=}'[use specified number of threads]:threads [1]' \ + '(I -M --memlimit --memory)'{-M+,--memlimit=,--memory=}'[set memory usage limit]:memory usage' \ + '(I)--no-adjust[give error if settings exceed memory limit]' \ + '(I -Q --no-warn)'{-Q,--no-warn}'[make warnings not affect exit status]' \ + + 'comp' \ + "(I decomp)"{-z,--compress}'[compress]' \ + '(I decomp -e --extreme)'{-e,--extreme}'[try to improve compression ratio by using more CPU time]' \ + '(I decomp -S --suffix)'{-S+,--suffix=}'[use specified suffix for compressed files]:suffix [.xz]' \ + '(I decomp -C --check)'{-C,--check}'=[integrity check type]:check type:(none crc32 crc64 sha256)' \ + '(I decomp)--block-size=[start a new .xz block after specified bytes of input]:size' \ + '(I decomp)--block-list=[start a new .xz block after specified intervals of uncompressed data]:size' \ + '(I decomp)--flush-timeout=[specify maximum time between flushing of output]:time (ms) [0]' \ + '(I decomp)--memlimit-compress=[set memory usage limit for compression]:memory usage' \ + + 'decomp' \ + '(I comp level filters)'{-d,--decompress}'[decompress]' \ + '(I comp level filters)'{-t,--test}'[test compressed file integrity]' \ + '(I comp level filters)'{-l,--list}'[list information about .xz files]' \ + "(I comp level filters)--ignore-check[don't verify integrity when decompressing]" \ + '(I comp level filters)--single-stream[decompress only the first stream]' \ + "(I comp level filters)--no-sparse[don't create sparse files when decompressing]" \ + '(I comp level filters)--memlimit-decompress=[set memory usage limit for decompression]:memory usage' \ + + '(I)' \ + '(* comp decomp level filters common)--info-memory[display amount of RAM and memory usage limits]' \ '(- *)'{-h,--help}'[display help message]' \ '(- *)'{-H,--long-help}'[display the long help (lists also the advanced options)]' \ - '(-d --decompress --compress -z --test -t --list -l)'{-d,--decompress}'[decompress]' \ - "${decomp}"{-z,--compress}'[compress]' \ - '(-k --keep)'{-k,--keep}"[keep (don't delete) input files]" \ - '(-f --force)'{-f,--force}'[force overwrite]' \ - '(-t --test --decompress -d --compress -z --list -l)'{-t,--test}'[test compressed file integrity]' \ - '(-t --test --decompress -d --compress -z --list -l)'{-l,--list}'[list information about .xz files]' \ - '(-c --stdout)'{-c,--stdout}'[write on standard output]' \ - \*{-q,--quiet}'[suppress all warnings]' \ - \*{-v,--verbose}'[verbose mode]' \ - '(- *)'{-V,--version}'[display version number]' \ - '(-e --extreme)'{-e,--extreme}'[try to improve compression ratio by using more CPU time]' \ - '(-1 -2 -3 -4 -5 -6 -7 -8 -9 --fast )--best' \ - '(-1 -2 -3 -4 -5 -6 -7 -8 -9 --best)--fast' \ - '( -2 -3 -4 -5 -6 -7 -8 -9 --fast --best)-1' \ - '(-1 -3 -4 -5 -6 -7 -8 -9 --fast --best)-2' \ - '(-1 -2 -4 -5 -6 -7 -8 -9 --fast --best)-3' \ - '(-1 -2 -3 -5 -6 -7 -8 -9 --fast --best)-4' \ - '(-1 -2 -3 -4 -6 -7 -8 -9 --fast --best)-5' \ - '(-1 -2 -3 -4 -5 -7 -8 -9 --fast --best)-6' \ - '(-1 -2 -3 -4 -5 -6 -8 -9 --fast --best)-7' \ - '(-1 -2 -3 -4 -5 -6 -7 -9 --fast --best)-8' \ - '(-1 -2 -3 -4 -5 -6 -7 -8 --fast --best)-9' \ - "${decomp}--single-stream[decompress only the first stream]" \ - "${decomp}--no-sparse[do not create sparse files when decompressing]" \ - '(* --files --files0)--files=-[read list of files to process from file]::file:_files' \ - '(* --files --files0)--files0=-[read null terminated list of files to process from file]::file:_files' \ - '(-F --format)'{-F,--format}'=[specify file format]:format;(auto xz lzma raw)' \ - '(-C --check)'{-C,--check}'=[integrity check type]:check type:(none crc32 crc64 sha256)' \ - '--memlimit-compress=[set memory usage limit for compression]:memory usage' \ - '--memlimit-decompress=[set memory usage limit for decompression]:memory usage' \ - '(-M --memlimit --memory)'{-M+,--memlimit=,--memory=}'[set memory usage limit]:memory usage' \ - '--no-adjust[give error if settings exceed memory limit]' \ - '(-Q --no-warn)'{-Q,--no-warn}'[make warnings not affect exit status]' \ - '--robot[use machine-parsable messages]' \ - --{x86,powerpc,ia64,arm,armthumb,sparc}=-'[add a branch/call/jump filter]::option:->bcj-options' \ - --lzma{1,2}=-'[add lzma filter]::option:->lzma-options' \ - '--delta=-[add delta filter]::option:->delta-options' \ - '(- *)--info-memory[display amount of RAM and memory usage limits]' && ret=0 + '(* comp decomp level filters common)'{-V,--version}'[display version number]' \ + + '(level)' \ + '(I filters decomp)-'{-best,-fast,1,2,3,4,5,6,7,8,9} \ + + filters \ + '(I level decomp --extreme)'--{x86,powerpc,ia64,arm,armthumb,sparc}=-'[add a branch/call/jump filter]::option:->bcj-options' \ + '(I level decomp --extreme)'--lzma{1,2}=-'[add lzma filter]::option:->lzma-options' \ + '(I level decomp --extreme)--delta=-[add delta filter]::option:->delta-options' && ret=0 ;; esac case $state in files) (( $+opt_args[-z] || $+opt_args[--compress] )) && decompress=no - [[ -n $opt_args[(i)-([dtl]|-decompress|-test|-list)] ]] && unset decompress + [[ -n ${(k)opt_args[(i)decomp*]} ]] && unset decompress if [[ -z "$decompress" ]]; then _description files expl 'compressed file' _files "$expl[@]" -g '*.(xz|txz|lzma|tlz)(-.)' && return @@ -71,7 +72,7 @@ case $state in ;; lzma-options) _values -s , options 'preset:preset' 'dict:size' 'lc:context bits' \ - 'lp:position bits' 'mf:matchfinder:(hc3 hc4 bt2 bt3 bt4)' \ + 'lp:position bits' 'pb:position bites' 'mf:matchfinder:(hc3 hc4 bt2 bt3 bt4)' \ 'mode:mode:(fast normal)' 'nice:length' 'depth:depth' && ret=0 ;; bcj-options) diff --git a/Completion/Unix/Command/_yafc b/Completion/Unix/Command/_yafc index edc7c417f..1e0a601a1 100644 --- a/Completion/Unix/Command/_yafc +++ b/Completion/Unix/Command/_yafc @@ -30,7 +30,7 @@ _yafc_bookmarks() { local bkmfile=~/.yafc/bookmarks if [[ -f $bkmfile ]]; then - local -a bkms + local -a bkms expl bkms=(${${${(M)"${(f)$(<$bkmfile)}":#machine*alias ##\'*\' #}##machine*alias ##\'}%%\' #}) #" vim syntax goes crazy _wanted bookmarks expl 'bookmarks' compadd "$@" -a - bkms fi diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool index 950266896..4d4793eea 100644 --- a/Completion/Unix/Command/_zpool +++ b/Completion/Unix/Command/_zpool @@ -237,7 +237,7 @@ _zpool() { _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 -/' \ + '(-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]' \ diff --git a/Completion/Unix/Type/_absolute_command_paths b/Completion/Unix/Type/_absolute_command_paths index e08ca56df..0d52ff851 100644 --- a/Completion/Unix/Type/_absolute_command_paths +++ b/Completion/Unix/Type/_absolute_command_paths @@ -9,7 +9,7 @@ _hashed_absolute_command_paths() { do local -a matches=( "${(@)commands[(R)${~i}[^/]#]}" ) local -a descs=( $matches:t ) - compadd -M "l:|=$i" -d descs "$expl[@]" -a matches + compadd -M "l:|=$i" -d descs "$@" -a matches ret=0 done return ret diff --git a/Completion/Unix/Type/_cmdambivalent b/Completion/Unix/Type/_cmdambivalent new file mode 100644 index 000000000..1f15d11ab --- /dev/null +++ b/Completion/Unix/Type/_cmdambivalent @@ -0,0 +1,17 @@ +#autoload + +if (( CURRENT == 1 && ${#words} == 1 )); then + # Heuristics to decide whether to complete for system() or for execl(). + local space=' ' + if (( ${${words[CURRENT]}[(I)$space]} )); then + _cmdstring + elif [[ ${${compstate[all_quotes]}[1]} == (\'|\") ]]; then + _cmdstring + else + _command_names -e + fi +elif (( CURRENT == 1 )); then + _command_names -e +else + _normal +fi diff --git a/Completion/Unix/Type/_hosts b/Completion/Unix/Type/_hosts index 56540865e..d9e1090a4 100644 --- a/Completion/Unix/Type/_hosts +++ b/Completion/Unix/Type/_hosts @@ -50,12 +50,13 @@ if ! zstyle -a ":completion:${curcontext}:hosts" hosts _hosts; then # entries. () { local host + local -a match mbegin mend khosts=() for host; do if [[ $host == *[*?]* ]]; then continue - elif [[ $host =~ "\[(.*)\]:\d*" ]]; then - khosts+=$match + elif [[ $host = (#b)*\[(*)\]:[[:digit:]]#* ]]; then + khosts+=${match[1]} else khosts+=$host fi diff --git a/Completion/Unix/Type/_remote_files b/Completion/Unix/Type/_remote_files index 1e9fed15e..a5fce9afd 100644 --- a/Completion/Unix/Type/_remote_files +++ b/Completion/Unix/Type/_remote_files @@ -58,11 +58,13 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then else rempat="${(q)PREFIX%%[^./][^/]#}\*" fi + # remote filenames remfiles=(${(M)${(f)"$(_call_program files $cmd $cmd_args $host ls -d1FL -- "$rempat" 2>/dev/null)"}%%[^/]#(|/)}) compset -P '*/' compset -S '/*' || (( ${args[(I)-/]} )) || suf='remote file' + # display strings for remote files and directories remdispf=(${remfiles:#*/}) remdispd=(${(M)remfiles:#*/}) @@ -77,9 +79,9 @@ if zstyle -T ":completion:${curcontext}:files" remote-access; then while _tags; do while _next_label files expl ${suf:-remote directory}; do [[ -n $suf ]] && - compadd "$args[@]" "$expl[@]" -d remdispf ${(q)remdispf%[*=|]} && ret=0 + compadd "$args[@]" "$expl[@]" -d remdispf -- ${(q)remdispf%[*=|]} && ret=0 compadd ${suf:+-S/} -r "/ \t\n\-" "$args[@]" "$expl[@]" -d remdispd \ - ${(q)remdispd%/} && ret=0 + -- ${(q)remdispd%/} && ret=0 done (( ret )) || return 0 done diff --git a/Completion/Unix/Type/_umountable b/Completion/Unix/Type/_umountable new file mode 100644 index 000000000..2b2567478 --- /dev/null +++ b/Completion/Unix/Type/_umountable @@ -0,0 +1,44 @@ +#autoload +local tmp +local dev_tmp dpath_tmp mp_tmp mline + +case "$OSTYPE" in +linux*|irix*) + tmp=( "${(@f)$(< /etc/mtab)}" ) + dev_tmp=( "${(@)${(@)tmp%% *}:#none}" ) + mp_tmp=( "${(@)${(@)tmp#* }%% *}" ) + ;; +freebsd*|dragonfly*) + /sbin/mount | while read mline; do + dev_tmp+=( $mline[(w)1] ) + mp_tmp+=( $mline[(w)3] ) + done +;; +darwin*) + tmp=( "${(@f)$(/sbin/mount)}" ) + dev_tmp=( "${(@)${(@)tmp%% *}:#map}" ) + mp_tmp=( "${(@)${(@)tmp#* on }%% \(*}" ) + ;; +*) + /sbin/mount | while read mline; do + mp_tmp+=( $mline[(w)1] ) + dev_tmp+=( $mline[(w)3] ) + done + ;; +esac + +local MATCH MBEGIN MEND +# The complicated substitution for mount point names is required because +# characters in /etc/mtab that might confuse programs reading the names +# are encoded as exactly 3 octal digits, like for example \040 for space. +# The cleaner-looking ${(g::)mp_tmp} might consume too many digits. +# Both mp_tmp and dev_tmp are derived from /etc/mtab or "mount" output. +mp_tmp=("${(@)mp_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}") +dev_tmp=("${(@)dev_tmp//(#m)\\[0-7](#c3)/${(#)$(( 8#${MATCH[2,-1]} ))}}") +dpath_tmp=( "${(@M)dev_tmp:#/*}" ) +dev_tmp=( "${(@)dev_tmp:#/*}" ) + +_alternative \ + 'device-labels:device label:compadd -a dev_tmp' \ + 'device-paths: device path:_canonical_paths -A dpath_tmp -N -M "r:|/=* r:|=*" device-paths device\ path' \ + 'directories:mount point:_canonical_paths -A mp_tmp -N -M "r:|/=* r:|=*" directories mount\ point' && ret=0 |