From 563a8d2853bef30f72450cafaaa2fb23702fb7f7 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 29 Apr 2018 23:22:44 +0200 Subject: 42728: update options in libtiff tools completion and add handling for tiff2pdf --- Completion/Unix/Command/_tiff | 199 +++++++++++++++++++++++++++--------------- 1 file changed, 130 insertions(+), 69 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/Completion/Unix/Command/_tiff b/Completion/Unix/Command/_tiff index 588476d5a..128aeb0c0 100644 --- a/Completion/Unix/Command/_tiff +++ b/Completion/Unix/Command/_tiff @@ -14,7 +14,7 @@ if [[ $# -ne 0 || $+_in_tiff -ne 0 ]]; then set -- "$expl[@]" fi _wanted files expl 'picture file' _path_files "$@" -g "$pat" - || - _files "$@" "$expl[@]" -g '*.(#i)tiff(-.)' + _files "$@" "$expl[@]" -g '*.(#i)tif(|f)(-.)' return fi @@ -26,87 +26,143 @@ typeset -A opt_args case "$service" in tiff2bw) _arguments -C \ - '-c[specify compression scheme]:compression scheme:->compress' \ - '-r[specify rows per strip]:rows per strip' \ - '-R[specify percentage of red channel]:percentage of red channel' \ - '-G[specify percentage of green channel]:percentage of green channel' \ - '-B[specify percentage of blue channel]:percentage of blue channel' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ + '-r+[specify rows per strip]:rows per strip' \ + '-R+[specify percentage of red channel]:percentage' \ + '-G+[specify percentage of green channel]:percentage' \ + '-B+[specify percentage of blue channel]:percentage' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; +tiff2pdf) + _arguments -s \ + '-o+[specify output file]:output file:_files -g "*.(#i)pdf(-.)"' \ + '(-z -d)-j[compress with JPEG]' \ + '(-j -d)-z[compress with Zip/Deflate]' \ + '-q+[specify compression quality]:quality' \ + '-n[no compressed data passthrough]' \ + "(-z -j)-d[don't compress]" \ + '-i[invert colors]' \ + '-u+[set distance unit]:unit:((i\:inches m\:centimeters))' \ + '-x+[set x resolution]:resolution (dots per unit)' \ + '-y+[set y resolution]:resolution (dots per unit)' \ + '-w+[specify width in units]:width' \ + '-l+[specify length in units]:length' \ + '-r+[specify scope for resolution settings]:scope:((d\:images\ without\ resolution o\:all\ images))' \ + '-p+[specify paper size]:paper size:(letter legal A4)' \ + '-F[make the tiff fill the PDF page]' \ + '-f[set PDF "Fit Window" user preference]' \ + '-e+[specify date]:date (YYYYMMDDHHMMSS)' \ + '-c+[set document creator, overrides image software default]:creator' \ + '-a+[set document author, overrides image artist default]:author' \ + '-t+[set document title, overrides image document name default]:title' \ + '-s+[set document subject, overrides image image description default]:subject' \ + '-k+[set document keywords]:keywords' \ + '-b[set PDF "Interpolate" user preference]' \ + '(- :)-h[display usage information]' \ + ':input file:_files -g "*.(#i)tif(|f)(-.)"' + ;; tiff2ps) - _arguments \ - '-1[generate PostScript Level I output]' \ - '-2[generate PostScript Level II output]' \ + _arguments -s \ + '!(-2 -3 -8 -m)-1' \ + '(-3)-2[generate PostScript Level 2 output]' \ + '(-2)-3[generate PostScript Level 3 output]' \ + '-8[disable use of ASCII85 encoding with PostScript Level 2/3]' \ '-a[generate output for all IFDs]' \ - '-d[set initial TIFF directory]:initial TIFF directory' \ - '(-p)-e[generate Encapsulated PostScript]' \ - '-o[set initial TIFF directory (file offset)]:file offset' \ + '-b+[set the bottom margin]:margin (inches)' \ + '-c[center image]' \ + '-C+[set postscript document creator name]:creator' \ + '-d+[set initial TIFF directory]:initial TIFF directory' \ + '(-e)-D[print two pages per sheet (duplex)]' \ + '(-p -D -T)-e[generate Encapsulated PostScript]' \ + '-h+[set printed page height]:height (inches)' \ + '-w+[set printed page width]:width (inches)' \ + '(-W)-H+[split image if height is more than specified value]:limit (inches)' \ + '(-H)-W+[split image if width is more than specified value]:limit (inches)' \ + '-L+[specify overlap for split images]:overlap (inches)' \ + '-i+[enable/disable (Nz/0) pixel interpolation]:state [enabled]:((0\:disable 1\:enable))' \ + '-l+[set the left margin]:margin (inches)' \ + '-m[use "imagemask" operator instead of "image"]' \ + '-o+[set initial TIFF directory (file offset)]:file offset (bytes)' \ '(-e)-p[generate non-Encapsulated PostScript]' \ - '-h[set page height]:page height' \ - '-w[set page width]:page width' \ - '-8[disable use of ASCII85 encoding]' \ - '-D[print two pages per sheet]' \ - '-O[specify output file]:output file:_files -g "*.(#i)ps(-.)"' \ + '-O+[specify output file]:output file:_files -g "*.(#i)(|e)ps(-.)"' \ + '-P+[set PageOrientation DSC comment to Landscape or Portrait]:orientation:(L P)' \ + '-r+[rotate image]:rotation:(90 180 270 auto)' \ '-s[generate output for a single image]' \ - '-T[print pages for top edge binding]' \ + '-t+[set postscript document title]:title' \ + '(-e)-T[print pages for top edge binding]' \ + '(-y)-x[override resolution units as centimeters]' \ + '(-x)-y[override resolution units as inches]' \ + '-z[enable printing in the deadzone]' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffcmp) - _arguments \ + _arguments -s \ '-l[list all differing bytes]' \ + '-z+[list specified number of bytes that differs between the files]:bytes' \ '-t[ignore differences in directories]' \ ':first input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' \ ':second input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffcp) - _arguments -C \ - '-B[write output in bin-endian byte order]' \ - '-c[specify compression scheme]:compression scheme:->compress' \ - '-o[set initial TIFF directory (file offset)]:file offset' \ - '-p[set sample packing]:sample packing:(contig separate)' \ + _arguments -C -s \ + '-a[append to output instead of overwriting]' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ + '-o+[set initial TIFF directory (file offset)]:file offset' \ + '-p+[set sample packing]:sample packing:(contig separate)' \ '(-t)-s[write output in strips]' \ '(-s)-t[write output in tiles]' \ + '-x[force the merged tiff pages in sequence]' \ + '-8[write BigTIFF instead of default ClassicTIFF]' \ + '(-L)-B[write output in big-endian byte order instead of native ordering]' \ + '(-B)-L[write output in little-endian byte order instead of native ordering]' \ + '-M[disable use of memory-mapped files]' \ + '-C[disable strip chopping]' \ '-i[ignore read errors]' \ - '-r[specify rows per strip]:rows per strip' \ - '-w[specify output tile width]:output tile width' \ - '-l[specify output tile length]:output tile length' \ - '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \ - '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 + '-b+[specify bias (dark) monochrome image to be subtracted from all others]:file:_files' \ + '-,=-[specify substitute character for image indices]:character [,]' \ + '-r+[specify rows per strip]:rows per strip' \ + '-w+[specify output tile width]:output tile width' \ + '-l+[specify output tile length]:output tile length' \ + '-f+[specify fill order]:fill order:(lsb2msb msb2lsb)' \ + '*:TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffdither) _arguments -C \ - '-c[specify compression scheme]:compression scheme:->compress' \ - '-f[specify fill order]:fill order:(lsb2msb msb2lsb)' \ - '-r[specify rows per strip]:rows per strip' \ - '-t[set threshold for dithering]:dither threshold value' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ + '-f+[specify fill order]:fill order:(lsb2msb msb2lsb)' \ + '-r+[specify rows per strip]:rows per strip' \ + '-t+[set threshold for dithering]:dither threshold value [128]' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffdump) _arguments \ - '-o[set initial TIFF directory (file offset)]:file offset:' \ + '-o+[set initial TIFF directory (file offset)]:file offset' \ '-h[print numbers in hexadecimal]' \ + '-m+[change number of indirect items printed]:items [24]' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffinfo) - _arguments \ + _arguments -s \ '-c[display colormap and color/gray response curves]' \ '-D[read and decompress data]' \ '-d[print decompressed data]' \ '-j[display JPEG-related tags]' \ - '-o[set initial TIFF directory (file offset)]:file offset' \ + '-o+[set initial TIFF directory (file offset)]:file offset' \ + '-r[read/display raw image data instead of decoded data]' \ '-s[display offsets and byte counts for all data strips]' \ '-i[ignore read errors]' \ - '-f[force fill order]:fill order:(lsb2msb msb2lsb)' \ + '-f+[force fill order]:fill order:(lsb2msb msb2lsb)' \ '-w[display raw data in words]' \ + '-z[enable strip chopping]' \ '*:input TIFF file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; tiffmedian) _arguments -C \ - '-r[specify rows per strip]:rows per strip' \ - '-C[specify number of colormap entries]:number of colormap entries' \ - '-c[specify compression scheme]:compression scheme:->compress' \ + '-r+[specify rows per strip]:rows per strip' \ + '-C+[specify number of colormap entries]:number of colormap entries' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ '-f[use Floyd-Steinberg dithering]' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 @@ -117,52 +173,57 @@ tiffsplit) ':output file prefix' && ret=0 ;; fax2tiff) - _arguments \ + _arguments -s \ + '!(-1 -2 -3 -4)-'{1,3} \ '(-1 -4)-2[input is Group 3, 2d encoded]' \ - '(-2 -4)-1[input is Group 3, 1d encoded]' \ - '(-1 -2)-4[input is Group 4 encoded]' \ - '(-W)-B[0 in input is black]' \ - '(-B)-W[0 in input is white]' \ - '(-M)-L[input is lsb-to-msb]' \ - '(-L)-M[input is msb-to-lsb]' \ - '-R[specify resolution]:resolution (lines per inch)' \ - '-o[specify output file]:output file:_files -g "*.(#i)tif(|f)(-.)"' \ - '(-f)-c[generate `classic'"'"' TIFF format]' \ - '(-c)-f[generate TIFF Class F format]' \ + '(-1 -2 -A)-4[input is Group 4 encoded]' \ + '-U[input is uncompressed]' \ + '(-4)-A[input is EOL-aligned]' \ + '-B[0 in input means black]' \ + '-M[input is msb-to-lsb]' \ + '-R+[specify resolution]:resolution (lines per inch) [196]' \ + '-X+[specify input data width]:width [1728]' \ + '-o+[specify output file]:output file:_files -g "*.(#i)tif(|f)(-.)"' \ + '(-5 -p)-8[generate G4-encoded output]' \ + '-u[generate uncompressed output]' \ + '(-8)-5[generate 1d encoded output]' \ + "(-8)-p[don't align EOL codes]" \ + '-c[generate `classic'"'"' TIFF format]' \ '-m[output in msb-to-lsb order]' \ - "-p[don't align EOL codes]" \ - '-s[duplicate all rows]' \ + '-r+[specify rows per strip]:rows per strip' \ + '-s[stretch image by duplicating all rows]' \ '-v[verbose mode]' \ + '-z[generate LZW compressed output]' \ ':FAX input file:_files -g "*.(#i)(g[34]|fax)(-.)"' && ret=0 ;; gif2tiff) _arguments -C \ - '-r[specify rows per strip]:rows per strip' \ - '-c[specify compression scheme]:compression scheme:->compress' \ + '-r+[specify rows per strip]:rows per strip' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ ':input GIF file:_files -g "*.(#i)gif(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; ppm2tiff) _arguments -C \ - '-r[specify rows per strip]:rows per strip' \ - '-c[specify compression scheme]:compression scheme:->compress' \ - '-R[specify resolution]:resolution:' \ + '-r+[specify rows per strip]:rows per strip' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ + '-R+[specify resolution]:resolution (dots/inch)' \ ':input GIF file:_files -g "*.(#i)ppm(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; ras2tiff) _arguments -C \ - '-r[specify rows per strip]:rows per strip' \ - '-c[specify compression scheme]:compression scheme:->compress' \ + '-r+[specify rows per strip]:rows per strip' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ ':input raster image file:_files -g "*.(#i)ras(|t)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; pal2rgb) _arguments -C \ - '-C[specify number of bits for colormap entries]:bits for colormap entries:(8 16)' \ - '-p[set sample packing]:sample packing:(contig separate)' \ - '-c[specify compression scheme]:compression scheme:->compress' \ - '-r[specify rows per strip]:rows per strip' \ + '-C+[specify number of bits for colormap entries]:bits for colormap entries:(8 16)' \ + '-p+[set sample packing]:sample packing:(contig separate)' \ + '-c+[specify compression scheme]:compression scheme:->compress' \ + '-r+[specify rows per strip]:rows per strip' \ ':input file:_files -g "*.(#i)tif(|f)(-.)"' \ ':output file:_files -g "*.(#i)tif(|f)(-.)"' && ret=0 ;; @@ -179,7 +240,7 @@ if [[ -n "$state" ]]; then case "$scheme" in g3) - _values -s : 'FAX Group 3 options' \ + _values -s : 'FAX Group 3 option' \ '(2d)1d[use 1D-encoding]' \ '(1d)2d[use 2D-encoding]' \ 'fill[byte-align EOL codes]' && ret=0 @@ -188,8 +249,8 @@ if [[ -n "$state" ]]; then _message -e values "compression quality (0-100), or \`r' (output RGB)" ret=0 ;; - lzw|zip) - _values 'LZW and deflate options' \ + lzw|lzma|zip) + _values 'LZW and deflate option' \ '1[without differencing]' \ '2[with differencing]' && ret=0 ;; @@ -198,8 +259,8 @@ if [[ -n "$state" ]]; then _tags values while _tags; do while _next_label values expl 'compression scheme'; do - compadd "$expl[@]" - none g4 packbits && ret=0 - compadd "$expl[@]" -qS: - lzw zip jpeg g3 && ret=0 + compadd "$expl[@]" - none jbig g4 packbits sgilog && ret=0 + compadd "$expl[@]" -qS: - lzw zip lzma jpeg g3 && ret=0 done (( ret )) || return 0 done -- cgit v1.2.3 From ad9b140213e9a7f02b227ec2d7ec9735cfc57fa6 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sun, 29 Apr 2018 23:29:16 +0200 Subject: 42676: deal with system specific arguments in dd completion --- ChangeLog | 5 +- Completion/Unix/Command/_dd | 112 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 101 insertions(+), 16 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 36ca4faf5..315a673fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,11 +1,14 @@ 2018-04-29 Oliver Kiddle + * 42676: Completion/Unix/Command/_dd: deal with system + specific arguments + * 42728: Completion/Unix/Command/_tiff: update options and add handling for tiff2pdf 2018-04-29 Barton E. Schaefer - * Ricardo Giorni: 47201: fix 42355 for multiple backslashes + * Ricardo Giorni: 42701: fix 42355 for multiple backslashes 2018-04-26 Peter Stephenson diff --git a/Completion/Unix/Command/_dd b/Completion/Unix/Command/_dd index e51337f21..e5c5e63ce 100644 --- a/Completion/Unix/Command/_dd +++ b/Completion/Unix/Command/_dd @@ -1,17 +1,99 @@ #compdef dd gdd -_values -w 'option' \ - 'if[specify input file]:input file:_tilde_files' \ - 'of[specify output file]:output file:_tilde_files' \ - '(bs)ibs[input block size]:block size (bytes)' \ - '(bs)obs[output block size]:block size (bytes)' \ - '(ibs obs)bs[block size]:block size (bytes)' \ - 'cbs[conversion buffer size]:buffer size (bytes)' \ - 'skip[input blocks initially skipped]:blocks' \ - 'seek[output blocks initially skipped]:blocks' \ - 'files[specify number of input files to copy and concatenate]:number of files' \ - 'count[number of input blocks to copy]:blocks' \ - 'conv[specify conversions to apply]:conversion:_values -s , conversion - "(ebcdic ibm)ascii" "(ascii ibm)ebcdic" "(ascii ebcdic)ibm" - "(unblock)block" "(block)unblock" - "(ucase)lcase" "(lcase)ucase" swab noerror sync' +local -a vals conv flags +local variant + +_pick_variant -r variant gnu=GNU $OSTYPE --version + +vals=( + '(ibs obs)bs[block size]:block size (bytes)' + 'cbs[conversion buffer size]:buffer size (bytes)' + 'conv[specify conversions to apply]: :_values -s , conversion $conv' + 'count[number of input blocks to copy]:blocks' + '(bs)ibs[input block size]:block size (bytes)' + 'if[specify input file]:input file:_tilde_files' + '(bs)obs[output block size]:block size (bytes)' + 'of[specify output file]:output file:_tilde_files' + 'seek[output blocks initially skipped]:blocks' + 'skip[input blocks initially skipped]:blocks' +) +conv=( + '(ascii asciib oldascii ebcdic ebcdicb oldebcdic ibm ibmb oldibm)'{ascii,ebcdic,ibm} + '(unblock)block' '(block)unblock' + '(ucase)lcase' '(lcase)ucase' + swab sync noerror notrunc +) + +case $variant in + ^gnu) + vals+=( + 'files[specify number of input files to copy and concatenate]:number of files' + ) + ;| + (gnu|darwin|dragonfly|(free|net)bsd*) + conv+=( sparse ) + ;| + gnu|netbsd*) + vals+=( + '*iflag[specify read flags]:flag:_sequence compadd - $flags' + '*oflag[specify write flags]:flag:_sequence compadd - $flags' + ) + flags=( append direct directory dsync sync nonblock noctty nofollow ) + ;| + darwin*|dragonfly*|(free|net)bsd*) + vals+=( + 'oseek[output blocks initially skipped]:blocks' + ) + conv+=( + '(ascii oldascii ebcdic oldebcdic oldibm)'old{ascii,ebcdic,ibm} + ) + ;| + (darwin|dragonfly|freebsd|netbsd|solaris)*) + vals+=( + 'iseek[input blocks initially skipped]:blocks' + ) + ;| + (open|free)bsd*) + vals+=( + 'status[specify level of information to print to stderr]:level:(none noxfer)' + ) + conv+=( osync ) + ;| + + freebsd*) + vals+=( + 'fillchar[specify padding character]:character' + 'speed[limit copying speed]:speed (bytes/second)' + ) + conv+=( + '(pareven parnone parodd parset)'{pareven,parnone,parodd,parset} + ) + ;; + gnu) + vals+=( + 'status[specify level of information to print to stderr]:level:(none noxfer progress)' + ) + flags+=( fullblock noatime nocache count_bytes skip_bytes seek_bytes ) + conv+=( excl nocreat fdatasync fsync ) + ;; + netbsd*) + vals+=( + 'msgfmt[specify format for information summary]:format:(quiet posix human)' + 'progress[enable progress display]:enable:(1)' + ) + flags+=( + wronly rdwr creat trunc excl shlock exlock cloexec nosigpipe rsync alt_io async + ) + ;; + solaris*) + vals+=( + 'files[specify number of input files to copy and concatenate]:number of files' + 'oseek[output blocks initially skipped (via seek, not NUL-padding)]:blocks' + ) + conv+=( + '(ascii asciib ebcdic ebcdicb ibmb)'{ascii,ebcdic,ibm}b + ) + ;; +esac + +_values -w 'option' $vals -- cgit v1.2.3 From 17af784c5dd5f3035574e1ecf99346e8ce16d358 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 27 Apr 2018 23:30:05 -0500 Subject: 42729: update df completion for [DFNO]BSD --- ChangeLog | 3 +++ Completion/Unix/Command/_df | 57 ++++++++++++++++++++++++++++++++++----------- 2 files changed, 47 insertions(+), 13 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 315a673fe..593011fe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-04-29 Oliver Kiddle + * Matthew Martin: 42729: Completion/Unix/Command/_df: + update df completion for [DFNO]BSD + * 42676: Completion/Unix/Command/_dd: deal with system specific arguments diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index 2586f4358..a31145cd4 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -28,32 +28,63 @@ if _pick_variant gnu=GNU unix --version; then {-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 +elif [[ "$OSTYPE" == (darwin|dragonfly|freebsd|netbsd*|openbsd)* ]]; then args=( - '(-b -g -H -h -k -m)-b[use 512-byte blocks (default)]' - '(-b -g -H -h -k -m)-g[use 1024^3-byte blocks]' - '(-b -g -H -h -k -m)-H[human-readable output (base 10)]' - '(-b -g -H -h -k -m)-h[human-readable output (base 2)]' - '(-b -g -H -h -k -m)-k[use 1024-byte blocks]' - '(-b -g -H -h -k -m)-m[use 1024*1024-byte blocks]' - '-P[POSIX compliant output]' - '-a[show all mount points]' - '-c[display a grand total]' - '-i[include inode usage statistics (default)]' + '(-b -g -H -h -k -m --si)-h[human-readable output (base 2)]' + '(-b -g -H -h -k -m --si)-k[use 1024-byte blocks]' + '(-G -i -P)-P[POSIX compliant output]' + '(-G -i -P)-i[include inode usage statistics (default)]' '-l[only display locally-mounted file systems]' '-n[use previously obtained statistics]' '*:files:_umountable' ) spec='[only display file systems of specified types]:file system type:->fslist' case "$OSTYPE" in + (darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '-a[show all mount points]' + '(-b -g -H -h -k -m --si)-g[use 1024^3-byte blocks]' + '(-b -g -H -h -k -m --si)-m[use 1024*1024-byte blocks]' + ) + ;| + (darwin*|dragonfly*|freebsd*) + args+=( + '(-b -g -H -h -k -m --si)-b[use 512-byte blocks (default)]' + '(-b -g -H -h -k -m --si)-H[human-readable output (base 10)]' + ) + ;| + (darwin*|freebsd*) + args+=( + '-c[display a grand total]' + ) + ;| (darwin*) args+=( "-T+$spec" "!-t+$spec" # obsolete ) ;; - (freebsd*|dragonfly*) - args+=( "-t+$spec" '-T[include file system type]' ) + (dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + "-t+$spec" + ) + ;| + (dragonfly*|freebsd*) + args+=( + '-T[include file system type]' + ) + ;| + (freebsd*) + args+=( + '--libxo[generate output via libxo]' + '(-b -g -H -h -k -m --si)--si[human-readable output (base 10)]' + '-,[separate thousands]' + ) + ;; + (netbsd*) + args+=( + '(-G -i -P)-G[display all fields in statvfs]' + ) ;; esac else -- cgit v1.2.3 From 11dbc95962897ba5aff905cda2d55d064f52e3a9 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Sat, 28 Apr 2018 00:01:13 -0500 Subject: 42730: Complete the options for rmdir --- ChangeLog | 3 +++ Completion/Unix/Command/_rmdir | 23 +++++++++++++++++++++++ Completion/Unix/Type/_directories | 2 +- 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_rmdir (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 593011fe3..f93d3d654 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-04-29 Oliver Kiddle + * Matthew Martin: 42730: Completion/Unix/Command/_rmdir, + Completion/Unix/Type/_directories: Complete the options for rmdir + * Matthew Martin: 42729: Completion/Unix/Command/_df: update df completion for [DFNO]BSD diff --git a/Completion/Unix/Command/_rmdir b/Completion/Unix/Command/_rmdir new file mode 100644 index 000000000..0f5e16912 --- /dev/null +++ b/Completion/Unix/Command/_rmdir @@ -0,0 +1,23 @@ +#compdef rmdir grmdir + +local -a args + +args=( + '(-p --parents)'{-p,--parents}'[remove each component of the specified paths]' +) + +if _pick_variant gnu=GNU unix --version; then + args+=( + '--ignore-fail-on-non-empty[ignore failure if directory is non-empty]' + '(-v --verbose)'{-v,--verbose}'[be verbose]' + ) +else + args=(${args:#*\)--*}) + if [[ $OSTYPE == (dragonfly|freebsd)* ]]; then + args+=('-v[be verbose]') + fi +fi + +_arguments -s -S -A '-*' \ + $args \ + '*:directories:_directories' diff --git a/Completion/Unix/Type/_directories b/Completion/Unix/Type/_directories index 456af3b6c..438181eec 100644 --- a/Completion/Unix/Type/_directories +++ b/Completion/Unix/Type/_directories @@ -1,4 +1,4 @@ -#compdef rmdir grmdir zf_rmdir dircmp -P -value-,*path,-default- +#compdef zf_rmdir dircmp -P -value-,*path,-default- local expl -- cgit v1.2.3 From 64b60f69266f6df9084898741617a48ad3b98d25 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 2 May 2018 08:59:23 +0200 Subject: 42743: update vorbis-tools completion and include vorbiscomment with the rest --- ChangeLog | 5 + Completion/Unix/Command/_vorbis | 166 ++++++++++++++++++++++----------- Completion/Unix/Command/_vorbiscomment | 18 ---- 3 files changed, 117 insertions(+), 72 deletions(-) delete mode 100644 Completion/Unix/Command/_vorbiscomment (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 8cbcc80bc..5a0de7bb4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-05-02 Oliver Kiddle + + * 42743: Completion/Unix/Command/_vorbis: update vorbis-tools + completion and include vorbiscomment with the rest + 2018-05-01 Peter Stephenson * from branch fork_early, c.f. 42702: Src/exec.c: Various changes diff --git a/Completion/Unix/Command/_vorbis b/Completion/Unix/Command/_vorbis index cb3e3f9d8..6c94469f9 100644 --- a/Completion/Unix/Command/_vorbis +++ b/Completion/Unix/Command/_vorbis @@ -1,90 +1,148 @@ -#compdef oggenc ogg123 ogginfo oggdec +#compdef oggenc ogg123 ogginfo oggdec vorbiscomment -local expl ret=1 +local curcontext="$curcontext" ret=1 +local -a alts expl state line suf case $service in oggenc) - _arguments -s \ - '(- *)'{-h,--help}'[show help]' \ - '(- *)'{-v,--version}'[display version information]' \ + _arguments -C -s -S \ + '(-Q --quiet)'{-Q,--quiet}'[produce no output to stderr]' \ + '(- *)'{-h,--help}'[display usage information]' \ + '(- *)'{-V,--version}'[display version information]' \ + '(-k --skeleton)'{-k,--skeleton}'[add an Ogg Skeleton bitstream]' \ '(-r --raw)'{-r,--raw}'[assume input data is raw, little-endian with no header information]' \ - '(-B --raw-bits)'{-B+,--raw-bits=}'[set raw mode input sample size in bits]:sample size:(8 16)' \ - '(-C --raw-chan)'{-C+,--raw-chan=}'[set raw mode input number of channels]:number of channels' \ - '(-R --raw-rate)'{-R+,--raw-rate=}'[set raw mode input sample rate]:sample rate:(44100 48000)' \ - '--raw-endianness[set raw mode endianness]:endianness:((0\:big\ endian 1\:little\ endian))' \ - '(-Q --quiet)'{-Q,--quiet}'[quiet mode]' \ + '(-B --raw-bits)'{-B+,--raw-bits=}'[set raw mode input sample size in bits]:sample size [16]:(8 16)' \ + '(-C --raw-chan)'{-C+,--raw-chan=}'[set raw mode input number of channels]:number of channels [2]' \ + '(-R --raw-rate)'{-R+,--raw-rate=}'[set raw mode input sample rate]:sample rate [44100]:(44100 48000)' \ + '--raw-endianness=[set raw mode endianness]:endianness [0]:((0\:big\ endian 1\:little\ endian))' \ '(-b --bitrate)'{-b+,--bitrate=}'[set encoding to the bitrate closest to that specified]:bitrate (kb/s)' \ + '--managed[enable the bitrate management engine]' \ '(-m --min-bitrate)'{-m+,--min-bitrate=}'[set minimum bitrate]:bitrate (kb/s)' \ '(-M --max-bitrate)'{-M+,--max-bitrate=}'[set maximum bitrate]:bitrate (kb/s)' \ - '--managed[turn off the normal VBR encoding]' \ + '*--advanced-encode-option=:option name:_values option + "lowpass_frequency[set the lowpass frequency]\:frequency (kHz)" + "impulse_noisetune[set a noise floor bias]\:bias (-15..0)" + "bitrate_hard_max[set the allowed bitrate maximum for the encoded file]\:bitrate (kb/s)" + "bitrate_hard_min[set the allowed bitrate minimum for the encoded file]\:bitrate (kb/s)" + "bit_reservoir_bits[set the total size of the bit reservoir]\:bits" + "bit_reservoir_bias[set the behavior bias of the bit reservoir]\:bias (0..1)" + "bitrate_average[set the average bitrate for the file]\:bitrate (kb/s)" + "bitrate_average_damping[set the reaction time for the average bitrate tracker]\:time (seconds)" + "disable_coupling[disable use of channel coupling for multichannel encoding]"' \ '(-q --quality)'{-q+,--quality=}'[set encoding quality]:quality:(0 1 2 3 4 5 6 7 8 9 10)' \ - '--resample[resample input to the given sample rate before encoding]:sample rate (Hz)' \ + '--resample=[resample input to the given sample rate before encoding]:sample rate (Hz)' \ '--downmix[down mix input from stereo to mono]' \ - '--advanced-encode-option:option name:_values option "bitrate_average_window[set the managed bitrate window]\:number (seconds)" "lowpass_frequency[set the lowpass frequency]\:frequency (kHz)"' \ - '(-s --serial)'{-s+,--serial=}'[force a specific serial number in the output stream]' \ + '--scale=[set input scaling factor]:scaling factor' \ + '(-s --serial)'{-s+,--serial=}'[force a specific serial number in the output stream]:serial number' \ "--discard-comments[don't copy comments from FLAC file to output Ogg Vorbis file]" \ + '--ignorelength[ignore the datalength in Wave headers]' \ '(-o --output)'{-o+,--output=}'[write the Ogg Vorbis stream to output_file]:files:->oggfiles' \ '(-n --names)'{-n+,--names=}'[specify pattern for producing filenames]:string' \ '(-X --name-remove)'{-X+,--name-remove=}'[remove specified characters from output filenames]:characters' \ '(-P --name-replace)'{-P+,--name-replace=}'[specify replacement characters for those removed]:characters' \ - '(-c --comment)'{-c+,--comment}'[add the string comment as an extra comment]:comment' \ - '(-a --artist)'{-a+,--artist}'[set the artist comment field in the comments to artist]:artist' \ - '(-G --genre)'{-G+,--genre}'[set the genre comment field in the comments to genre]:genre' \ - '(-d --date)'{-d+,--date}'[set the date comment field to the given value]:date' \ - '(-N --tracknum)'{-N+,--tracknum}'[set the track number comment field to the given value]:track number' \ - '(-t --title)'{-t+,--title}'[set the track title comment field to title]:title' \ - '(-l --album)'{-l+,--album}'[set the album comment field to album]' \ + '--utf8[interpret command-line parameters as already being UTF-8 encoded]' \ + \*{-c+,--comment=}'[add the string comment as an extra comment]:comment' \ + \*{-d+,--date=}'[set the date comment field to the given value]:date' \ + \*{-N+,--tracknum=}'[set the track number comment field to the given value]:track number' \ + \*{-t+,--title=}'[set the track title comment field to title]:title' \ + \*{-l+,--album=}'[set the album comment field to album]:album' \ + \*{-a+,--artist=}'[set the artist comment field in the comments to artist]:artist' \ + \*{-G+,--genre=}'[set the genre comment field in the comments to genre]:genre' \ + \*{-L+,--lyrics=}'[include lyrics from specified file]:lyrics file:_files -g "*.(srt|lrc)(-.)"' \ + \*{-Y+,--lyrics-language=}'[specify language for the lyrics]:language' \ '*:input file:_files -g "(#i)*.(flac|wav|aiff)(-.)"' && ret=0 ;; ogg123) - _arguments -C -s \ - '(- *)'{-h,--help}'[show help]' \ - '(- *)'{-V,--version}'[display version information]' \ - \*{-d+,--device}'[output device]:device:((null\:discard\ all\ data oss\:open\ sound\ system sun\:sun\ audio alsa\:advanced\ linux\ sound\ architecture irix\:IRIX\ audio arts\:aRts\ sound\ daemon esd\:enlightened\ sound\ daemon au\:sun\ audio\ file raw\:raw\ sample wav\:wav\ file))' \ + _arguments -C -s -S \ + \*{-d+,--device=}'[output device]:device:(aixs alsa arts au esd irix macosx nas null oss pulse raw roar sndio sun wav wmm)' \ \*{-f+,--files=}'[output filename for a previously specified file device]:output filename:_files -g "(#i)*.(wav|au|raw)(-.)"' \ - '(-k --skip)'{-k+,--skip}"[skip the first 'n' seconds (or to hh:mm:ss)]:seconds" \ - '(-K --end)'{-K+,--end}"[end at 'n' seconds (or hh:mm:ss)]:seconds" \ - '(-b --buffer)'{-b+,--buffer}'[size of input buffer]:kilobytes' \ - '(-p --prebuffer)'{-p+,--prebuffer}'[prebuffer percentage]:percent' \ - '(-q --quiet)*'{-v,--verbose}'[increase verbosity]' \ - '(-q --quiet -v --verbose)'{--quiet,-q}'[quiet mode]' \ - '(-x --nth)'{-x+,--nth}'[block decode intervall]:number' \ - '(-y --ntimes)'{-y+,--ntimes}'[block repeat count]:number' \ - '(-z --shuffle)'{-z,--shuffle}'[shuffle play]' \ - '(-l --delay)'{-l+,--delay=}'[set delay between two SIGINTs to quit]:delay (ms)' \ - '(-@ --list)'{-@+,--list}'[play all of the files from a playlist]:playlist:_files' \ - '--audio-buffer=[size of output audio buffer]:kilobytes' \ + '--audio-buffer=[specify size of output audio buffer]:size (kilobytes)' \ \*{-o,--device-option=}'[assign device option values]:device option:->devopts' \ - '*:sound file or directory:_files -g "(#i)*.(ogg|flac|spx)"' && ret=0 + '(-@ --list)'{-@+,--list=}'[play all of the files from a playlist]:playlist:_files' \ + '(-r --repeat)'{-r,--repeat}'[repeat playlist indefinitely]' \ + '(-R --remote)'{-R,--remote}'[use remote control interface]' \ + '(-z --shuffle -Z --random)'{-z,--shuffle}'[shuffle list of files before playing]' \ + '(-Z --random -z --shuffle -r --repeat)'{-Z,--random}'[play files randomly until interrupted]' \ + '(-b --buffer)'{-b+,--buffer=}'[specify size of input buffer (HTTP only)]:size (kilobytes)' \ + '(-p --prebuffer)'{-p+,--prebuffer=}'[delay playback until proportion of buffer filled (HTTP only)]:percent' \ + '(-k --skip)'{-k+,--skip=}"[skip up to specified time]:start time ([[hh\:]mm\:]ss[.d])" \ + '(-K --end)'{-K+,--end=}"[end after specified time]:end time ([[hh\:]mm\:]ss[.d])" \ + '(-x --nth)'{-x+,--nth=}"[play every 'n'th block]:number"\ + '(-y --ntimes)'{-y+,--ntimes=}"[repeat every 'n'th block]:number" \ + '(-l --delay)'{-l+,--delay=}'[set delay between two SIGINTs to quit]:delay (ms)' \ + '(- *)'{-h,--help}'[display usage information]' \ + '(-q --quiet -v --verbose)'{--quiet,-q}'[quiet mode]' \ + '(-q --quiet)*'{-v,--verbose}'[increase verbosity]' \ + '(- *)'{-V,--version}'[display version information]' \ + \*{-c-,--config=-}'[specify config options]: :_values option + "default_device\:device" + "shuffle\:value\:(0 1)" + "repeat\:value\:(0 1)"' \ + '*:sound file or directory:->urls-or-files' && ret=0 ;; ogginfo) - _arguments \ - '(- *)-h[show a help and usage message]' \ + _arguments -S \ + '(- *)-h[display usage information]' \ + '(- *)-V[display version information]' \ '(-)*-q[quiet mode]' \ '(-)-v[verbose mode]' \ - '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0 + '(-h)*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0 ;; oggdec) - _arguments -s \ + _arguments -s -S \ '(-Q --quiet)'{-Q,--quiet}'[quiet mode]' \ - '(- *)'{-h,--help}'[print help information]' \ - '(- *)'{-v,--version}'[display version information]' \ + '(- *)'{-h,--help}'[display usage information]' \ + '(- *)'{-V,--version}'[display version information]' \ '(-b --bits)'{-b+,--bits=}'[bits per sample]:bits per sample:(8 16)' \ - '(-e --endian)'{-e+,--endian=}'[set endianness for 16-bit output]:endianness:((0\:\(default\)\ little-endian\ \(Intel\ byte\ order\) 1\:big-endian\ \(sane\ byte\ order\)))' \ - '(-R --raw)'{-R+,--raw=}'[output in raw format]' \ + '(-e --endianness)'{-e+,--endianness=}'[set endianness for 16-bit output]:endianness [0]:((0\:little-endian\ \(Intel\ byte\ order\) 1\:big-endian\ \(sane\ byte\ order\)))' \ + '(-s --sign)'{-s+,--sign=}'[set signedness for output]:signedness [1]:((0\:unsigned 1\:signed))' \ + '(-R --raw)'{-R,--raw}'[output in raw format]' \ '(-o --output)'{-o+,--output=}'[write output to specified filename]:output filename:_files' \ - '(-s --sign)'{-s+,--sign=}'[set signedness for output]:signedness:((0\:unsigned 1\:signed\ \(default\)))' \ '*:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' && ret=0 ;; + vorbiscomment) + _arguments -s -S \ + '(-l --list)*'{-t+,--tag=}'[specify a comment tag on the commandline]:tag=value' \ + '(-c --commentfile)'{-c+,--commentfile=}'[specify comment file]:file:_files' \ + '(-R --raw)'{-R,--raw}'[read and write comments in UTF-8]' \ + '(-e --escapes)'{-e,--escapes}'[use \\n-style escapes to allow multiline comments]' \ + '1:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' \ + '(-l --list)2:ogg vorbis file:_files -g "(#i)*.ogg(-.)"' \ + + '(actions)' \ + '(2 -t --tag)'{-l,--list}'[list the comments (default)]' \ + {-a,--append}'[append comments]' \ + {-w,--write}'[write comments, replacing the existing ones]' \ + '(-)'{-h,--help}'[display usage information]' \ + '(-)'{-V,--version}'[display version information]' && ret=0 + ;; esac -if [[ $state = devopts ]]; then - if compset -P '*:'; then - _message -e value value - else - _wanted devopts expl 'device option' \ - compadd -S : - dsp dev card buf_size host byteorder && return - fi +if [[ -n $state ]]; then + case $state in + urls-or-files) + if [[ -prefix 1 (f|ht)tp(|s):// ]]; then + alts=( 'urls:URL of sound file:_urls -f -g "*.(#i)(ogg|flax|spx)(-.)"' ) + else + alts=( 'urls:URL of sound file:compadd -S "" ftp:// http:// https://' ) + fi + _alternative \ + 'files:sound file or directory:_files -g "(#i)*.(ogg|flac|spx)"' \ + $alts && ret=0 + ;; + devopts) + if compset -P 1 '*:'; then + _message -e value value + else + _description device-options expl 'device option' + if ! compset -S ':*'; then + compadd "$expl[@]" - debug verbose quiet && ret=0 + suf=( -qS : ) + fi + compadd $suf "$expl[@]" - matrix dev buffer_time period_time use_mmap \ + multi host buf_size dsp server sink byteorder id && ret=0 + fi + ;; + esac fi return ret diff --git a/Completion/Unix/Command/_vorbiscomment b/Completion/Unix/Command/_vorbiscomment deleted file mode 100644 index bd7459e04..000000000 --- a/Completion/Unix/Command/_vorbiscomment +++ /dev/null @@ -1,18 +0,0 @@ -#compdef vorbiscomment - -#Written by Jesse Weinstein , Wed Jul 19 15:31:11 2006 -#Version 0.9 - could handle -t option slightly better -#Released under the MIT license (or any compatible free-content license) -#i.e. do whatever you like with it, but credit me. - -_arguments \ - '-h[help]' \ - '-q[quiet]' \ - '(-a -w -q -c -t 2)-l[list comments]' \ - '(-l)-a[append comments]' \ - '(-l)-w[overwrite comments]' \ - '(-l -c)-t[tag and value]:: ' \ - '(-l -t)-c[tag file]::_files' \ - '1:OGG file:_files -g "*.ogg(-.)"' \ - '(-l)2:output OGG file:_files -g "*.ogg(-.)"' \ - && return 0 -- cgit v1.2.3 From 2d8574ef7d67b0e03b0f66d5e0245289951fbfa9 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 30 Apr 2018 08:54:37 +0000 Subject: 42732: Add several more entries to ifconfig --- ChangeLog | 3 +++ Completion/Unix/Command/_ifconfig | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 5a0de7bb4..0aec0fcaf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-05-02 Oliver Kiddle + * Eitan Adler: 42732: Completion/Unix/Command/_ifconfig: + Add several more entries to ifconfig + * 42743: Completion/Unix/Command/_vorbis: update vorbis-tools completion and include vorbiscomment with the rest diff --git a/Completion/Unix/Command/_ifconfig b/Completion/Unix/Command/_ifconfig index 0c81bce10..c5b5af8d4 100644 --- a/Completion/Unix/Command/_ifconfig +++ b/Completion/Unix/Command/_ifconfig @@ -25,11 +25,16 @@ case $OSTYPE in '(-l -C)-m[list supported media]' '(-l -C)-L[show address lifetime as time offset]' ) - opts=( $alias $debug + listopts=( + active caps chan countries mac mesh regdomain roam txparam txpower + scan sta wme + ) + opts=( $alias $debug $listopts anycast lladdr media {,-}mediaopt {,delete}tunnel create destroy {,un}plumb vlan {,-}vlandev metric prefixlen range phase ssid muid stationname channel authmode {,-}powersave powersavesleep wepmode - {,-}wep {,-}nwkey add delete ether {,-}link{0,1,2} + {,-}wep {,-}nwkey add delete ether {,-}link{0,1,2} list wme wmm + roam roam:rssi roam:rate roaming ) ;; irix5*) opts=( $debug ) ;; -- cgit v1.2.3 From fa441fa20e6d7d93e613f339d0c67ba8b0ab09c4 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 8 May 2018 17:13:12 +0100 Subject: 42752: enhance git external alias completion If alias expands to !cmd-name, complete as a normal command line after cmd-name. --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 7449386e1..325638c30 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-05-08 Peter Stephenson + * 42752: Completion/Unx/Command/_git: better completion + handling for git aliases expanding to external command. + * 42751: Src/Zle/zle_main.c: Protect shell status around time function execution in line editor. diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index f6cec8b60..21ba65724 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -7758,7 +7758,10 @@ _git() { curcontext=${curcontext%:*:*}:git-$words[1]: (( $+opt_args[--git-dir] )) && local -x GIT_DIR=$opt_args[--git-dir] if ! _call_function ret _git-$words[1]; then - if zstyle -T :completion:$curcontext: use-fallback; then + if [[ $words[1] = \!* ]]; then + words[1]=${words[1]##\!} + _normal && ret=0 + elif zstyle -T :completion:$curcontext: use-fallback; then _default && ret=0 else _message "unknown sub-command: $words[1]" -- cgit v1.2.3 From 25f6f5eebee3aa43c2da1c581414766aee08d3d8 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 19 May 2018 11:04:18 +0200 Subject: 42803: handle Linux and the the BSDs in netstat completion --- ChangeLog | 5 + Completion/Solaris/Command/_netstat | 61 ------- Completion/Unix/Command/_netstat | 337 ++++++++++++++++++++++++++++++++++++ 3 files changed, 342 insertions(+), 61 deletions(-) delete mode 100644 Completion/Solaris/Command/_netstat create mode 100644 Completion/Unix/Command/_netstat (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index ac2acf349..8597c8ea2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-05-19 Oliver Kiddle + + * 42803: Completion/Unix/Command/_netstat: handle Linux and + the the BSDs in netstat completion + 2018-05-17 Oliver Kiddle * Stephane: 42790: Doc/Zsh/expn.yo, NEWS, Src/pattern.c, diff --git a/Completion/Solaris/Command/_netstat b/Completion/Solaris/Command/_netstat deleted file mode 100644 index bf8e5aaa4..000000000 --- a/Completion/Solaris/Command/_netstat +++ /dev/null @@ -1,61 +0,0 @@ -#compdef netstat - -_netstat() { - local -a f_rules - - f_rules=( - 'af\::specify address family: inet, inet6, unix, number' - 'outif\::specify output interface: ifName, ifIndex, any, none' - 'dst\::specify destination IP: ip-addr[/mask], any, none' - 'flags\::select routes tagged with flags: [+ -]?[ABDGHLMSU]+' - ) - - _arguments \ - - set1 \ - '-a[show state of all sockets, all routing tables or all interfaces]' \ - '-R[show extended security attributes for sockets and routing tables]' \ - '-n[do not resolve addresses to names]' \ - '-v[verbose]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' \ - - set2 \ - '-r[show routing table]' \ - '-f[filter routing table]:rule:(($f_rules))' \ - '-a[show state of all sockets, all routing tables or all interfaces]' \ - '-v[verbose]' \ - '-n[do not resolve addresses to names]' \ - '-R[show extended security attributes for sockets and routing tables]' \ - - set3 \ - '-g[show multicast group memberships]' \ - '-n[do not resolve addresses to names]' \ - '-v[verbose]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - - set4 \ - '-i[show state of interfaces]' \ - '-a[show state of all sockets, all routing tables or all interfaces]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - '-n[do not resolve addresses to names]' \ - '-I[select interface]:interface:_net_interfaces' \ - - set5 \ - '-m[show STREAMS memory statistics]' \ - '-v[verbose]' \ - - set6 \ - '-p[show net to media tables]' \ - '-n[do not resolve addresses to names]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - - set7 \ - '-s[show per protocol statistics]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' \ - - set8 \ - '-M[show multicast routing tables]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - '-n[do not resolve addresses to names]' \ - '-s[show per protocol statistics]' \ - - set9 \ - '-D[show status of DHCP configured interfaces]' \ - '-f[specify address family]:address family:(inet inet6 unix)' \ - '-I[select interface]:interface:_net_interfaces' \ -} - -_netstat "$@" diff --git a/Completion/Unix/Command/_netstat b/Completion/Unix/Command/_netstat new file mode 100644 index 000000000..c03aae9a2 --- /dev/null +++ b/Completion/Unix/Command/_netstat @@ -0,0 +1,337 @@ +#compdef netstat + +local Wopt Xopt nopt="[don't resolve addresses to names]" +local lopt='[show only listening sockets]' +local zopt='-z[reset statistic counters after displaying them]' +local popt='(-f)-p+[filter by protocol]:protocol:compadd -a plist' +local Iopt='(-i)-I+[show information about the specified interface]:interface:_net_interfaces' +local set sel +local -A sets +local -a Mopts families flist plist args sockets extend interval verbose +local -a {sel_,}{bpf,dhcp,groups,interfaces,masquerade,media,memory,multicast,pcb,queues,routing,statistics,wireless} + +case $OSTYPE in + linux-gnu) + families=( + '(-4 --inet)'{-4,--inet} + '(-6 --inet)'{-4,--inet6} + '(-A --protocol)'{-A+,--protocol=}':protocol:_sequence compadd - inet inet6 unix ipx ax25 netrom ddp bluetooth' + --unix -x --ip --tcpip --ax25 --x25 --rose --ash + --bluetooth --ipx --netrom --ddp --appletalk --econet --ec + ) + extend=( \*{-e,--extend}'[show additional information]' ) + verbose=( '(-v --verbose)'{-v,--verbose}'[show what is going on]' ) + args=( + '(-c --continuous)'{-c,--continuous}'[repeat information every second]' + '!(-n --numeric)'{-N,--symbolic} + '(-n --numeric)'{-n,--numeric}"$nopt" + --numeric-hosts --numeric-ports --numeric-users + '1: :_guard "[0-9]#" "repeat interval (seconds)"' + - '(help)' + '(- 1)'{-h,--help}'[display usage information]' + '(- 1)'{-V,--version}'[display version information]' + ) + sets=( + routing '(--route|-[^-]#r*)' + groups '(--groups|-[^-]#g*)' + interfaces '(--interfaces|-[^-]#[iI]*)' + statistics '(--statistics|-[^-]#s*)' + masquerade '(--masquerade|-[^-]#M*)' + ) + + sel_routing=( '(-r --route)'{-r,--route}'[display routing table]' ) + sel_interfaces=( + '(-I --interfaces)-i[display interface table]' + '(-i -I --interfaces)'{--interface=-,-I=-}'[display interface table]::interface:_net_interfaces' + ) + sel_groups=( '(-g --groups)'{-g,--groups}'[display multicast group memberships]' ) + sel_masquerade=( '(-M --masquerade)'{-M,--masquerade}'[display masqueraded connections]' ) + [[ -e /proc/net/ip_masquerade ]] || sel_masquerade=( \!${^sel_masquerade} ) + sel_statistics=( '(-s --statistics -c --continuous -n --numeric --numeric-hosts --numeric-ports --numeric-users)'{-s,--statistics}'[display networking statistics]' ) + + sockets=( + $families $verbose + --tcp -t --udp -u --udplite -U --sctp -S --raw -w + '(-2 --l2cap)'{-2,--l2cap} + '(-f --rfcomm)'{-f,--rfcomm} + '(-a --all -l --listening)'{-l,--listening}$lopt + '(-a --all -l --listening)'{-a,--all}'[show all sockets]' + --symbolic -N --extend -e + '(--timers -o)'{--timers,-o}'[show information on networking timers]' + '(--program -p)'{--program,-p}'[show process id and program name for sockets]' + '(--wide -W)'{--wide,-W}"[don't truncate IP addresses in output]" + '(-Z --context)'{-Z,--context}'[display SELinux security context for sockets]' + ) + routing=( + $families $extend $verbose + '-C[display routing cache instead of FIB]' + ) + interfaces=( + $extend $verbose + '(-a --all)'{-a,--all}'[show interfaces that are not up]' + ) + groups=() + masquerade=( $extend ) + statistics=( $families ) + ;; + solaris*|darwin*|dragonfly*|freebsd*) + families=( '(-p -4 -6)-f+[specify address family]:address family:compadd -a flist' ) + ;| + freebsd*) + families+=( + '(-6 -f)-4[show IPv4 only]' + '(-4 -f)-6[show IPv6 only]' + ) + ;| + (open|net)bsd*) + popt='(-f)-p+[filter by protocol]:protocol:compadd - ${(M)${(f)"$() + args=( '-T+[specify time format]:time format:((u\:seconds\ since\ epoch d\:standard\ date\ format))' ) + sockets=( '-u[list user, pid and program that created network endpoint]' ) + ;& + solaris*) + args=( -A '-*' $args ) + interval=( + '1: :_guard "[0-9]#" "repeat interval (seconds)"' + '2: :_guard "[0-9]#" "count"' + ) + sets+=( + dhcp '-[^-]#D*' + media '-[^-]#p*' + multicast '-[^-]#M*' + ) + sel_media=( '-p[display net to media tables]' ) + sel_memory=( '-m[display STREAMS memory statistics]' ) + sel_multicast=( '-M[display multicast routing tables]' ) + sel_dhcp=( '-D[display status of DHCP configured interfaces]' ) + sockets+=( + $verbose + '-R[show extended security attributes]' + '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' + ) + routing+=( $verbose + '*-f+[filter routing table]:rule:_values -S \: "filter rule" $flist + "af[specify address family]\:family\:(inet inet6 unix)" + "outif[specify output interface]\:interface\:_net_interfaces" + "dst[specify destination IP]\:IP address" + "flags[select routes tagged with flags]\:flags"' \ + '-a[show state of all routing tables]' + '-R[show extended security attributes]' + ) + groups+=( $families -n$nopt $verbose ) + interfaces+=( $interval + '-a[show state of all interfaces]' + ) + statistics+=( + '-P[specify protocol]:protocol:(ip ipv6 icmp icmpv6 igmp udp tcp rawip)' + ) + media=( -n$nopt $families ) + memory+=( $verbose $interval ) + multicast+=( + -n$nopt $families + '-s[show per protocol statistics]' + ) + dhcp=( $families $Iopt ) + ;; + darwin*) + sets+=( queues '-[^-]#q*' ) + sel_queues=( '*-q[display network interface send queue statistics]' ) + sel_memory=( \*$sel_memory ) + sockets+=( + '-l[show full IPv6 address]' + '-W[avoid truncating addresses]' + ) + routing+=( '-l[show mtu and use wider display]' ) + interfaces+=( + '(-x)-R[show reachability information]' + '-S[show interface link status and state]' + '(-R)-x[show extended reachability information]' + ) + queues=( $Iopt + '-c+[limit statistics to specified queue]:queue' + ) + groups+=( $families + '*-v[show link-layer memberships; repeat for timers and counters]' + ) + ;; + dragonfly*) + plist+=( carp ) + sockets+=( + '-P[show additional protocol-specific information]' + '-c+[access cpu specific route table]:cpu' + ) + interfaces+=( $zopt + '-B[show maximum buffer sizes instead of current buffer usage]' + '-t[show the contents of watchdog timers]' + '(-a -B -b -d -h -n -t -w)*-s[show protocol statistics; repeat to suppress those with zero counters]' + ) + routing+=( + '-A[show contents of internal Patricia tree structures]' + '-a[show protocol-cloned routes]' + ) + ;; + openbsd*) + sets+=( wireless '-W*' ) + sel_wireless=( '-W+[display per-interface IEEE 802.11 wireless statistics]:interface' ) + flist+=( local mpls ) + sockets+=( -l$lopt '-B[show buffer sizes for TCP sockets]' ) + routing+=( + '-F[only show routes with gateway in the same address family as the destination]' + '-T+[select an alternate routing table to query]:routing table' + ) + interfaces+=( + '-c+[show specified number of updates, then exit]:count' + '-q[only show interfaces that have seen packets]' + '-t[show current value of the watchdog timer function]' + ) + statistics+=( $popt ) + pcb+=( $Mopts $verbose ) + ;; + netbsd*) + popt='(-f)-p+[filter by protocol]:protocol:compadd - ${(M)${(f)"$(.*) + routing+=( '-F+[show specified routing table]:routing table' ) + bpf=( '-z[reset statistic counters after displaying them]' ) + statistics+=( $bpf[-1] ) + ;& + freebsd*) + flist+=( pfkey netgraph ng link ) + plist+=( sctp ipsec6 pfkey ) + + sets+=( netisr '-[^-]#Q*' ) + sel_netisr=( '-Q[display netisr(9) statistics]' ) + sockets+=( + '-R[show flowid and flowtype for each socket]' + '-T[show diagnostic information from the TCP control block]' + '-x[show socket buffer and TCP timer statistics]' + ) + interfaces+=( + $popt $Mopts $Iopt $Wopt + '-q+[exit after specified number of outputs]:number' + ) + bpf+=( $Iopt $zopt ) + ;; +esac + +# Ignore display specific options except the default (socket) display until a +# display has been selected. This is not strictly correct (options can be in +# any order) but makes the completion much more useful. Descriptions for +# options that select a specific display (option set) typically start with +# "display" to set them apart from other options. +sock='' +for set in ${(k)sets}; do + sel=sel_$set + if [[ -z $words[(r)$~sets[$set]] ]]; then + ign='!' + else + sock='!' + ign='' + fi + args+=( - "$set" ${(P)sel} ${ign}${(P)^set} ) +done +args+=( - sockets ${sock}${sockets} ) + +_arguments -s -S $args -- cgit v1.2.3 From 5e2d3d1e15e94e3d727e7393cbce2667a93f2fd4 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Sat, 19 May 2018 11:10:46 +0200 Subject: 42806: fix shutdown completion where options were lost due to args= assignment where args+= was needed --- ChangeLog | 3 +++ Completion/Unix/Command/_shutdown | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 8597c8ea2..dda1c6b22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-05-19 Oliver Kiddle + * 42806: Completion/Unix/Command/_shutdown: fix where options + were lost due to args= assignment where args+= was needed + * 42803: Completion/Unix/Command/_netstat: handle Linux and the the BSDs in netstat completion diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown index 9726182a0..4119502fb 100644 --- a/Completion/Unix/Command/_shutdown +++ b/Completion/Unix/Command/_shutdown @@ -27,8 +27,8 @@ case $OSTYPE in '*:warning message' ) ;| - *bsd*|dragonfly*|linux*) - args=( + *bsd*|dragonfly*) + args+=( '-p[turn off power after shutdown]' ) ;| -- cgit v1.2.3 From 47f34eff93bb0197865ad02302346298c6e9585d Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 4 Jun 2018 00:04:36 +0200 Subject: 42881: update options in ghostscript completion and query more matches directly from it --- ChangeLog | 3 + Completion/Unix/Command/_ghostscript | 121 +++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_gs | 57 ----------------- 3 files changed, 124 insertions(+), 57 deletions(-) create mode 100644 Completion/Unix/Command/_ghostscript delete mode 100644 Completion/Unix/Command/_gs (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index fa42722ba..fafc9e9e3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-03 Oliver Kiddle + * 42881: Completion/Unix/Command/_ghostscript: update options in + ghostscript completion and query more matches directly from it + * 42920: Completion/Linux/Command/_dkms: new dkms completion 2018-06-01 Peter Stephenson diff --git a/Completion/Unix/Command/_ghostscript b/Completion/Unix/Command/_ghostscript new file mode 100644 index 000000000..2c6f40a35 --- /dev/null +++ b/Completion/Unix/Command/_ghostscript @@ -0,0 +1,121 @@ +#compdef gs ghostscript + +local -a specs names device + +device=( ${${path[1,CURRENT-1]}[(R)-sDEVICE=*]} ) + +if compset -N '-[-+@]'; then + if [[ CURRENT -eq 1 ]]; then + _pspdf + else + _message -e arguments 'userdict ARGUMENTS' + return 1 + fi +elif compset -P '@'; then + _files +else + local curcontext="$curcontext" state line expl ret=1 + typeset -A opt_args + + _x_arguments -C \ + '-q[quiet startup]' \ + '-g-[set device size]:device size (x):' \ + '-r-[set resolution]:resolution ( or x):' \ + '-I+[add to library file search path]:directory:_dir_list' \ + \*-{d,D}'-[define name with definition]:def:->dname' \ + \*-{s,S}'-[define name with value]:def:->sname' \ + '-u[undefine name, cancelling -d or -s]:name:->uname' \ + '-P[look first in the current directory for library files]' \ + '-c[specify postscript code]:*[-@]*:postscript (-f to end)' \ + '-o+[specify OutputFile and enable -dPATCH and -dNOPAUSE options]: :->outfile' \ + '(- *)-'{h,\?}'[display useful options and available devices]' \ + '!-f-:PostScript or PDF file:_pspdf' \ + '*:PostScript or PDF file:_pspdf' && ret=0 + + [[ $state = sname ]] && compset -P '(stdout|OutputFile)=' && state=outfile + case "$state" in + dname) + if [[ "$PREFIX" = *\=* ]]; then + _message -e definition-values 'systemdict definition value' + else + names=( ${${(f)"$($words[1] -q -o /dev/null -DNODISPLAY -c 'systemdict { type /booleantype eq { = } if } forall')"}:#*[a-z]*} ) + _wanted boolean-definitions expl 'systemdict boolean definition' compadd -M 'm:{a-z}={A-Z}' -a names && ret=0 + names=( FirstPage LastPage + $($words[1] -q -o /dev/null $device -DNODISPLAY -c 'currentpagedevice { type /integertype eq { = } if } forall') ) + _wanted integer-definitions expl 'currentpagedevice integer definition' compadd -S = -M 'm:{a-z}={A-Z}' -a names && ret=0 + fi + ;; + sname) + if compset -P 1 '*='; then + case "$IPREFIX" in + *DEVICE\=) + _wanted devices expl 'ghostscript device' \ + compadd - ${(0)"$($words[1] -q -o /dev/null -DNODISPLAY -c 'devicenames { dup length string cvs print (\0) print } forall')"} && ret=0 + ;; + *PAPERSIZE=) + names=( $($words[1] -q -o /dev/null -DNODISPLAY -c 'statusdict /.pagetypenames get { = } forall ') ) + _description paper-sizes expl 'paper size' + compadd "$expl[@]" -a names && ret=0 + ;; + *PDFSETTINGS=) + _description settings expl 'configuration' + compadd "$expl[@]" /screen /ebook /printer /prepress /default && ret=0 + ;; + *AutoRotatePages=) + _description settings expl 'orientation selection' + compadd "$expl[@]" /None /All /PageByPage && ret=0 + ;; + *CompatibilityLevel=) + _description pdf-levels expl 'PDF compatibility level' + compadd "$expl[@]" 1.{2,3,4} && ret=0 + ;; + *FONT=) # e.g. SUBSTFONT + _wanted fonts expl 'font' compadd - \ + $($words[1] -q -o /dev/null -DNODISPLAY -c '(*) { = } 256 string /Font resourceforall') && ret=0 + ;; + *) + _message -e values 'systemdict value' + return 1 + ;; + esac + else + _wanted definition-names expl 'systemdict name' compadd -S\= -M 'm:{a-z}={A-Z}' - \ + DEVICE OutputFile PAPERSIZE PDFSETTINGS CompatibilityLevel stdout COLORSCREEN \ + DITHERPPI InterpolateControl TextAlphaBits GraphicsAlphaBits PageList SUBSTFONT \ + && ret=0 + fi + ;; + uname) + _message -e definition-names 'systemdict definition name' + ;; + outfile) + if compset -P "*%"; then + specs=( + {d,i}':signed decimal number or with leading " numeric value of following character' + 'o:unsigned octal number' + 'u:unsigned decimal number' + {x,X}':unsigned hexadecimal number, letters capitalized as x' + '%:a literal percent sign' + '#:alternate form' + '0:zero pad to length' + '-:left adjust result' + '+:always place sign before number' + '.:precision' + ) + if ! compset -P '[0-9#.+-]##'; then + specs+=( + 'stdout:redirect to standard output' + 'stderr:redirect to standard error' + 'pipe%:redirect to a pipe' + ) + fi + _describe -t print-format-specifiers 'print format specifier' specs -S '' && ret=0 + else + _description files expl 'output file' + _files "$expl[@]" && ret=0 + fi + ;; + esac + + return ret +fi diff --git a/Completion/Unix/Command/_gs b/Completion/Unix/Command/_gs deleted file mode 100644 index 98ba14912..000000000 --- a/Completion/Unix/Command/_gs +++ /dev/null @@ -1,57 +0,0 @@ -#compdef gs ghostscript - -if compset -N --; then - if [[ CURRENT -eq 1 ]]; then - _pspdf - else - _message -e arguments 'userdict ARGUMENTS' - return 1 - fi -else - local curcontext="$curcontext" state line expl ret=1 - typeset -A opt_args - - _x_arguments -C \ - '-q[quiet startup]' \ - '-g-[set device size]:device size (x):' \ - '-r-[set resolution]:resolution ( or x):' \ - '-I[add to library file search path]:directory:_dir_list' \ - \*-{d,D}'-[define name with definition]:def:->dname' \ - \*-{s,S}'-[define name with value]:def:->sname' \ - '*:PostScript or PDF file:_pspdf' && ret=0 - - case "$state" in - dname) - if [[ "$PREFIX" = *\=* ]]; then - _message -e definition-values 'systemdict definition value' - else - _wanted names expl 'systemdict definition name' \ - compadd -M 'm:{a-z}={A-Z}' - \ - DISKFONTS NOCACHE NOBIND NODISPLAY NOPAUSE PLATFONTS SAFER \ - WRITESYSTEMDICT && ret=0 - fi - ;; - sname) - if compset -P 1 '*='; then - case "$IPREFIX" in - *DEVICE\=) - _wanted devices expl 'ghostscript device' \ - compadd - "${(@)${=${$(_call_program devices gs -h)##* devices:}%%Search path:*}:#}" && ret=0 - ;; - *OutputFile\=) - _description files expl 'output file' - _files "$expl[@]" && ret=0 - ;; - *) - _message -e values 'systemdict value' - return 1 - esac - else - _wanted names expl 'systemdict name' \ - compadd -S\= -M 'm:{a-z}={A-Z}' - DEVICE OutputFile && ret=0 - fi - ;; - esac - - return ret -fi -- cgit v1.2.3 From 3585c28c36f98840de66e7ac8ccfe6f274162097 Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 2 Jun 2018 23:58:47 -0500 Subject: 42922: new tac completion --- ChangeLog | 2 ++ Completion/Unix/Command/_tac | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 Completion/Unix/Command/_tac (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index fafc9e9e3..626b0d970 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2018-06-03 Oliver Kiddle + * 42922: dana: Completion/Unix/Command/_tac: new tac completion + * 42881: Completion/Unix/Command/_ghostscript: update options in ghostscript completion and query more matches directly from it diff --git a/Completion/Unix/Command/_tac b/Completion/Unix/Command/_tac new file mode 100644 index 000000000..7a15bffff --- /dev/null +++ b/Completion/Unix/Command/_tac @@ -0,0 +1,19 @@ +#compdef tac gtac + +local variant + +_pick_variant -r variant gnu='Free Soft' unix --version + +# NetBSD (at least) has its own bare-bones version of this tool +[[ $variant == gnu ]] || { + _default + return +} + +_arguments -s -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + '(-b --before)'{-b,--before}'[attach separator before instead of after]' \ + '(-r --regex)'{-r,--regex}'[treat separator as regular expression (with -s)]' \ + '(-s --separator)'{-s+,--separator=}'[use specified separator instead of newline]:separator' \ + '*: :_files' -- cgit v1.2.3 From 32ac8c5bcb9e9a21d60313d28c494bebca39a89c Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 2 Jun 2018 18:07:35 -0500 Subject: 42919: new shuf and uptime completions --- Completion/Unix/Command/_shuf | 28 ++++++++++++++++++++++++++++ Completion/Unix/Command/_uptime | 26 ++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 Completion/Unix/Command/_shuf create mode 100644 Completion/Unix/Command/_uptime (limited to 'Completion/Unix/Command') diff --git a/Completion/Unix/Command/_shuf b/Completion/Unix/Command/_shuf new file mode 100644 index 000000000..83f42e6d3 --- /dev/null +++ b/Completion/Unix/Command/_shuf @@ -0,0 +1,28 @@ +#compdef shuf gshuf + +local ret=1 +local -a context line state state_descr +local -A opt_args + +_arguments -s -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + '(-n --head-count)'{-n+,--head-count=}'[limit output to specified number of lines]:output line limit' \ + '(-o --output)'{-o+,--output=}'[write result to specified file]:output file:_files' \ + '--random-source=[use specified file as source of random bytes]: :_files' \ + '(-r --repeat)'{-r,--repeat}'[allow output lines to repeat]' \ + '(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line delimiter]' \ + '(-i --input-range)*: :->operands' \ + + '(excl)' \ + {-e,--echo}'[treat operands as input lines]' \ + '(:)'{-i+,--input-range=}'[treat specified numbers as input lines]:number range (x-y)' \ +&& ret=0 + +[[ $state == operands ]] && +if [[ -n ${opt_args[(i)excl-(-e|--echo)]} ]]; then + _message 'input line' && ret=0 +else + _files && ret=0 +fi + +return ret diff --git a/Completion/Unix/Command/_uptime b/Completion/Unix/Command/_uptime new file mode 100644 index 000000000..58b4d991b --- /dev/null +++ b/Completion/Unix/Command/_uptime @@ -0,0 +1,26 @@ +#compdef uptime guptime + +local variant + +_pick_variant -r variant procps=procps gnu='Free Soft' unix --version + +case $variant in + procps) + _arguments -s -S : \ + '(: -)'{-h,--help}'[display help information]' \ + '(: -)'{-V,--version}'[display version information]' \ + + '(excl)' \ + {-p,--pretty}'[display uptime in pretty format]' \ + {-s,--since}'[display date/time of system boot]' + return + ;; + gnu) + _arguments -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + '1:utmp/wtmp file:_files' + return + ;; + # *BSD, Darwin, Solaris, BusyBox + *) _message 'no more arguments'; return 1 ;; +esac -- cgit v1.2.3 From 09b6959aa5216813dbe66400e7df73ab83074986 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 7 Jun 2018 17:30:57 +0200 Subject: 43943: update samba completion with long options --- ChangeLog | 4 + Completion/Unix/Command/_samba | 173 +++++++++++++++++++++++------------------ 2 files changed, 100 insertions(+), 77 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 9de7d953b..1907393be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-06-07 Oliver Kiddle + + * 43943: Completion/Unix/Command/_samba: update with long options + 2018-06-06 Peter Stephenson * Eitan: 42938: Src/Modules/mathfunc.c: name argument to diff --git a/Completion/Unix/Command/_samba b/Completion/Unix/Command/_samba index faad69ba4..9a2fea9d6 100644 --- a/Completion/Unix/Command/_samba +++ b/Completion/Unix/Command/_samba @@ -1,93 +1,112 @@ #compdef smbcontrol smbclient nmblookup smbstatus -local expl msgs args +local curcontext="$curcontext" ret=1 +local -a state line expl msgs args ign + +(( CURRENT == 2 )) || ign='!' +args=( + '(-d --debuglevel)'{-d+,--debuglevel=}'[set debug level]:debug level (1..10) [1]' + '(-s --configfile)'{-s+,--configfile=}'[specify alternate smb.conf file]:config file:_files' + '(-l --log-basename)'{-l+,--log-basename=}'[specify base name for log files]:base name:_files' + '*--option=[set smb.conf option from command line]:option=value' + "${ign}(1 2 3 -)"{-\?,--help}'[display usage information]' + "${ign}(1 2 3 -)--usage[display brief usage information]" + "${ign}(1 2 3 - *)"{-V,--version}'[display version information]' +) case $service in smbcontrol) - case $CURRENT in - 3) - msgs=( debug ping profile debuglevel profilelevel ) - case $words[CURRENT-1] in - nmbd) msgs=( $msgs force-election ) ;; - smbd) msgs=( $msgs printer-notify ) ;; - -i) return 1 ;; - esac - _wanted message-type expl 'message types' compadd -a msgs - ;; - 4) - case $words[CURRENT-1] in - profile) - _wanted parameter expl 'parameter' compadd on off flush count - ;; - debug) _message -e levels 'debug level' ;; - ping) _message -e numbers 'number of ping messages' ;; - esac + _arguments -C -S $args \ + '(-t --timeout)'{-t+,--timeout=}'[set timeout]:timeout (seconds)' \ + ':destination:(all nmbd smbd winbindd)' \ + ':message type:->message-types' \ + ':parameter:->parameters' && ret=0 + + case $state in + message-types) + msgs=( ${${${${${(f)"$(_call_program message-types smbcontrol -\? 2>&1)"}[(r) Date: Tue, 5 Jun 2018 22:02:42 +0000 Subject: 42935: FreeBSD does not support -v for arp --- ChangeLog | 3 +++ Completion/Unix/Command/_arp | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 3c9bbd4e9..ab984f503 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-07 Oliver Kiddle + * 42935: Eitan Adler: Completion/Unix/Command/_arp: + FreeBSD does not support -v for arp + * 42937: Eitan Adler: Completion/BSD/Command/_powerd: add -M/-m * 43943: Completion/Unix/Command/_samba: update with long options diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp index 5b047b2b8..90e30d6c2 100644 --- a/Completion/Unix/Command/_arp +++ b/Completion/Unix/Command/_arp @@ -37,7 +37,7 @@ case $OSTYPE in flags+=( netmask ) ;; darwin*|freebsd*|dragonfly*) - cmds+=( '(-n -v -i)-S[create an arp entry, replacing any existing entry]' ) + cmds+=( '(-n -i)-S[create an arp entry, replacing any existing entry]' ) ;| darwin*|freebsd*) args+=( '(-s -Q -f)-i+[select an interface]:interface:_net_interfaces' ) @@ -58,7 +58,6 @@ case $OSTYPE in args+=( $vopt ) ;; freebsd*) - args+=( $vopt ) flags+=( blackhole reject ) ;; openbsd*) -- cgit v1.2.3 From 64ef1eddfd4fa79a0720945e189cf7c3a44bde9c Mon Sep 17 00:00:00 2001 From: dana Date: Mon, 4 Jun 2018 10:04:27 -0500 Subject: 42931: completion for several utilities especially for checksums across a variety of systems --- ChangeLog | 7 +++ Completion/BSD/Command/_cksum | 67 ----------------------- Completion/Unix/Command/_base64 | 59 ++++++++++++++++++++ Completion/Unix/Command/_chroot | 53 ++++++++++++++++++ Completion/Unix/Command/_cksum | 112 ++++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_lz4 | 103 +++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_md5sum | 63 ++++++++++++++++----- Completion/Unix/Command/_readlink | 48 ++++++++++++++++ Completion/Unix/Command/_shasum | 24 ++++++++ Completion/Unix/Command/_tee | 32 +++++++++++ 10 files changed, 486 insertions(+), 82 deletions(-) delete mode 100644 Completion/BSD/Command/_cksum create mode 100644 Completion/Unix/Command/_base64 create mode 100644 Completion/Unix/Command/_chroot create mode 100644 Completion/Unix/Command/_cksum create mode 100644 Completion/Unix/Command/_lz4 create mode 100644 Completion/Unix/Command/_readlink create mode 100644 Completion/Unix/Command/_shasum create mode 100644 Completion/Unix/Command/_tee (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 9f958fb7f..81478847b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2018-06-07 Oliver Kiddle + * 42931: dana: Completion/Unix/Command/_base64, + Completion/Unix/Command/_chroot, Completion/Unix/Command/_cksum, + Completion/Unix/Command/_lz4, Completion/Unix/Command/_md5sum, + Completion/Unix/Command/_tee, Completion/Unix/Command/_shasum, + Completion/Unix/Command/_readlink: completion for several + utilities especially for checksums across a variety of systems + * users/23434: Functions/Misc/zed: initialise UNDO_LIMIT_NO so that an initial undo doesn't clear the whole edit buffer diff --git a/Completion/BSD/Command/_cksum b/Completion/BSD/Command/_cksum deleted file mode 100644 index 4f5b68d8a..000000000 --- a/Completion/BSD/Command/_cksum +++ /dev/null @@ -1,67 +0,0 @@ -#compdef cksum sum=cksum md2 md4 md5 rmd160 sha1 sha256 sha384 sha512 sha512t256 - -if [[ $OSTYPE == (dragonfly|freebsd)* && service == cksum ]]; then - _arguments -s -S -A '-*' \ - '-o[use specified historic algorithm]:historic algorithm:(1 2 3)' \ - '*:_files' - -else - local -a args - - case $OSTYPE in - dragonfly*|freebsd*|netbsd*) - args+=( - '-t[run built-in time trial]' - ) - ;| - dragonfly*|freebsd*|openbsd*) - args+=( - '-r[reverse the output format]' - ) - ;| - dragonfly*) - args+=( - '-b+[begin at specified offset]:begin offset: ' - '-e+[end at specified offset]:end offset: ' - ) - ;; - freebsd*) - args+=( - '-c+[compare digest against specified string]:digest string: ' - ) - ;; - netbsd*) - args+=( - '(*)-c+[compare checksums against specifed sumfile]:sumfile:_files' - '-n[reverse the output format]' - '-w[warn on malformed checksum files]' - ) - if [[ $service == cksum ]]; then - args=( - '(-o)-a+[use the specfied algorithm(s)]:algorithm:(crc md2 md4 md5 old1 old2 rmd160 sha1 sha256 sha384 sha512)' - '(-a)-o+[use the specfied historic algorithm]:historic algorithm:(1 2)' - ) - fi - ;; - openbsd*) - args+=( - '-b[output in base 64]' - '-C+[compare checksums against specifed checklist]:checklist:_files' - '-c[file arguments are checklists]' - '-h+[output to specified hashfile]:hashfile:_files' - '*-t[run built-in time trial]' - ) - if [[ $service == cksum ]]; then - args+=('*-a+[use the specfied algorithm(s)]:algorithm:_values -s , algotithm cksum md5 rmd160 sha1 sha224 sha256 sha384 sha512/256 sha512') - fi - ;; - esac - - _arguments -s -S -A '-*' \ - $args \ - '-p[echo stdin to stdout]' \ - '-q[quiet mode]' \ - '-s+[checksum specified string]:string: ' \ - '-x[run built-in test]' \ - '*:_files' -fi diff --git a/Completion/Unix/Command/_base64 b/Completion/Unix/Command/_base64 new file mode 100644 index 000000000..47a650343 --- /dev/null +++ b/Completion/Unix/Command/_base64 @@ -0,0 +1,59 @@ +#compdef base64 gbase64 base32 gbase32 + +# Note: This does NOT cover `uuencode`/`uudecode`, which on some BSD systems +# have the aliases `b64encode`/`b64decode` — those are sufficiently different +# that they belong in another function. It DOES cover GNU's `base32`, since it +# is essentially the same program as their `base64`. + +local variant type=base${service//[^2346]/} + +_pick_variant -r variant \ + gnu='Free Soft' fourmilab=fourmi darwin=-D unix --version + +case $variant in + gnu) + _arguments -s -S : \ + '(: -)--help[display help information]' \ + '(: -)--version[display version information]' \ + + dec \ + '(enc -d --decode)'{-d,--decode}"[decode input from $type]" \ + '(enc -i --ignore-garbage)'{-i,--ignore-garbage}'[ignore irrelevant characters when decoding]' \ + + '(enc)' \ + '(dec)'{-w+,--wrap=}'[wrap encoded lines at specified number of columns]:number of columns' \ + + in \ + '1:input file:_files' + return + ;; + darwin) + _arguments -s -S : \ + '(: -)'{-h,--help}'[display help information]' \ + + '(dec)' \ + '(enc)'{-D,--decode}"[decode input from $type]" \ + + '(enc)' \ + '(dec)'{-b+,--break=}'[wrap encoded lines at specified number of columns]:number of columns' \ + + '(out)' \ + {-o+,--output=}'[specify output file]:output file:_files' \ + + '(in)' \ + {-i+,--input=}'[specify input file]:input file:_files' \ + '1:input file:_files' + return + ;; + fourmilab) + _arguments -s -S : \ + '(: -)--copyright[display copyright information]' \ + '(: -)'{-u,--help}'[display help information]' \ + '(: -)--version[display version information]' \ + + dec \ + '(enc -d --decode)'{-d,--decode}"[decode input from $type]" \ + '(enc -n --noerrcheck)'{-n,--noerrcheck}'[ignore errors when decoding]' \ + + '(enc)' \ + '(dec)'{-e,--encode}"[encode input to $type]" \ + + io \ + '1:input file:_files' \ + '2:output file:_files' + return + ;; +esac + +# A few other implementations exist, though they are rarely encountered +_default diff --git a/Completion/Unix/Command/_chroot b/Completion/Unix/Command/_chroot new file mode 100644 index 000000000..516992694 --- /dev/null +++ b/Completion/Unix/Command/_chroot @@ -0,0 +1,53 @@ +#compdef chroot gchroot + +local variant ret=1 +local -a context line state state_descr args +local -A opt_args + +_pick_variant -r variant gnu='Free Soft' unix --version + +variant+=-$OSTYPE + +case $variant in + gnu-*) + args=( + '(: -)--help[display help information]' + '(: -)--version[display version information]' + '--groups=[specify supplemental group memberships]: :_sequence -s , _groups' + '--userspec=[specify user and group to run process as]: :->userspecs' + '--skip-chdir[do not change working directory to /]' + ) + ;; + *-openbsd*) + args=( + '-u+[specify user to run process as]: :_users' + '-g+[specify group to run process as, and supplemental group memberships]: :_sequence -s , _groups' + ) + ;; + *-(darwin|dragonfly|freebsd|netbsd)*) + args=( + '-u+[specify user to run process as]: :_users' + '-g+[specify group to run process as]: :_groups' + '-G+[specify supplemental group memberships]: :_sequence -s , _groups' + ) + ;; +esac + +args+=( '1:new root directory:_directories' '*:::command:_normal' ) + +_arguments -s -S : $args && ret=0 + +# @todo user:group specs are probably used often enough to justify making a type +# function for this (see also `chown`, `cpio`, `rsync`, ...) +[[ $state == userspecs ]] && +if compset -P '*:*:'; then + ret=1 +elif compset -P '*:'; then + _groups && ret=0 +elif compset -S ':*'; then + _users && ret=0 +else + _users -qS : && ret=0 +fi + +return ret diff --git a/Completion/Unix/Command/_cksum b/Completion/Unix/Command/_cksum new file mode 100644 index 000000000..bb2f60ac7 --- /dev/null +++ b/Completion/Unix/Command/_cksum @@ -0,0 +1,112 @@ +#compdef cksum gcksum sum gsum md2 md4 md5 rmd160 sha1 sha256 sha384 sha512 sha512t256 skein256 skein512 skein1024 + +# This function covers mostly the BSD `cksum`, `sum`, and digest utilities. It +# also covers the GNU Coreutils `cksum` and `sum`. For the GNU digest utilities, +# see `_md5sum`. For the `shasum` Perl script, see `_shasum`. +# +# Notes: +# - We really don't do a very good job of handling option exclusivity here. In +# particular, OpenBSD treats -t and -x as exclusive of each other and most +# other options — but there are issues with other variants too (@todo) +# - Although only OpenBSD's documentation mentions it, -t can be supplied +# multiple times with all variants to run additional rounds of testing +# - All digest variants on a given platform share code, but not all variants are +# found on all platforms (e.g., Darwin only has `md5`). Some BSDs are actively +# purging legacy/insecure digest tools +# - The documentation for Dragonfly/FreeBSD `sum` says that it's 'identical to' +# `cksum`, but, as the synopsis confirms, it doesn't take any options +# - FreeBSD's -c is never useful, and Dragonfly's -b/-e are *almost* never +# useful, with multiple input files +# - NetBSD's -n isn't useful with `sum` and `cksum` unless a digest is specified +# with -a. Similarly, OpenBSD's -b isn't useful with `cksum` without -a +# - OpenBSD's -a option allows you to add a b/x suffix to each algorithm name; +# we don't handle that. Also, only one -a option can be used in conjunction +# with -c; we don't handle that either + +local -a args + +_pick_variant gnu='Free Soft' unix --version && { + args=( + '*: :_files' + '(: -)--help[display help information]' + '(: -)--version[display version information]' + ) + [[ $service == *cksum* ]] || args+=( + '(-s --sysv)-r[use BSD algorithm (1 KiB blocks)]' + '(-r -s --sysv)'{-s,--sysv}'[use System V algorithm (512 B blocks)]' + ) + _arguments -s -S : $args + return +} + +[[ $OSTYPE == (darwin|dragonfly|freebsd|openbsd)* && $service == sum ]] && { + _default + return +} + +[[ $OSTYPE == (darwin|dragonfly|freebsd)* && $service == cksum ]] && { + _arguments -s -S -A '-*' \ + '-o[use specified historic algorithm]:historic algorithm:(1 2 3)' \ + '*: :_files' + return +} + +case $OSTYPE in + darwin*|dragonfly*|freebsd*|netbsd*) + args+=( + '(-n -p -r)-q[output checksums only]' + ) + ;| # MATCH AGAIN + darwin*|dragonfly*|freebsd*|openbsd*) + args+=( + '(-p -q)-r[reverse output format]' + ) + ;| # MATCH AGAIN + netbsd*|openbsd*) + args+=( + '-c[verify checksums from input files]' + ) + ;| # MATCH AGAIN + dragonfly*) + args+=( + '-b+[begin processing files at specified offset]:begin offset (bytes)' + '-e+[end processing files at specified offset]:end offset (bytes)' + ) + ;; + freebsd*) + args+=( + '-c+[verify input against specified digest string]:digest string' + ) + ;; + netbsd*) + args+=( + '(-p -q)-n[reverse output format]' + '(-p)-w[warn on malformed checksum files]' + ) + [[ $service == (|ck)sum ]] && args+=( + '(-o)-a+[use specified algorithm]:algorithm:(crc md2 md4 md5 old1 old2 rmd160 sha1 sha256 sha384 sha512)' + '(-a)-o+[use specified historic algorithm]:historic algorithm:(1 2)' + ) + ;; + openbsd*) + args+=( + '-b[output in base64]' + '(-h)-C+[verify input files against checksums in specifed file]:checksum file:_files' + '(-C)-h+[output checksums to specified file]:checksum file:_files' + '(-n -r)-q[output checksum only, or suppress check success messages]' + ) + [[ $service == cksum ]] && args+=( + '*-a+[use specified algorithm(s)]:algorithm:_values -s , algorithm cksum md5 rmd160 sha1 sha224 sha256 sha384 sha512/256 sha512' + ) + ;; +esac + +args+=( + '-p[output stdin along with checksum]' + '*-s+[checksum specified string]:string' + '*-t[run built-in time trial(s)]' + '-x[run built-in tests]' + '*: :_files' +) + +_arguments -s -S -A '-*' : $args diff --git a/Completion/Unix/Command/_lz4 b/Completion/Unix/Command/_lz4 new file mode 100644 index 000000000..d69091d00 --- /dev/null +++ b/Completion/Unix/Command/_lz4 @@ -0,0 +1,103 @@ +#compdef lz4 lz4c lz4c32 lz4cat unlz4 + +# Notes: +# - All lz4 CLI tools take the same options — you can do `unlz4 --compress` if +# you want — and we complete accordingly. One can make a reasonable argument +# that we shouldn't, but...? +# - The only exceptions to the above are the legacy compression options (-c0, +# -hc, and so on) — only lz4c accepts these. Each of these options is +# interpreted separately otherwise (e.g., -c0 becomes equivalent to -c -0) +# - All these tools use a non-standard option-handling method that we don't +# fully support. For example, the tool will let you do things like `-b1e3i3` +# instead of `-b1 -e3 -i3` — we won't + +local ret=1 +local -a context line state state_descr expl args levels=( -{1..16} ) +local -A opt_args val_args + +args=( + + excl # Fully exclusive options + '(: -)'{-h,--help}'[display help information]' + '(: -)-H[display long help information]' + '(: -)'{-V,--version}'[display version information]' + + misc # Misc. arguments + '(-q -v --quiet --verbose)*'{-q,--quiet}'[reduce output verbosity]' + '(-q -v --quiet --verbose)*'{-v,--verbose}'[increase output verbosity]' + '*::: :->files' + + B # Benchmark/compress-mode options (not allowed with legacy format) + '(d t -l)*-B-[specify block property]: :->block-props' + '(d t -l --no-content-size)--content-size[record original uncompressed size]' + '(d t -l --no-frame-crc)--frame-crc[enable content checksum]' + '(d t -l --content-size)--no-content-size[do not record original uncompressed size]' + '(d t -l --frame-crc)--no-frame-crc[disable content checksum]' + '(d t -l --sparse)--no-sparse[disable sparse-file support]' + '(d t -l --no-sparse)--sparse[enable sparse-file support]' + + C # Compress/decompress-mode options + '(b t -c --stdout --to-stdout)'{-c,--stdout}'[write on standard output]' + '(b t -y)'{-f,--force}'[overwrite target without prompting, or cat on standard output]' + '(b t -k --keep --rm)'{-k,--keep}'[keep source file]' + '(b t -m -r --multiple)'{-m,--multiple}'[take multiple input files]' + '!(b -t -f -y --force)--no-force' + '(b t -m --multiple)-r[operate recursively on directories]' + '(b t -k --keep)--rm[remove source file]' + '!(b t -c --stdout)--to-stdout' + + b # Benchmark-mode options + "(C c d t)-b-[benchmark file using specified compression level]::compression level:(${(j< >)levels//-/})" + "(C c d t)-e-[specify upper compression level limit (with -b)]:compression level:(${(j< >)levels//-/})" + '(C c d t)-i-[specifiy minimum evaluation time (with -b)]:evaluation time (seconds)' + + c # Compress-mode options + "(b d t ${(j< >)levels} -c0 -c1 -c2 -hc)"${^levels} + '(B b d t -m -r --multiple)-l[compress using legacy (Linux kernel) format]' + '(b d t -z --compress)'{-z,--compress}'[compress file]' + + d # Decompress-mode options + '(B b c d t)'{-d,--decompress}'[decompress file]' + '!(B b c d t)--uncompress' + + t # Test-mode options + '(B C b c d t)'{-t,--test}'[test integrity of compressed file]' +) +[[ $service == lz4c ]] && args+=( + + l # Legacy compress-mode options (not to be confused with the legacy format) + "(b d t ${(j< >)levels} -c1 -c2 -hc)-c0[use fast compression (like -0)]" + "(b d t ${(j< >)levels} -c0 -c2 -hc)-c1[use high compression (like -9)]" + "(b d t ${(j< >)levels} -c0 -c1 -c2 -hc)"{-c2,-hc}'[use very high compression (like -12)]' + '(b t -f --force)-y[overwrite target without prompting]' +) + +_arguments -s -S : $args && ret=0 + +case $state in + block-props) + # The usage help indicates that the use of an explicit byte value (-B32 or + # greater) is only for benchmarking, and indeed when such a value is given + # the tool prints a message prefixed with 'bench:'... but there is nothing + # that actually restricts this to the benchmark mode, so...? + _values 'predefined block property or block size in bytes (32+)' \ + '4[set block size to 64 KiB]' \ + '5[set block size to 256 KiB]' \ + '6[set block size to 1 MiB]' \ + '7[set block size to 4 MiB]' \ + 'D[enable block dependency]' \ + 'X[enable block checksum]' \ + && ret=0 + ;; + files) + if + (( CURRENT == 1 )) || + [[ -n ${opt_args[(i)*-(-b|-m|-r|--multiple)]} ]] + then + if [[ -n ${opt_args[(i)*--r]} ]]; then + _description files expl 'input file or directory' + else + _description files expl 'input file' + fi + _files "${(@)expl}" && ret=0 + elif (( CURRENT == 2 )); then + _description files expl 'output file' + _files "${(@)expl}" && ret=0 + else + _message 'no more arguments' && ret=0 + fi + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_md5sum b/Completion/Unix/Command/_md5sum index 073e6beba..8e93fbbac 100644 --- a/Completion/Unix/Command/_md5sum +++ b/Completion/Unix/Command/_md5sum @@ -1,15 +1,48 @@ -#compdef md5sum gmd5sum - -_arguments -S \ - '(-b --binary)'{-b,--binary}'[read in binary mode]' \ - '(-c --check)'{-c,--check}'[read MD5 sums from the FILEs and check them]' \ - '--tag[create a BSD-style checksum]' \ - '(-t --text)'{-t,--text}'[read in text mode]' \ - "--ignore-missing[don't fail or report status for missing files]" \ - '(-q --quiet)'{-q,--quiet}"[don't print OK for each successfully verified file]" \ - '--status[no output, status code shows success]' \ - '--strict[exit non-zero for improperly formatted checksum lines]' \ - '(-w --warn)'{-w,--warn}'[warn about improperly formatted checksum lines]' \ - '(-)--help[display help and exit]' \ - '(-)--version[output version information and exit]' \ - '*:files:_files' +#compdef md5sum gmd5sum b2sum gb2sum sha1sum gsha1sum sha224sum gsha224sum sha256sum gsha256sum sha384sum gsha384sum sha512sum gsha512sum + +# This function covers the various digest utilities (which are all essentially +# the same program) from GNU Coreutils. It does NOT cover GNU `cksum` and `sum`, +# nor the various BSD digest utilities like `md5` and `sha1` — see `_cksum` for +# all of those. See `_shasum` for the `shasum` Perl script. +# +# @todo Support BusyBox? + +local type +local -a args + +case $service in + *md5*) type=MD5 ;; + *b2*) type=BLAKE2 ;; + *sha*) type=SHA${service//[^0-9]/} ;; +esac + +# General options +args+=( + '(: -)--help[display help information]' + '(: -)--version[display version information]' +) +# Summing options +args+=( + + sum + '(chk)--tag[create BSD-style checksums]' + '(chk -b -t --binary --text)'{-b,--binary}'[read in binary mode]' + '(chk -b -t --binary --text)'{-t,--text}'[read in text mode]' +) +# This is the only option that differs amongst all of these tools +[[ $service == *b2* ]] && args+=( + '(chk -l --length)'{-l+,--length=}'[specify digest length]:digest length (bits, multiples of 8)' +) +# Verification options +args+=( + + chk + '(sum -c --check)'{-c,--check}"[verify $type checksums from input files]" + "(sum)--ignore-missing[don't fail or report status for missing files]" + "(sum)--quiet[don't print OK for each verified file]" + '(sum -w --warn)--status[suppress all output]' + '(sum)--strict[exit non-zero for improperly formatted checksum lines]' + '(sum -w --status --warn)'{-w,--warn}'[warn about each improperly formatted checksum line]' +) +# Operands +args+=( '*: :_files' ) + +_arguments -s -S : $args diff --git a/Completion/Unix/Command/_readlink b/Completion/Unix/Command/_readlink new file mode 100644 index 000000000..36bd43752 --- /dev/null +++ b/Completion/Unix/Command/_readlink @@ -0,0 +1,48 @@ +#compdef readlink greadlink + +local variant ret=1 +local -a context line state state_descr args copts aopts=( -A '-*' ) +local -A opt_args + +# We can't use groups here because it would complicate the option filtering +copts=( -e -f -m --canonicalize --canonicalize-existing --canonicalize-missing ) + +args=( + '(: -)--help[display help information]' + '(: -)--version[display version information]' + # Delimiter options + # (Note: GNU `readlink` won't let you use -n with multiple files) + '(-n -z --no-newline --zero)'{-n,--no-newline}'[suppress trailing newline]' + '(-n -z --no-newline --zero)'{-z,--zero}'[use NUL as output delimiter]' + # Verbosity options + '(-q -s -v --quiet --silent --verbose)'{-q,-s,--quiet,--silent}'[suppress most error messages]' + '(-q -s -v --quiet --silent --verbose)'{-v,--verbose}'[show error messages]' + # Canonicalisation options + "(${(j< >)copts})"{-e,--canonicalize-existing}'[canonicalize paths (all components must exist)]' + "(${(j< >)copts})"{-f,--canonicalize}'[canonicalize paths]' + "(${(j< >)copts})"{-m,--canonicalize-missing}'[canonicalize paths (components may be missing)]' +) + +# Filter out non-GNU options if applicable +if _pick_variant gnu='Free Soft' unix --version; then + aopts=( ) +else + case $OSTYPE in + darwin*) args=( ${(@M)args:#(|*\))-[n]\[*} ) ;; + netbsd*) args=( ${(@M)args:#(|*\))-[fnqsv]\[*} ) ;; + dragonfly*|*bsd*) args=( ${(@M)args:#(|*\))-[fn]\[*} ) ;; + *) args=( ) ;; + esac +fi + +_arguments -s -S $aopts : $args '*: :->files' && ret=0 + +# File arguments must be symlinks unless a canonicalisation option is given +[[ $state == files ]] && +if [[ ${opt_args[(i)(${~${(j<|>)copts}})]} ]]; then + _files && ret=0 +else + _files -g '*(@)' && ret=0 +fi + +return ret diff --git a/Completion/Unix/Command/_shasum b/Completion/Unix/Command/_shasum new file mode 100644 index 000000000..950a47763 --- /dev/null +++ b/Completion/Unix/Command/_shasum @@ -0,0 +1,24 @@ +#compdef shasum -P shasum(|5).* + +# This function covers the `shasum` script included with Perl (and notably the +# primary SHA digest tool on macOS). See `_md5sum` for the GNU digest utilities +# and `_cksum` for the BSD ones. +# +# @todo It's possible that someone could symlink this script to `sha1sum` or +# whatever; we might want to detect that some day. + +_arguments -s -S : \ + '(: -)'{-h,--help}'[display help information]' \ + '(: -)'{-v,--version}'[display version information]' \ + + '(sum)' \ + '(chk)'{-0,--01}'[read in BITS mode]' \ + '(chk)'{-b,--binary}'[read in binary mode]' \ + '(chk)'{-p,--portable}'[read in portable mode]' \ + '(chk)'{-t,--text}'[read in text mode]' \ + + 'chk' \ + '(sum)'{-c,--check}'[verify checksums from input files]' \ + '(sum -s -w --status --warn)'{-s,--status}'[suppress all output]' \ + '(sum -s -w --status --warn)'{-w,--warn}'[warn about each improperly formatted checksum line]' \ + + misc \ + '(-a --algorithm)'{-a+,--algorithm=}'[specify algorithm]:algorithm:(1 224 256 384 512 512224 512256)' \ + '*: :_files' diff --git a/Completion/Unix/Command/_tee b/Completion/Unix/Command/_tee new file mode 100644 index 000000000..66ef66e19 --- /dev/null +++ b/Completion/Unix/Command/_tee @@ -0,0 +1,32 @@ +#compdef tee gtee + +local ret=1 +local -a context line state state_descr args +local -A opt_args + +args=( + '(: -)--help[display help information]' + '(: -)--version[display version information]' + '(-a --append)'{-a,--append}'[append to files instead of overwriting]' + '(-i --ignore-interrupts)'{-i,--ignore-interrupts}'[ignore interrupt signals]' + '(--output-error)-p[warn on errors writing to non-pipes]' + '(-p)--output-error=[specify write-error behavior]: :->errmodes' +) + +# Filter out non-GNU options if applicable +_pick_variant gnu='Free Soft' unix --version || +args=( ${(@M)args:#(|*\))-[ai]\[*} ) + +_arguments -s -S : $args '*: :_files' && ret=0 + +[[ $state == errmodes ]] && { + args=( + 'exit[exit on errors writing to any output]' + 'exit-nopipe[exit on errors writing to non-pipes]' + 'warn[warn on errors writing to any output]' + 'warn-nopipe[warn on errors writing to non-pipes]' + ) + _values 'error mode' $args && ret=0 +} + +return ret -- cgit v1.2.3 From 880098352cdcbe20e7b237e144869296537a07f1 Mon Sep 17 00:00:00 2001 From: Doron Behar Date: Thu, 7 Jun 2018 19:26:29 +0300 Subject: 42947: new luarocks completion --- ChangeLog | 5 + Completion/Unix/Command/_luarocks | 591 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 596 insertions(+) create mode 100644 Completion/Unix/Command/_luarocks (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 81478847b..314cfdc85 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2018-06-07 Oliver Kiddle + * 42947: Doron Behar: Completion/Unix/Command/_luarocks: + new luarocks completion + + * 42948: dana: Completion/Linux/Command/_opkg: new opkg completion + * 42931: dana: Completion/Unix/Command/_base64, Completion/Unix/Command/_chroot, Completion/Unix/Command/_cksum, Completion/Unix/Command/_lz4, Completion/Unix/Command/_md5sum, diff --git a/Completion/Unix/Command/_luarocks b/Completion/Unix/Command/_luarocks new file mode 100644 index 000000000..363cedc8d --- /dev/null +++ b/Completion/Unix/Command/_luarocks @@ -0,0 +1,591 @@ +#compdef luarocks + +# Start of options' arguments' helpers +(( $+functions[__luarocks_command] )) || +__luarocks_command(){ + local -a commands=( + build:'build/compile a rock' + config:'query information about the LuaRocks configuration' + doc:'show documentation for an installed rock' + download:'download a specific rock file from a rocks server' + help:'help on commands' + install:'install a rock' + lint:'check syntax of a rockspec' + list:'list currently installed rocks' + make:'compile package in current directory using a rockspec' + new_version:'auto-write a rockspec for a new version of a rock' + pack:'create a rock, packing sources or binaries' + path:'return the currently configured package path' + purge:'remove all installed rocks from a tree' + remove:'uninstall a rock' + search:'query the LuaRocks servers' + show:'show information about an installed rock' + unpack:'unpack the contents of a rock' + upload:'upload a rockspec to the public rocks repository' + write_rockspec:'write a template for a rockspec file' + ) + _describe -t commands 'command' commands "$@" +} +local option_deps_modes='--deps-mode=[specify how to handle dependencies]:mode:__luarocks_deps_modes' +(( $+functions[__luarocks_deps_modes] )) || +__luarocks_deps_modes(){ + local modes=( + 'all:use all trees from the rocks_trees list for finding dependencies' + 'one:use only the current tree (possibly set with --tree)' + 'order:use trees based on order (use the current tree and all trees below it on the rocks_trees list)' + 'none:ignore dependencies altogether' + ) + _describe 'dependencies mode' modes +} +(( $+functions[__luarocks_rock_version] )) || +__luarocks_rock_version(){ + local i=2 + while [[ -n "${words[$i]}" ]]; do + if [[ ! "${words[$i]}" =~ '^-' ]]; then + case "$1" in + "external_or_local") + if [[ ! -f "${words[$i]}" ]]; then + _message -e "version for external rock ${words[$i]}" + return + else + _message -e "version for local rock ${words[$i]}" + fi + ;; + "installed") + # TODO: actually complete versions of installed rocks using the cache + # How does luarocks handles multiple versions of the same package? + # If anybody knows, please write something beautiful here + tree="$2" + if [[ -z "${tree}" ]]; then + _message -e "version for installed rock ${words[$i]}" + else + _message -e "version for installed rock ${words[$i]} on tree ${tree}" + fi + return + ;; + "new_version") + if [[ -f "${words[$i]}" ]]; then + _message -e "new version for rock ${words[$i]}" + return + fi + ;; + "new_rock") + _message -e "version for new rock ${words[$i]}" + return + ;; + esac + fi + i=$(( i + 1 )) + done +} +(( $+functions[__luarocks_lua_versions] )) || +__luarocks_lua_versions(){ + _values -s , 5.3 5.2 5.1 +} +(( $+functions[___luarocks_manually_store_cache_configs_paths] )) || +___luarocks_manually_store_cache_configs_paths(){ + user_config_path="$(_call_program user_config_path luarocks config --user-config)" + system_config_path="$(_call_program system_config_path luarocks config --system-config)" + { + print -r user_config_path=${(qq)user_config_path} + print -r system_config_path=${(qq)system_config_path} + } >! ${cache_dir}/luarocks_configs_paths +} +(( $+functions[___luarocks_manually_store_cache_configured_values] )) || +___luarocks_manually_store_cache_configured_values(){ + local default_trees=($(_call_program rock_trees luarocks config --rock-trees)) + # The following command usually gives somethins like this + # + # /home/me/.luarocks user + # /usr system + # + # We'll just use the 1st and 3rd elements in the array for the default trees + configured_user_tree="${default_trees[1]}" + configured_system_tree="${default_trees[3]}" + configured_lua_version="$(_call_program lua_ver luarocks config --lua-ver)" + { + print -r configured_lua_version=${(qq)configured_lua_version} + print -r configured_user_tree=${(qq)configured_user_tree} + print -r configured_system_tree=${(qq)configured_system_tree} + } >! ${cache_dir}/luarocks_configured_values +} +(( $+functions[___luarocks_installed_rocks_cache_policy] )) || +___luarocks_installed_rocks_cache_policy(){ + local cache_file="$1" + # Before checking the modification date of the manifests files vs the + # installed rocks cache files, we need to perform the following checks: + # - luarocks executable modification date vs modification date of cache file + # holding the default configuration files' locations + # ) if configuration files' locations were possibly changed, we need to: + # * set and cache the *possibly* new locations of the configuration files + # ) else: + # * retrieve from cache the configuration files' locations + # ) end if + # - configuration files' modification date vs modification date of cache file + # holding the values from `luarocks config --lua-ver` and `luarocks config + # --rock-trees` + # ) if the configuration files' locations were changed: + # * set and cache the values from the commands above + # ) else: + # ) if configuration files are newer: + # * set and cache the values from the commands above + # ) else: + # * retrive from cache the values of the commands above + # ) end if + # ) end if + + # Decide which directory to retrieve cache from, and ensure it exists + local cache_dir + zstyle -s ":completion:${curcontext}:" cache-path cache_dir + : ${cache_dir:=${ZDOTDIR:-$HOME}/.zcompcache} + if [[ ! -d "$cache_dir" ]]; then + [[ -e "$cache_dir" ]] && + _message "cache-dir ($cache_dir) isn't a directory\!" + fi + local where_luarocks="${commands[luarocks]}" + # luarocks_configured_values + local configured_lua_version configured_user_tree configured_system_tree + # luarocks_configs_paths + local user_config_path system_config_path + if [[ -e ${cache_dir}/luarocks_configs_paths ]]; then + if [[ ${where_luarocks} -nt ${cache_dir}/luarocks_configs_paths ]]; then + ___luarocks_manually_store_cache_configs_paths + else + . ${cache_dir}/luarocks_configs_paths + fi + else + ___luarocks_manually_store_cache_configs_paths + fi + if [[ -e ${cache_dir}/luarocks_configured_values ]]; then + if [[ ${user_config_path} -nt ${cache_dir}/luarocks_configured_values ]] || [[ ${system_config_path} -nt ${cache_dir}/luarocks_configured_values ]]; then + ___luarocks_manually_store_cache_configured_values + else + . ${cache_dir}/luarocks_configured_values + fi + else + ___luarocks_manually_store_cache_configured_values + fi + + local user_manifest_file="${configured_user_tree}/lib/luarocks/rocks-${configured_lua_version}/manifest" + local system_manifest_file="${configured_system_tree}/lib/luarocks/rocks-${configured_lua_version}/manifest" + local cache_status=1 + if [[ -f ${cache_file} ]]; then + if [[ -f ${user_manifest_file} ]]; then + if [[ ${user_manifest_file} -nt ${cache_file} ]]; then + cache_status=0 + fi + fi + if [[ -f ${system_manifest_file} ]]; then + if [[ ${system_manifest_file} -nt ${cache_file} ]]; then + cache_status=0 + fi + fi + fi + return cache_status +} +(( $+functions[__luarocks_installed_rocks] )) || +__luarocks_installed_rocks(){ + # This function optionally recieves one argument of the tree in which + # installed rocks are searched for. If this argument is used, the installed + # rocks which will be completed by this function will not use the cache which + # is valid only for installed rocks on default trees like /usr/lib/luarocks + # and ~/.luarocks + local tree="$1" + if [[ -z ${tree} ]]; then + local update_policy + zstyle -s ":completion:${curcontext}:" cache-policy update_policy + if [[ -z "$update_policy" ]]; then + zstyle ":completion:${curcontext}:" cache-policy ___luarocks_installed_rocks_cache_policy + fi + if _cache_invalid luarocks_installed_list; then + rocks_list=($(luarocks list --porcelain)) + _store_cache luarocks_installed_list rocks_list + else + _retrieve_cache luarocks_installed_list + fi + if [[ -z ${rocks_list} ]]; then + _message -r "no installed rocks" + return + fi + if _cache_invalid luarocks_installed_names; then + rocks_names=() + for i in {1.."${#rocks_list[@]}"..4}; do + rocks_names+=("${rocks_list[$i]}") + done + _store_cache luarocks_installed_names rocks_names + else + _retrieve_cache luarocks_installed_names + fi + if _cache_invalid luarocks_installed_versions; then + rocks_versions=() + for i in {2.."${#rocks_list[@]}"..4}; do + rocks_versions+=("${rocks_list[$i]}") + done + _store_cache luarocks_installed_versions rocks_versions + else + _retrieve_cache luarocks_installed_versions + fi + if _cache_invalid luarocks_installed_descriptions; then + rocks_descriptions=() + for i in {1.."${#rocks_names[@]}"}; do + name_version_description="$(luarocks show ${rocks_names[$i]} 2>/dev/null | head -2 | tail -1)" + total_length=${#name_version_description} + garbage_length="$((${#rocks_names[$i]} + ${#rocks_versions[$i]} + 5))" + description="${name_version_description[${garbage_length},${total_length}]}" + rocks_descriptions+=("${description}") + done + _store_cache luarocks_installed_descriptions rocks_descriptions + else + _retrieve_cache luarocks_installed_descriptions + fi + if _cache_invalid luarocks_installed_names_and_descriptions; then + rocks_names_and_descriptions=() + for i in {1.."${#rocks_names[@]}"}; do + name_and_description=${rocks_names[$i]}:${rocks_descriptions[$i]} + rocks_names_and_descriptions+=(${name_and_description}) + done + else + _store_cache luarocks_installed_names_and_descriptions rocks_names_and_descriptions + fi + else + rocks_list=($(luarocks --tree="${tree}" list --porcelain 2> /dev/null)) + if [[ -z ${rocks_list} ]]; then + _message "no installed rocks in the specified tree" + return + fi + rocks_names=() + for i in {1.."${#rocks_list[@]}"..4}; do + rocks_names+=("${rocks_list[$i]}") + done + rocks_versions=() + for i in {2.."${#rocks_list[@]}"..4}; do + rocks_versions+=("${rocks_list[$i]}") + done + rocks_descriptions=() + for i in {1.."${#rocks_names[@]}"}; do + name_version_description="$(luarocks show ${rocks_names[$i]} 2> /dev/null | head -2 | tail -1)" + total_length=${#name_version_description} + garbage_length="$((${#rocks_names[$i]} + ${#rocks_versions[$i]} + 5))" + description="${name_version_description[${garbage_length},${total_length}]}" + rocks_descriptions+=("${description}") + done + rocks_names_and_descriptions=() + for i in {1.."${#rocks_names[@]}"}; do + name_and_description=${rocks_names[$i]}:${rocks_descriptions[$i]} + rocks_names_and_descriptions+=(${name_and_description}) + done + fi + _describe 'installed rocks' rocks_names_and_descriptions +} +# Used to complete one or more of the followings: +# - .rockspec file +# - .src.rock file +# - external rock +(( $+functions[__luarocks_rock] )) || +__luarocks_rock(){ + local -a alts=() + while [[ $# -gt 0 ]]; do + arg="$1" + case "$arg" in + (rockspec) + alts+=('files:rock file:_files -g "*.rockspec(-.)"') + shift 1 + continue + ;; + (rockpack) + alts+=(':rock file:{_files -g "*.src.rock(-.)"}') + shift 1 + continue + ;; + (external) + alts+=(':external rock:') + shift 1 + continue + ;; + (installed) + tree="$2" + alts+=(":local rock:{__luarocks_installed_rocks ${tree}}") + if [[ -z "${tree}" ]]; then + shift + else + shift 2 + fi + continue + ;; + esac + shift + continue + done + _alternative ${alts[@]} +} +(( $+functions[__luarocks_git_tags] )) || +__luarocks_git_tags(){ + # Copied straight from definition of _git + local expl + declare -a tags + tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) + __git_command_successful $pipestatus || return 1 + _wanted tags expl tag compadd -M 'r:|/=**' "$@" -a - tags +} + +# End of options' arguments' helpers & Start of sub commands helpers + +# arguments: +# - must: .rockspec file / external rock +# - optional: version (only when chossing external rock) +local make_command_options=( + '--pack-binary-rock[produce a .rock file with the contents of compilation inside the current directory instead of installing it]' + '--keep[do not remove previously installed versions of the rock after building a new one]' + '--branch=[override the `source.branch` field in the loaded rockspec]:NAME:{_message "branch name"}' +) +local build_command_options=( + "${make_command_options[@]}" + '--only-deps[installs only the dependencies of the rock]' + $option_deps_modes +) +(( $+functions[_luarocks_build] )) || +_luarocks_build(){ + _arguments -A "-*" \ + "${build_command_options[@]}" \ + '1: :{__luarocks_rock "rockspec" "external"}' \ + '2:: :{__luarocks_rock_version "external_or_local"}' +} +# arguments: +# - must: option +local config_command_options=( + '--lua-incdir[path to Lua header files]' + '--lua-libdir[path to Lua library files]' + '--lua-ver[lua version (in major.minor format)]' + '--system-config[location of the system config file]' + '--user-config[location of the user config file]' + '--rock-trees[rocks trees in useFirst the user tree, then the system tree]' +) +(( $+functions[_luarocks_config] )) || +_luarocks_config(){ + _arguments "${config_command_options[@]}" +} +# arguments: +# - must: installed rock +local doc_command_options=( + '--home[open the home page of project]' + '--list[list documentation files only]' +) +(( $+functions[_luarocks_doc] )) || +_luarocks_doc(){ + _arguments \ + "${doc_command_options[@]}" \ + '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}' +} +# arguments: +# - must: external only rockspec +local download_command_options=( + '--all[download all files if there are multiple matches]' + '--source[download .src.rock if available]' + '--rockspec[download .rockspec if available]' + '--arch=[download rock for a specific architecture]:ARCH:' +) +(( $+functions[_luarocks_download] )) || +_luarocks_download(){ + _arguments -A "-*" \ + "${download_command_options[@]}" \ + '1: :{__luarocks_rock "external"}' \ + '2:: :{__luarocks_rock_version "external_or_local"}' +} +# arguments: +# must: luarocks sub command +(( $+functions[_luarocks_help] )) || +_luarocks_help(){ + _arguments '1: :__luarocks_command' +} +# arguments: +# - must: .rockspec file / external rock +# - optional: version +# NOTE: it receives the same argument as the build command and it accepts the same options as well +(( $+functions[_luarocks_install] )) || +_luarocks_install(){ + _luarocks_build +} +# arguments: +# - must: rockspec file (first and last) +(( $+functions[_luarocks_lint] )) || +_luarocks_lint(){ + _arguments '1:: :{__luarocks_rock "rockspec"}' +} +# arguments: +# NOTE: receives only options +local list_command_options=( + '--outdated[list only rocks for which there is a higher version available in the rocks server]' + '--porcelain[produce machine-friendly output]' +) +(( $+functions[_luarocks_list] )) || +_luarocks_list(){ + _arguments "${list_command_options[@]}" +} +# arguments: +# - optional: rockspec file +# NOTE: it's options were already described above. +(( $+functions[_luarocks_make] )) || +_luarocks_make(){ + _arguments '1:: :{__luarocks_rock "rockspec"}' +} +# arguments: +# - optional: .rockspec file / external rock +# - optional: version (unless a --tag was given) +# - optional: URL +local new_version_command_options=( + '--tag=[if no version is specified, this option'"'"'s argument is used instead]:tag:__luarocks_git_tags' +) +(( $+functions[_luarocks_new_version] )) || +_luarocks_new_version(){ + _arguments -A "-*" \ + "${new_version_command_options[@]}" \ + '1:: :{__luarocks_rock "external" "rockspec"}' \ + '2:: :{__luarocks_rock_version "external_or_local"}' \ + '3:: :_urls' +} +# arguments: +# - must: .rockspec file / external rock +# - optional: version +(( $+functions[_luarocks_pack] )) || +_luarocks_pack(){ + _luarocks_build +} +# arguments: +# NOTE: receives only options +local path_command_options=( + '--bin[adds the system path to the output]' + '--append[appends the paths to the existing paths]' + '--lr-path[exports the Lua path (not formatted as shell command)]' + '--lr-cpath[exports the Lua cpath (not formatted as shell command)]' + '--lr-bin[exports the system path (not formatted as shell command)]' +) +(( $+functions[_luarocks_path] )) || +_luarocks_path(){ + _arguments "${path_command_options[@]}" +} +# NOTE: receives only options yet --tree is mandatory +# NOTE: --force can be used only in conjunction with --old-versions +local option_force='--force[force removing old versions when]' +local purge_command_options=( + '--old-versions[keep the highest-numbered version of each rock and remove the other ones]' + $option_force +) +(( $+functions[_luarocks_purge] )) || +_luarocks_purge(){ + _arguments "${purge_command_options[@]}" +} +# arguments: +# - must: locally installed rock +# - optional: version +local option_force_fast='--force-fast[works like --force but doesn'"'"'t reports forced removals]' +local remove_command_options=( + $option_deps_modes + $option_force + $option_force_fast +) +(( $+functions[_luarocks_remove] )) || +_luarocks_remove(){ + _arguments -A "-*" \ + "${remove_command_options[@]}" \ + '1: :{__luarocks_rock "installed" '"${opt_args[--tree]}"'}' \ + '2:: :{__luarocks_rock_version "installed" '"${opt_args[--tree]}"'}' +} +# arguments: +# - must: string as a search query +local search_command_options=( + '--source[return only rockspecs and source rocks]' + '--binary[return only pure Lua and binary rocks (rocks that can be used with the "install" command without requiring a C toolchain)]' + '--all[list all contents of the server that are suitable to this platform, do not filter by name]' +) +(( $+functions[_luarocks_search] )) || +_luarocks_search(){ + _arguments \ + "${search_command_options[@]}" \ + '*:SEARCH QUERY:' +} +# arguments: +# - must: installed rock +local show_command_options=( + '--home[home page of project]' + '--modules[all modules provided by this package as used by require()]' + '--deps[packages this package depends on]' + '--rockspec[the full path of the rockspec file]' + '--mversion[the package version]' + '--rock-tree[local tree where rock is installed]' + '--rock-dir[data directory of the installed rock]' +) +(( $+functions[_luarocks_show] )) || +_luarocks_show(){ + _arguments \ + "${show_command_options[@]}" \ + "1: :{__luarocks_rock 'installed' "${opt_args[--tree]}"}" +} +# arguments: +# - must: rockpack file / external rock +# - optional: version (only when chossing external rock) +local unpack_command_options=( + '--force[unpack files even if the output directory already exists]' +) +(( $+functions[_luarocks_unpack] )) || +_luarocks_unpack(){ + _arguments \ + "${unpack_command_options[@]}" \ + '1: :{__luarocks_rock "rockpack" "external"}' +} +# arguments: +# - must: rockspec file +local upload_command_options=( + '--skip-pack[do not pack and send source rock]' + '--api-key=[give it an API key]:KEY:{_message "api key"}' + '--force[replace existing rockspec if the same revision of a module already exists]' +) +(( $+functions[_luarocks_upload] )) || +_luarocks_upload(){ + _arguments \ + "${upload_command_options[@]}" \ + '1: :{__luarocks_rock "rockspec"}' +} +# arguments: +# - optional: name +# - optional: version +# - optional: URL / PATH +# receives as an argument a name and a version with optionally a URL/PATH +local write_rockspec_command_options=( + '--output=[write the rockspec with the given filename]:FILE:_files' + '--license=[specify a license string]:license (e.g. "MIT/X11" or "GNU GPL v3")' + '--summary=[a short one-line description summary]:summary:{_message -e "short summary of the rock"}' + '--detailed=[a longer description string]:detailed_text:{_message -e "detailed description of the rock"}' + '--homepage=[project homepage]:URL:_urls' + '--lua-version=[supported Lua versions]:LUA_VER:__luarocks_lua_versions' + '--rockspec-format=[rockspec format version, such as "1.0" or "1.1"]:VER: ' + '--tag=[tag to use. Will attempt to extract version number from it]:tag:__git_tag' + '--lib=[comma separated list of C library files to link to]:library files' +) +(( $+functions[_luarocks_write_rockspec] )) || +_luarocks_write_rockspec(){ + _arguments -A "-*" \ + "${write_rockspec_command_options[@]}" \ + '1:: :{_message "new rock name"}' \ + '2:: :{__luarocks_rock_version "new_rock"}' \ + '3:: :_urls' +} + +# The real thing +_arguments -C \ + '(--server --only-server)--server=[fetch rocks/rockspecs from this server]:HOST:_hosts' \ + '(--server --only-server)--only-server=[fetch rocks/rockspecs from this server only]:HOST:_hosts' \ + '--only-sources=[restrict downloads to paths matching the given URL]:URL:_urls' \ + '--tree=[which tree to operate on]:TREE:{_files -/}' \ + '--local[use the tree in the user'"'"'s home directory]' \ + '--verbose[display verbose output of commands executed]' \ + '--timeout=[timeout on network operations]:SECONDS:{_message "timeout (seconds)"}' \ + '1: :__luarocks_command' \ + '*::arg:->args' + +case "$state" in + (args) + curcontext="${curcontext%:*:*}:luarocks-${words[1]}:" + if [[ $? != 1 ]]; then + _call_function ret _luarocks_${words[1]} + fi +esac -- cgit v1.2.3 From 9767ee88495d49df36b54b6fc58232ad76f8b020 Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 2 Jun 2018 17:15:48 -0500 Subject: 42918: adapt detection of GNU variant of ldd to work on Ubuntu --- ChangeLog | 5 +++++ Completion/Unix/Command/_ldd | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 314cfdc85..370d90b86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-06-09 Oliver Kiddle + + * 42918: dana: Completion/Unix/Command/_ldd: adapt detection of + GNU variant to work on Ubuntu + 2018-06-07 Oliver Kiddle * 42947: Doron Behar: Completion/Unix/Command/_luarocks: diff --git a/Completion/Unix/Command/_ldd b/Completion/Unix/Command/_ldd index 19b8a9105..1de1659a5 100644 --- a/Completion/Unix/Command/_ldd +++ b/Completion/Unix/Command/_ldd @@ -1,6 +1,6 @@ #compdef ldd -if _pick_variant gnu='(GNU|EGLIBC|Gentoo)' unix --version; then +if _pick_variant gnu='(Free Soft|GNU|EGLIBC|Gentoo)' unix --version; then args=( '(- *)--version[display version information]' '(- *)--help[display help information]' -- cgit v1.2.3 From e60620bc2f1392a938e945d2f09d9b8d8f9e11bc Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 2 Jun 2018 17:15:48 -0500 Subject: 42918: fix file completion for jq --- ChangeLog | 2 ++ Completion/Unix/Command/_jq | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 370d90b86..c9e49719b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2018-06-09 Oliver Kiddle + * 42918: dana: Completion/Unix/Command/_jq: fix file completion + * 42918: dana: Completion/Unix/Command/_ldd: adapt detection of GNU variant to work on Ubuntu diff --git a/Completion/Unix/Command/_jq b/Completion/Unix/Command/_jq index 55bb93c04..4ff05dab4 100644 --- a/Completion/Unix/Command/_jq +++ b/Completion/Unix/Command/_jq @@ -31,4 +31,4 @@ _arguments -S -s : \ '*--argjson[pre-set a variable to an object]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (JSON): ' \ '*--slurpfile[pre-set a variable to contents of a file]: :_guard "|[A-Za-z][A-Za-z0-9]#" "variable name":value (filename of file containing JSON):_files' \ "1: :_guard '|[^-]' filter" \ - "*:_files" + "*: :_files" -- cgit v1.2.3 From b5b3dde0a003df55b7711ea3ebb3c1ebd4d9c5a1 Mon Sep 17 00:00:00 2001 From: dana Date: Sat, 9 Jun 2018 00:15:59 -0500 Subject: 42965: add full completion for bash and update shell list in _sh --- ChangeLog | 3 ++ Completion/Unix/Command/_bash | 85 +++++++++++++++++++++++++++++++++++++++++++ Completion/Unix/Command/_sh | 2 +- 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 Completion/Unix/Command/_bash (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index bb166bf76..10a3ce566 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-09 Oliver Kiddle + * 42965: dana: Completion/Unix/Command/_bash, + Completion/Unix/Command/_sh: add full completion for bash + * 42964: Eitan Adler: Completion/BSD/Type/_fbsd_architectures: Update list of fbsd architectures diff --git a/Completion/Unix/Command/_bash b/Completion/Unix/Command/_bash new file mode 100644 index 000000000..260ca64fb --- /dev/null +++ b/Completion/Unix/Command/_bash @@ -0,0 +1,85 @@ +#compdef bash + +local ret=1 +local -a context line state state_descr args tmp cmd +local -A opt_args val_args + +cmd=( $words[1] --noprofile --norc ) + +args=( + # Long options must appear before short options (take care — some of these are + # duplicated in the s group below!) + + l + '!--debug' + '--debugger[enable extended debugging mode]' + '(-D --dump-po-strings --dump-strings)--dump-po-strings[like -D, but display in gettext PO format]' + '(-D --dump-po-strings --dump-strings)--dump-strings[display strings subject to language translation]' + '(: -)--help[display help information]' + # The usual = is deliberately omitted here + '(--init-file --rcfile)'{--init-file,--rcfile}'[load specified file instead of ~/.bashrc]: :_files' + '(-l --login)--login[act as login shell]' + '--noediting[disable readline editing]' + '--noprofile[do not load /etc/profile, ~/.bash_profile, etc.]' + '--norc[do not load ~/.bashrc]' + '--posix[enable POSIX mode]' + '(-r --restricted)--restricted[act as restricted shell]' + '(: -)--version[display version information]' + # This is ugly, but this way the + variants have accurate descriptions. Note + # that bash does accept + variants of -i, -l, -s, etc., but they don't seem to + # actually do anything, so we don't bother with them + + s + '(l)'{'-a[','+a[do not '}'mark all functions and variables for export]' + '(l)'{'-B[','+B[do not '}'enable brace expansion]' + '(l)'{'-b[','+b[do not '}'report status of terminated background jobs immediately]' + '(l)'{'-C[','+C[do not '}'prevent output redirection from overwriting existing files]' + '(l 1 -)-c[execute specified command string]:command string:_cmdstring:argv[0]:' + '(l)-D[display strings subject to language translation]' + '(l)'{'-E[','+E[do not '}'make functions and subshells inherit ERR traps]' + '(l)'{'-e[','+e[do not '}'exit immediately on non-zero return]' + '(l)'{'-f[','+f[do not '}'disable file globbing]' + '(l)'{'-H[','+H[do not '}'enable history substitution]' + '(l)'{'-h[','+h[do not '}'hash commands]' + '(l)-i[act as interactive shell]' + '(l)'{'-k[','+k[do not '}'act on variable assignments in command arguments]' + '(l)-l[act as login shell]' + '(l)'{'-m[','+m[do not '}'enable job control]' + '(l)'{'-n[','+n[do not '}'read (syntax-check) commands only]' + '(l)*'{'-O[','+O[un'}'set specified `shopt` option]: :->shopt-options' + '(l)*'{'-o[','+o[un'}'set specified `set` option]: :->set-options' + '(l)'{'-P[','+P[do not '}'resolve cd paths]' + '(l)'{'-p[','+p[do not '}'enable privileged mode]' + '(l)-r[act as restricted shell]' + '(l 1 -c)-s[read commands from standard input]' + '(l)'{'-T[','+T[do not '}'make functions and subshells inherit DEBUG and RETURN traps]' + '(l)'{'-t[','+t[do not '}'exit after executing one command]' + '(l)'{'-u[','+u[do not '}'treat unset variables as an error during parameter expansion]' + '(l)'{'-v[','+v[do not '}'print shell input lines as they are read]' + '(l)'{'-x[','+x[do not '}'print command trace]' + + o + '(-)1:script file:_files' + '(-)*:: :->args' +) + +_arguments -s -S -A '-*' : $args && ret=0 + +case $state in + args) + if [[ -n ${opt_args[(i)s--[cs]]} ]]; then + _files && ret=0 + else + _normal && ret=0 + fi + ;; + set-options) + tmp=( ${(f)"$( _call_program set-options ${(q-)cmd} -c '"shopt -o"' )"} ) + tmp=( ${tmp%%[[:space:]]*} ) + _values -w '`set` option' $tmp && ret=0 + ;; + shopt-options) + tmp=( ${(f)"$( _call_program shopt-options ${(q-)cmd} -c shopt )"} ) + tmp=( ${tmp%%[[:space:]]*} ) + _values -w '`shopt` option' $tmp && ret=0 + ;; +esac + +return ret diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh index 2afb46621..39d299c58 100644 --- a/Completion/Unix/Command/_sh +++ b/Completion/Unix/Command/_sh @@ -1,4 +1,4 @@ -#compdef sh ksh bash csh tcsh rc +#compdef sh ash csh dash ksh ksh88 ksh93 mksh oksh pdksh rc tcsh yash if (( CURRENT == ${words[(i)-c]} + 1 )); then _cmdstring -- cgit v1.2.3 From 0a4eb2d85d39ef951b229fc01f833cc5f4fbfe87 Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Sat, 9 Jun 2018 15:23:06 +0000 Subject: 42968: add "-c" for _shutdown completion on FreeBSD 12-current --- ChangeLog | 3 +++ Completion/Unix/Command/_shutdown | 5 +++++ 2 files changed, 8 insertions(+) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 10a3ce566..9bf441814 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-09 Oliver Kiddle + * 42968: Eitan Adler: Completion/Unix/Command/_shutdown: + add "-c" for _shutdown completion on FreeBSD 12-current + * 42965: dana: Completion/Unix/Command/_bash, Completion/Unix/Command/_sh: add full completion for bash diff --git a/Completion/Unix/Command/_shutdown b/Completion/Unix/Command/_shutdown index 4119502fb..a237b14e0 100644 --- a/Completion/Unix/Command/_shutdown +++ b/Completion/Unix/Command/_shutdown @@ -42,6 +42,11 @@ case $OSTYPE in args+=( '-o[execute halt or reboot instead of sending a signal to init]' ) + ;| + freebsd<12->.*) + args+=( + '-c[power cycle the system instead of halting if possible]' + ) ;; netbsd*) args+=( -- cgit v1.2.3 From c89d9cc8203457244fa323715444aa02c19e92af Mon Sep 17 00:00:00 2001 From: dana Date: Sun, 10 Jun 2018 01:06:22 -0500 Subject: 42977: Complete options to major man variants, otherwise improve especially section matching --- ChangeLog | 5 + Completion/Unix/Command/_man | 351 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 311 insertions(+), 45 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 9bf441814..8300435b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-06-10 Oliver Kiddle + + * 42977: dana: Completion/Unix/Command/_man: Complete options to + major man variants, otherwise improve especially section matching + 2018-06-09 Oliver Kiddle * 42968: Eitan Adler: Completion/Unix/Command/_shutdown: diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 67810e1dc..4cba9d625 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -1,16 +1,169 @@ #compdef man apropos whatis +# Notes: +# - Solaris is seemingly the only OS that doesn't allow the `man n page` syntax; +# you must use `man -s n page` +# - We assume that Linux distributions are using either man-db or mandoc +# - @todo Option exclusivity isn't super accurate +# - @todo Solaris man accepts a single hyphen as the first option to disable +# paging (like AIX's -c); we don't support that +# - @todo Linux apropos/whatis take options; we don't complete them yet + _man() { - local dirs expl mrd awk + local dirs expl mrd awk variant noinsert + local -a context line state state_descr args modes + local -aU sects + local -A opt_args val_args sect_descs - if (( $words[(I)-M] == (( $CURRENT - 1 )) )); then - _directories && return 0 - fi + if [[ $service == man ]]; then + # We'll treat all mandoc-based systems (Alpine, various Illumos distros, + # etc.) as OpenBSD + _pick_variant -r variant openbsd='-S subsection' $OSTYPE --- + + modes=( + -f -K -k -l -R -w -W + --apropos + --global-apropos + --local-file + --location + --location-cat + --recode + --whatis + --where + --where-cat + ) + [[ $variant == darwin* ]] && modes+=( -t ) + + args=( + "(${(j< >)modes})"{-f,--whatis}'[display short description (like whatis)]' + "(${(j< >)modes})"{-k,--apropos}'[search for keyword (like apropos)]' + '(-M --manpath)'{-M+,--manpath=}'[specify manual search path]:manual search path:_sequence -s\: _directories' + ) + if [[ $variant == (darwin|dragonfly|freebsd|linux)* ]]; then + args+=( + '(-a -S -s --all --sections)'{-a,--all}'[display all matching pages]' + '(-P --pager)'{-P+,--pager=}'[specify output pager]:pager:_path_commands' + # @todo Could enumerate these + '(-p --preprocessor)'{-p+,--preprocessor=}'[specify roff preprocessor sequence]:preprocessor sequence' + ) + else + args+=( '(-s)-a[display all matching pages]' ) + fi + [[ $variant == (aix|solaris)* ]] || args+=( + '(-C --config-file)'{-C+,--config-file=}'[specify configuration file]:configuration file:_files' + "(${(j< >)modes})"{-w,--path,--where}'[display file locations]' + ) + [[ $variant == (aix|netbsd|openbsd)* ]] || args+=( + # @todo FreeBSD allows this to be given multiple times + '(-d --debug)'{-d,--debug}'[display debugging information]' + ) + [[ $variant == (darwin|dragonfly|freebsd|linux|solaris|aix)* ]] && args+=( + '(-7 -H -t --ascii --html --troff)'{-t,--troff}'[format man page using troff]' + ) + [[ $variant == (darwin|linux)* ]] && args+=( + "(${(j< >)modes})"{-K,--global-apropos}'[search for keyword in all pages]' + '(-m --systems)'{-m+,--systems=}'[search manual of specified system]:operating system' + ) + [[ $variant == (darwin|dragonfly|freebsd)* ]] && args+=( + '(: -)-h[display help information]' + '(-a)-S+[specify manual sections to search]: :->sects' + ) + [[ $variant == (dragonfly|freebsd)* ]] && args+=( + # @todo Could enumerate these + '-m[search manual of specified architecture]:architecture' + '-o[use non-localized man pages]' + ) + [[ $variant == (netbsd|openbsd)* ]] && args+=( + '-c[disable paging]' + '-m[augment manual search path]:manual search path:_sequence -s\: _directories' + '(-a)-s+[specify manual section to search]: :->sects' + ) + [[ $variant == linux* ]] && args+=( + '(: -)'{-\?,--help}'[display help information]' + '(-7 -t -H -T -Z --ascii --html --troff --troff-device --ditroff)'{-7,--asci}'[translate man pages for 7-bit terminal]' + '(-D --default)'{-D,--default}'[reset man to default options]' + # @todo Could enumerate these + '(-E --encoding)'{-E+,--encoding=}'[specify output encoding]:encoding' + '(-e --extension)'{-e+,--extension=}'[specify sub-extension]:sub-extension' + '(-H --html)'{-H-,--html=-}'[produce HTML output for specified browser]::Web browser:_path_commands' + '(-i -I --ignore-case --match-case)'{-i,--ignore-case}'[search case-insensitively]' + '(-i -I --ignore-case --match-case)'{-I,--match-case}'[search case-sensitively]' + '(-L --locale)'{-L+,--locale=}'[specify locale]:locale:_locales' + "(${(j< >)modes})"{-l+,--local-file=}'[format and display specified file]:*:::manual file:_files' + "!(${(j< >)modes})"{--location,--location-cat} + '--names-only[match only page names (with --regex or --wildcard)]' + '(--nh --no-hyphenation)'{--nh,--no-hyphenation}'[disable hyphenation]' + '(--nj --no-justification)'{--nj,--no-justification}'[disable justification]' + '--no-subpages[do not combine pairs of page names into single page name]' + # @todo Could enumerate these + "(${(j< >)modes})"{-R+,--recode=}'[output man page in specified encoding]:encoding' + '(-r --prompt)'{-r+,--prompt=}'[specify prompt for less]:less prompt' + '(-a --all --wildcard)--regex[treat page name as regular expression]' + '(-a -S -s --all --sections)'{-S+,-s+,--sections=}'[specify manual sections to search]: :->sects' + # @todo Could enumerate these + '(-T -t --troff --troff-device)'{-T-,--troff-device=-}'[specify roff output device]::roff output device' + '(-u --update)'{-u,--update}'[update database caches]' + '(: -)--usage[display brief usage information]' + '(: -)'{-V,--version}'[display version information]' + "(${(j< >)modes})"{-W,--where-cat}'[display cat file locations]' + '--warnings=[enable specified groff warnings]:groff warnings' + '(-a --all --regex)--wildcard[treat page name as shell glob]' + # @todo Could enumerate these + '(-X --gxditview)'{-X-,--gxditview=-}'[display output in gxditview using specified DPI (default: 75)]::DPI' + # @todo Post-process how? + '(-t --troff -Z --ditroff)'{-Z,--ditroff}'[post-process output for chosen device]' + ) + [[ $variant == darwin* ]] && args+=( + # We use _files here because browsers are usually in /Applications, which + # typically isn't in PATH + '-B+[specify browser to use for HTML files]:Web browser:_files' + '-c[reformat source man page]' + # @todo -d should be exclusive with this above + '(-d)-D[display man page along with debugging information]' + '(-D -F --preformat)'{-F,--preformat}'[format man page only (do not display)]' + '-H+[specify command to render HTML as text]:HTML pager:_path_commands' + # --help and --version are undocumented but functional + '(: -)--help[display help information]' + # -s is also undocumented; it's provided for compatibility with Solaris + '!(-S)-s+: :->sects' + '(: -)'{-v,--version}'[display version information]' + "(${(j< >)modes})-W[display file locations, one per line, with no other information]" + ) + [[ $variant == netbsd* ]] && args+=( + '-h[display only synopsis lines]' + '(: -)-p[display manual search path]' + '-S+[display only man pages with file names matching specified string]:search string' + ) + [[ $variant == openbsd* ]] && args+=( + "(${(j< >)modes})-l+[format and display specified file]:*:::manual file:_files" + # @todo Could enumerate these + '-S[search manual of specified architecture]:architecture' + ) + [[ $variant == solaris* ]] && args+=( + "(${(j< >)modes})-l[display file locations]" + '-r[format man page only (do not display)]' + '(-a)-s+[specify manual sections to search]: :->sects' + # @todo Does this in fact want a file path? + '-T+[format man page using specified macro package]:macro package:_files' + ) + [[ $variant == aix* ]] && args+=( + '-c[display man page using cat]' + '-F[display only first matching entry]' + '-m[only search paths specified by -M/MANPATH]' + '-r[search remotely]' + ) - if [[ $service == man ]] && (( $words[(I)-l] + $words[(I)--local-file] )); then - _files || return 0 + # Strip (most) long options from non-Linux platforms + if [[ $variant == darwin* ]]; then + args=( ${(M)args:#((#s)|*\))(\*|)(-[^-]|--(help|path|pref|vers))*} ) + elif [[ $variant != linux* ]]; then + args=( ${(M)args:#((#s)|*\))(\*|)-[^-]*} ) + fi fi + _arguments -s -S : $args '*::: :->man' && return 0 + [[ -n $state ]] || return 1 + if (( ! $#_manpath )); then local mp mp=( ${(s.:.)$(manpath 2>/dev/null)} ) @@ -25,12 +178,14 @@ _man() { (( $#_manpath )) || _manpath=( /usr/man(-/) /(opt|usr)/(pkg|dt|share|X11R6|local)/(cat|)man(-/) ) - integer index=$words[(I)-M] - if (( index )); then - local opt - opt=$words[index+1] - _manpath=($opt) - fi + # Override man path + [[ -n ${opt_args[-M]} ]] && + _manpath=( ${(s<:>)opt_args[-M]} ) + + # Augment man path + [[ $variant == (netbsd|openbsd)* ]] && + [[ -n ${opt_args[-m]} ]] && + _manpath+=( ${(s<:>)opt_args[-m]} ) # `sman' is the SGML manual directory for Solaris 7. # 1M is system administrator commands on SVR4 @@ -44,52 +199,158 @@ _man() { # $sect_dirname is from the filesystem, the "3" in "/usr/share/man/man3" # These are used by _man_pages local sect sect_dirname - if [[ $OSTYPE = solaris* ]]; then - sect=${${words[(R)-s*]#-s}:-$words[$words[(i)-s]+1]} - sect="${sect//,/|}" - elif [[ -n ${sect:=$words[$words[(i)-S]+1]} || -n ${sect:=$MANSECT} ]]; then - sect="${sect//:/|}" - sect="${sect//,/|}" - elif (( CURRENT > 2 )); then - case $words[2] in - (-a) sect='*';; - (-*) ;; - (*) sect=$words[2];; - esac + + # Take care: We can't use the sections from these options until we've finished + # completing them; otherwise (e.g.) -s1: will give no results + if + [[ $service != man ]] || [[ $state == sects ]] || (( $+opt_args[-a] )) + then + sect='*' + elif + [[ $variant == (darwin|linux)* ]] && + [[ -n ${opt_args[(i)-S|-s|--sections]} ]] + then + noinsert=1 + sect=${opt_args[${opt_args[(i)-S|-s|--sections]}]//[:,]/|} + elif + [[ $variant == (netbsd|openbsd|solaris)* ]] && (( $+opt_args[-s] )) + then + noinsert=1 + sect=${opt_args[-s]//,/|} + elif [[ $variant == (dragonfly|freebsd)* ]] && (( $+opt_args[-S] )); then + noinsert=1 + sect=${opt_args[-S]//:/|} + elif (( CURRENT > 1 )) && [[ $variant != solaris* ]]; then + noinsert=1 + sect=$words[1] + elif [[ -n ${sect:=$MANSECT} ]]; then + sect=${sect//:/|} fi - if [[ $sect = (<->*|1M|l|n) || $sect = *\|* ]]; then - () { - local -a sects=( ${(s.|.)sect} ) - if [[ $sect != (l|n) ]]; then - sects=( ${sects%%[^0-9]#} ) - fi - dirs=( $^_manpath/(sman|man|cat)${^sects}*/ ) - } - if [[ $sect == *\|* ]]; then sect="($sect)"; fi + # Colons may have been escaped + sect=${(Q)sect} + + if [[ $sect = (<->*|[lnopx]) || $sect = *\|* ]]; then + sects=( ${(s.|.)sect} ) + dirs=( $^_manpath/(sman|man|cat)${^sects}/ ) + sect=${(j<|>)sects} + [[ $sect == *'|'* ]] && sect="($sect)" awk="\$2 == \"$sect\" {print \$1}" else + sect= dirs=( $^_manpath/(sman|man|cat)*/ ) awk='{print $1}' fi + + # Ignore directories with no pages inside + dirs=( ${^dirs}(#qFN) ) + # Solaris 11 and on have a man-index directory that doesn't contain manpages dirs=( ${dirs:#*/man-index/} ) - if [[ $OSTYPE = solaris* && ( $words[CURRENT] = -s* || $words[CURRENT-1] == -s ) ]]; then - [[ $words[CURRENT] = -s* ]] && compset -P '-s' - sects=( ${(o)${dirs##*(man|cat)}%/} ) - _wanted sections expl 'section' compadd -a sects - elif zstyle -t ":completion:${curcontext}:manuals" separate-sections; then - typeset -U sects - local ret=1 + sects=( ${(o)${dirs##*(man|cat)}%/} ) + + # If we've got this far, we can build our look-up table for descriptions of + # the more common sections. Unless otherwise labelled, the more specific ones + # come from Solaris or one of its variants + (( $#sects )) && () { + sect_descs=( + 0 'library headers' + 1 'general commands' + 1cups 'CUPS commands' + 1m 'maintenance commands' + 1openssl 'OpenSSL commands' + 2 'system calls' + 3 'library functions' + 3c 'C library functions' + 3curses 'curses library functions' + 3elf 'ELF library functions' + 3f 'Fortran library functions' + 3lua 'Lua features' # NetBSD + 3mail 'mailbox library functions' + 3openssl 'OpenSSL library functions' + 3pam 'PAM library functions' + 3pool 'pool configuration library functions' + 3proc 'process control library functions' + 3x11 'Xlib functions' + 3xcurses 'curses library functions [X/Open]' + 4 'devices and drivers' + 5 'file formats and conventions' + 3openssl 'OpenSSL configuration files' + 6 'games' + 7 'miscellanea' + 8 'maintenance commands and procedures' + 9 'kernel features' + 9lua 'Lua kernel bindings' # NetBSD + l 'local documentation' # AIX, etc. + n 'new documentation' # AIX, etc. + o 'old documentation' # AIX, etc. + p 'public documentation' # AIX, etc. + x 'X11 features' + ) + + # Add POSIX variants + for 1 in ${(k)sect_descs}; do + [[ $1 == <-> ]] || continue + sect_descs+=( "${1}p" "${sect_descs[$1]} [POSIX]" ) + done + + # Add OS-specific stuff that's too risky for or overrides the general list + [[ $OSTYPE == darwin* ]] && sect_descs+=( n 'Tcl/Tk features' ) + [[ $OSTYPE == openbsd* ]] && sect_descs+=( 3p 'Perl features' ) + [[ $OSTYPE == solaris* ]] && sect_descs+=( + 1t 'Tcl/Tk features' + 3m 'mathematical library functions' + 4 'file formats and conventions' + 5 'miscellanea' + 7 'special files' + 7d 'devices' + 7fs 'file systems' + 7i 'ioctl requests' + 7m 'STREAMS modules' + 7p 'protocols' + 9e 'driver entry points' + 9f 'driver functions' + 9p 'driver properties' + 9s 'driver data structures' + ) + } - sects=( ${(o)${dirs##*(man|cat)}%/} ) + [[ $state == sects ]] && { + local s + local -a specs + + (( $#sects )) || { + _message 'manual section' + return 1 + } + + # Build specs from descriptions + for s in $sects; do + specs+=( "${s}[${(b)sect_descs[$s]}]" ) + done + + if [[ $variant == (darwin|dragonfly|freebsd|linux)* ]]; then + _values -s : 'manual section' $specs + elif [[ $variant == solaris* ]]; then + _values -s , 'manual section' $specs + else + _values 'manual section' $specs + fi + return + } + + if zstyle -t ":completion:${curcontext}:manuals" separate-sections; then + local d ret=1 (( $#sects )) || return 1 _tags manuals.${^sects} while _tags; do for sect_dirname in $sects; do - _requested manuals.$sect_dirname expl "manual page, section $sect_dirname" _man_pages && + d=$sect_dirname + (( $+sect_descs[$d] )) && d+=" (${sect_descs[$d]})" + + _requested manuals.$sect_dirname expl "manual page, section $d" _man_pages && ret=0 done (( ret )) || return 0 @@ -113,7 +374,7 @@ _man_pages() { local pages sopt # What files corresponding to manual pages can end in. - local suf='.((?|<->*)(|.gz|.bz2|.Z|.lzma))' + local suf='.((?|<->*|ntcl)(|.gz|.bz2|.Z|.lzma))' if [[ $PREFIX$SUFFIX = */* ]]; then # Easy way to test for versions of man that allow file names. @@ -138,8 +399,8 @@ _man_pages() { # beginning with .<->: that handles problem cases like files called # `POSIX.1.5'. - [[ $OSTYPE = solaris* ]] && sopt='-s ' - if ((CURRENT > 2)) || + [[ $variant = solaris* ]] && sopt='-s ' + if ((CURRENT > 1 || noinsert)) || ! zstyle -t ":completion:${curcontext}:manuals.$sect_dirname" insert-sections then compadd "$@" - ${pages%$~suf} -- cgit v1.2.3 From 684db0f9fee126fc51315b621d602b4791b674fb Mon Sep 17 00:00:00 2001 From: dana Date: Mon, 11 Jun 2018 16:52:38 -0500 Subject: 42983: Address misc. feedback re: _man --- ChangeLog | 4 +++- Completion/Unix/Command/_man | 22 ++++++++++++++-------- 2 files changed, 17 insertions(+), 9 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 367d90c23..b0cb2b35d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,9 @@ 2018-06-11 dana + * 42983: dana: Completion/Unix/Command/_man: Address misc. feedback + * 42984: dana: Completion/Unix/Type/_files, - Completion/Unix/Type/_object_files: fix argument pass-through to compadd + Completion/Unix/Type/_object_files: Fix argument pass-through to compadd 2018-06-10 Oliver Kiddle diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 4cba9d625..11c2fab7f 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -109,7 +109,7 @@ _man() { '--warnings=[enable specified groff warnings]:groff warnings' '(-a --all --regex)--wildcard[treat page name as shell glob]' # @todo Could enumerate these - '(-X --gxditview)'{-X-,--gxditview=-}'[display output in gxditview using specified DPI (default: 75)]::DPI' + '(-X --gxditview)'{-X-,--gxditview=-}'[display output in gxditview using specified DPI]::resolution (DPI) [75]' # @todo Post-process how? '(-t --troff -Z --ditroff)'{-Z,--ditroff}'[post-process output for chosen device]' ) @@ -232,7 +232,7 @@ _man() { if [[ $sect = (<->*|[lnopx]) || $sect = *\|* ]]; then sects=( ${(s.|.)sect} ) - dirs=( $^_manpath/(sman|man|cat)${^sects}/ ) + dirs=( $^_manpath/(sman|man|cat)${^sects}(|.*)/ ) sect=${(j<|>)sects} [[ $sect == *'|'* ]] && sect="($sect)" awk="\$2 == \"$sect\" {print \$1}" @@ -247,7 +247,7 @@ _man() { # Solaris 11 and on have a man-index directory that doesn't contain manpages dirs=( ${dirs:#*/man-index/} ) - sects=( ${(o)${dirs##*(man|cat)}%/} ) + sects=( ${(o)${${dirs##*(man|cat)}%.*}%/} ) # If we've got this far, we can build our look-up table for descriptions of # the more common sections. Unless otherwise labelled, the more specific ones @@ -297,6 +297,11 @@ _man() { # Add OS-specific stuff that's too risky for or overrides the general list [[ $OSTYPE == darwin* ]] && sect_descs+=( n 'Tcl/Tk features' ) [[ $OSTYPE == openbsd* ]] && sect_descs+=( 3p 'Perl features' ) + # @todo Oracle Solaris 11.4 adopts the BSD/Linux structure, making many of + # these inaccurate — this should be handled accordingly in the future. If + # OSTYPE isn't helpful (since other Solaris descendants may not follow + # suit), we could perhaps use the presence of SysV-style sections under + # _manpath as the determinant [[ $OSTYPE == solaris* ]] && sect_descs+=( 1t 'Tcl/Tk features' 3m 'mathematical library functions' @@ -320,21 +325,22 @@ _man() { local -a specs (( $#sects )) || { - _message 'manual section' + _message -e sections 'manual section' return 1 } # Build specs from descriptions for s in $sects; do - specs+=( "${s}[${(b)sect_descs[$s]}]" ) + specs+=( "${s}:${(b)sect_descs[$s]}" ) done + specs=( ${specs%:} ) if [[ $variant == (darwin|dragonfly|freebsd|linux)* ]]; then - _values -s : 'manual section' $specs + _sequence -s : _describe -t sections 'manual section' specs elif [[ $variant == solaris* ]]; then - _values -s , 'manual section' $specs + _sequence -s , _describe -t sections 'manual section' specs else - _values 'manual section' $specs + _describe -t sections 'manual section' specs fi return } -- cgit v1.2.3 From d1eb0f4ed13688bddfd875c2a3b70a2cbe9b0854 Mon Sep 17 00:00:00 2001 From: dana Date: Wed, 13 Jun 2018 18:59:05 -0500 Subject: 42992: Fix minor escaping bug in _bash --- ChangeLog | 2 ++ Completion/Unix/Command/_bash | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 99fb7494d..6c9172b77 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2018-06-13 dana + * 42992: Completion/Unix/Command/_bash: Fix minor escaping bug + * 42992: Completion/Darwin/Command/_nvram, Completion/Darwin/Command/_osascript, Completion/Darwin/Command/_say, Completion/Darwin/Command/_scselect: Use _call_program to fetch argument diff --git a/Completion/Unix/Command/_bash b/Completion/Unix/Command/_bash index 260ca64fb..cc219f788 100644 --- a/Completion/Unix/Command/_bash +++ b/Completion/Unix/Command/_bash @@ -71,12 +71,12 @@ case $state in fi ;; set-options) - tmp=( ${(f)"$( _call_program set-options ${(q-)cmd} -c '"shopt -o"' )"} ) + tmp=( ${(f)"$( _call_program set-options $cmd -c '"shopt -o"' )"} ) tmp=( ${tmp%%[[:space:]]*} ) _values -w '`set` option' $tmp && ret=0 ;; shopt-options) - tmp=( ${(f)"$( _call_program shopt-options ${(q-)cmd} -c shopt )"} ) + tmp=( ${(f)"$( _call_program shopt-options $cmd -c shopt )"} ) tmp=( ${tmp%%[[:space:]]*} ) _values -w '`shopt` option' $tmp && ret=0 ;; -- cgit v1.2.3 From d5360e324c1e4ff0c3a38ba318124435676d7610 Mon Sep 17 00:00:00 2001 From: Matthew Martin Date: Fri, 15 Jun 2018 14:12:12 -0500 Subject: 42981: Add ed completer --- ChangeLog | 4 ++++ Completion/Unix/Command/_ed | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 Completion/Unix/Command/_ed (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 4c8ff2f41..074a7f4b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-06-15 Matthew Martin + + * 42981: Completion/Unix/Command/_ed: Add ed completer + 2018-06-15 Peter Stephenson * users/23472: Doc/Zsh/mod_system.yo, Src/Modules/system.c, diff --git a/Completion/Unix/Command/_ed b/Completion/Unix/Command/_ed new file mode 100644 index 000000000..50d2710fc --- /dev/null +++ b/Completion/Unix/Command/_ed @@ -0,0 +1,38 @@ +#compdef ed + +local -a args + +args=( + '(-p --prompt)'{-p+,--prompt=}'[specify prompt]:prompt:' + '(-s --quiet --silent)'{-s,--quiet,--silent}'[suppress diagnostics]' +) + +if _pick_variant gnu=GNU unix --version; then + args+=( + '(-G --traditional)'{-G,--traditional}'[run in compatibility mode]' + '(- :)'{-h,--help}'[display help]' + '(-l --loose-exit-status)'{-l,--loose-exit-status}'[exit 0 even if a command fails]' + '(-r --restricted)'{-r,--restricted}'[run in restricted mode]' + '(- :)'{-V,--version}'[display version]' + '(-v --verbose)'{-v,--verbose}'[be verbose]' + ) +else + args=(-A '-*' ${args:#*\)--*}) + case $OSTYPE in + dragonfly*|freebsd*|netbsd*|solaris*) + args+=( + '-x[prompt for an encryption key]' + ) + ;| + netbsd*) + args+=( + '-E[enable extended regular expressions]' + '-S[disable ! command]' + ) + ;; + esac +fi + +_arguments -s -S \ + $args \ + ':file:_files' -- cgit v1.2.3 From 0cac4b63e0fdfc5673482e9515913299eb205e8a Mon Sep 17 00:00:00 2001 From: dana Date: Fri, 15 Jun 2018 22:03:30 -0500 Subject: 43024: Improve _man section-name matching --- ChangeLog | 4 ++++ Completion/Unix/Command/_man | 43 +++++++++++++++++++++++++++++++++++++------ 2 files changed, 41 insertions(+), 6 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 074a7f4b5..06a564195 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2018-06-15 dana + + * 43024: Completion/Unix/Command/_man: Improve section-name matching + 2018-06-15 Matthew Martin * 42981: Completion/Unix/Command/_ed: Add ed completer diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man index 11c2fab7f..7fd92bac5 100644 --- a/Completion/Unix/Command/_man +++ b/Completion/Unix/Command/_man @@ -4,6 +4,11 @@ # - Solaris is seemingly the only OS that doesn't allow the `man n page` syntax; # you must use `man -s n page` # - We assume that Linux distributions are using either man-db or mandoc +# - @todo Would be nice to support completing the initial operand as a section +# name (on non-Solaris systems) +# - @todo We don't support the man-db syntax .
(e.g., `ls.1`) +# - @todo We don't support the man-db feature of 'sub-pages' — that is, treating +# pairs of operands like `git diff` as `git-diff` # - @todo Option exclusivity isn't super accurate # - @todo Solaris man accepts a single hyphen as the first option to disable # paging (like AIX's -c); we don't support that @@ -220,7 +225,15 @@ _man() { elif [[ $variant == (dragonfly|freebsd)* ]] && (( $+opt_args[-S] )); then noinsert=1 sect=${opt_args[-S]//:/|} - elif (( CURRENT > 1 )) && [[ $variant != solaris* ]]; then + # It's only a small help, but, per man-db, we can avoid treating an initial + # operand like `8139too` as a section name by ensuring that only the first + # character is a digit. This doesn't do much for stuff like `2to3`, but we can + # at least special-case a few common patterns for now + elif + (( CURRENT > 1 )) && + [[ $variant != solaris* ]] && + [[ ${${(Q)words[1]}##(2to3|7z)*} == ([0-9](|[^0-9[:punct:]]*)|[lnopx]) ]] + then noinsert=1 sect=$words[1] elif [[ -n ${sect:=$MANSECT} ]]; then @@ -232,7 +245,25 @@ _man() { if [[ $sect = (<->*|[lnopx]) || $sect = *\|* ]]; then sects=( ${(s.|.)sect} ) - dirs=( $^_manpath/(sman|man|cat)${^sects}(|.*)/ ) + + # Most man implementations support partial matching of a page's + # (sub-)section name — e.g., `3per` for `3perl`. The (sub-)section name may + # or may not correspond to the directory name (most systems combine + # sub-sections), but we'll assume that if it starts with a number and we're + # not on Solaris (which doesn't support this feature at all) that we can do + # a match against the leading number. This is irritating if you DO want the + # exact sub-section specified, but unfortunately there's no way to determine + # this programmatically — i guess we could add a style to control it + () { + for 1; do + if [[ $OSTYPE == solaris* || $1 != <->* ]]; then + dirs+=( $^_manpath/(sman|man|cat)$1(|.*)/ ) + else + dirs+=( $^_manpath/(sman|man|cat)${1%%[^0-9]#}*/ ) + fi + done + } $sects + sect=${(j<|>)sects} [[ $sect == *'|'* ]] && sect="($sect)" awk="\$2 == \"$sect\" {print \$1}" @@ -281,7 +312,7 @@ _man() { 8 'maintenance commands and procedures' 9 'kernel features' 9lua 'Lua kernel bindings' # NetBSD - l 'local documentation' # AIX, etc. + l 'local documentation' # AIX, etc. — TCL on some systems? n 'new documentation' # AIX, etc. o 'old documentation' # AIX, etc. p 'public documentation' # AIX, etc. @@ -380,14 +411,14 @@ _man_pages() { local pages sopt # What files corresponding to manual pages can end in. - local suf='.((?|<->*|ntcl)(|.gz|.bz2|.Z|.lzma))' + local suf='.((?|<->*|ntcl)(|.gz|.bz2|.z|.Z|.lzma))' if [[ $PREFIX$SUFFIX = */* ]]; then # Easy way to test for versions of man that allow file names. # This can't be a normal man page reference. # Try to complete by glob first. if [[ -n $sect_dirname ]]; then - _path_files -g "*.*$sect_dirname*(|.gz|.bz2|.Z|.lzma)" "$expl[@]" + _path_files -g "*.*$sect_dirname*(|.gz|.bz2|.z|.Z|.lzma)" "$expl[@]" else _path_files -g "*$suf" "$expl[@]" && return _path_files "$expl[@]" @@ -396,7 +427,7 @@ _man_pages() { fi pages=( ${(M)dirs:#*$sect_dirname/} ) - pages=( ${^pages}/"*$sect${sect:+"*"}" ); + pages=( ${^pages}/"*${sect:+.$sect"*"}" ) pages=( ${^~pages}(N:t) ) (($#mrd)) && pages[$#pages+1]=($(awk $awk $mrd)) -- cgit v1.2.3 From ed2f4d684015cb160755b007f0df119ceb6ff6fb Mon Sep 17 00:00:00 2001 From: dana Date: Sun, 17 Jun 2018 20:38:15 -0500 Subject: 43043: Improve comm/sed completion --- ChangeLog | 3 +++ Completion/Unix/Command/_comm | 9 ++++++--- Completion/Unix/Command/_sed | 21 ++++++++++++--------- 3 files changed, 21 insertions(+), 12 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 5b2d40ce1..b48742319 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-17 dana + * 43043: Completion/Unix/Command/_comm, + Completion/Unix/Command/_sed: Improve comm/sed completion + * 43039: Src/Modules/parameter.mdd: Mark functions_source (et al.) for auto-loading diff --git a/Completion/Unix/Command/_comm b/Completion/Unix/Command/_comm index d1d835f6a..f8c535a44 100644 --- a/Completion/Unix/Command/_comm +++ b/Completion/Unix/Command/_comm @@ -1,6 +1,6 @@ #compdef comm gcomm -local -a args +local -a args aopts=( -A '-*' ) args=( '-1[suppress lines unique to first file]' @@ -11,10 +11,13 @@ args=( ) if _pick_variant gnu=GNU unix --version; then + aopts=( ) args+=( '(--nocheck-order)--check-order[check input is correctly sorted]' "(--check-order)--nocheck-order[don't check input is correctly sorted]" - '--output-delimiter=:delimiter' + '--output-delimiter=[specify column delimiter]:delimiter' + '--total[display summary]' + '(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line delimiter]' '(- : *)--version[display version information]' '(- : *)--help[display help information]' ) @@ -24,4 +27,4 @@ elif [[ $OSTYPE = (openbsd|netbsd)* ]]; then args+=( '-f[case insensitive comparison of lines]' ) fi -_arguments -s $args +_arguments -s -S $aopts : $args diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index 15b92a634..80218051b 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -1,11 +1,12 @@ #compdef sed gsed psed s2p -local args inplace extended +local inplace extended +local -a args aopts=( -A '-*' ) args=( '(-n --quiet --silent)'{-n,--quiet,--silent}'[suppress automatic printing of pattern space]' - '(1)*'{-e,--expression=-}'[specify sed commands to run]:sed script' - '(1)*'{-f,--file=-}'[add contents of file to commands to run]:file:_files' + '(1)*'{-e+,--expression=}'[specify sed commands to run]:sed script' + '(1)*'{-f+,--file=}'[add contents of file to commands to run]: :_files' '(-e)1: :_guard "^-*" sed script' '*:input file:_files' ) @@ -18,11 +19,12 @@ if [[ $service = (psed|s2p) ]]; then '-a[delay opening files listed with w function]' ) elif _pick_variant gnu=GNU unix --version; then + aopts=( ) args+=( '--follow-symlinks[follow symlinks when processing in place]' - '(-i --in-place)'{-i-,--in-place=-}$inplace + '(-i --in-place)'{-i+,--in-place=}$inplace '(-c --copy)'{-c,--copy}'[copy instead of rename when shuffling files in in-place mode]' - '(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]' + '(-l --line-length)'{-l+,--line-length=}'[specify line-wrap length for the l command]' '(-r)--posix[disable GNU extensions]' '(-E -r --regexp-extended)'{-E,-r,--regexp-extended}$extended '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]' @@ -37,20 +39,21 @@ else case $OSTYPE in openbsd*|freebsd*|netbsd*|darwin*|dragonfly*) args+=( - '(-r -E)'{-r,-E}$extended + '(-r -E)'-E$extended '-a[delay opening files listed with w function]' ) ;| - darwin*|freebsd*|netbsd*|openbsd*) args+=( '-i'$inplace ) ;| + openbsd*|freebsd*|netbsd*|dragonfly*) args+=( '(-r -E)'-r$extended ) ;| + darwin*|freebsd*|netbsd*|openbsd*) args+=( '-i+'$inplace ) ;| darwin*|freebsd*|netbsd*) args+=( '-l[make output line buffered]' ) ;| freebsd*) args+=( '-u[disable data buffering]' ) ;| freebsd*|netbsd*) args+=( - '-I[edit files in-place, treating all files as a single input stream]::suffix for backup' + '-I+[edit files in-place, treating all files as a single input stream]::suffix for backup' ) ;; openbsd*) args+=( '-u[make output line buffered]' ) ;; esac fi -_arguments -s "$args[@]" +_arguments -s -S $aopts : "$args[@]" -- cgit v1.2.3 From 810b5c8ab99340fc0cf4c224697d1d069ab3d90b Mon Sep 17 00:00:00 2001 From: Eitan Adler Date: Mon, 18 Jun 2018 05:14:46 +0000 Subject: 43048: add sanitizers, standards aliases and fix -flto --- ChangeLog | 5 +++++ Completion/Unix/Command/_gcc | 22 ++++++++++++++++++---- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index b48742319..6956e569b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-06-18 Oliver Kiddle + + * 43048: Eitan: Completion/Unix/Command/_gcc: add sanitizers, + standards aliases and fix -flto + 2018-06-17 dana * 43043: Completion/Unix/Command/_comm, diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc index a552bb2db..9690df79f 100644 --- a/Completion/Unix/Command/_gcc +++ b/Completion/Unix/Command/_gcc @@ -338,16 +338,31 @@ h8/300) ;; esac +local -a sanitizers if [[ "$service" = clang* ]]; then args=( $args - -flto -emit-llvm + "-flto=-[generate output files suitable for link time optimization]::style:(full thin)" + -emit-llvm "-Qunused-arguments[don't emit warning for unused driver arguments]" --analyze -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info -fprint-source-range-info -fdiagnostics-show-option -fmessage-length ) + sanitizers=( + address alignment bool bounds enum float-cast-overflow float-divide-by-zero + integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign + nullability-return object-size pointer-overflow return unsigned-integer-overflow + returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr + ) +else + args=( + '-flto=-[Enable link-time optimization]::jobs:' + ) + sanitizers=( + address memory + ) fi local -a languages @@ -399,7 +414,7 @@ args+=( '-print-file-name=-[Display the full path to library ]:library:->library' '-print-prog-name=-[Display the full path to compiler component ]:program:' '*-specs=-[Override built-in specs with the contents of ]:file:_files' - '-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 c++17 gnu++17 c++2a gnu++2a)' + '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899:1990 iso9899:199409 c99 iso9899:1999 c11 iso9899:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899:2017 gnu++17 c++2a gnu++2a)' '*-include:include file:_files -g \*.h\(-.\)' '*-imacros:macro input file:_files -g \*.h\(-.\)' '*-idirafter:second include path directory:_files -/' @@ -1034,7 +1049,6 @@ args+=( '-flto-odr-type-merging[Merge C++ types using One Definition Rule]' '-flto-partition=-[Partition symbols and vars at linktime based on object files they originate from]:partitioning algorithm:(1to1 balanced max one none)' '-flto-report[Report various link-time optimization statistics]' - '-flto=-[Enable link-time optimization]::jobs:' '-fmax-errors=-[Maximum number of errors to report]:errors: ' '-fmem-report-wpa[Report on permanent memory allocation in WPA only]' '-fmem-report[Report on permanent memory allocation]' @@ -1061,7 +1075,7 @@ args+=( '-freciprocal-math[Same as -fassociative-math for expressions which include division]' '-frecord-gcc-switches[Record gcc command line switches in the object file]' '-free[Turn on Redundant Extensions Elimination pass]' - '-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:(address thread)' + "-fsanitize=-[Enable AddressSanitizer, a memory error detector]:style:($sanitizers)" '-fsched-stalled-insns-dep=-[Set dependence distance checking in premature scheduling of queued insns]:instructions: ' '-fsched-stalled-insns=-[Set number of queued insns that can be prematurely scheduled]:instructions: ' '-fsched-verbose=-[Set the verbosity level of the scheduler]:verbosity: ' -- cgit v1.2.3 From 4dddf3aa6e446cef6e0ea720aa20bcf71d6107b1 Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Mon, 18 Jun 2018 09:19:26 +0200 Subject: users/23484: be consistent on matcher specs for git branches to fix issue with partial matching --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 12 ++++++------ 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 6956e569b..88b9aa6e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-18 Oliver Kiddle + * users/23484: Completion/Unix/Command/_git: be consistent on + matcher specs for branches to fix issue with partial matching + * 43048: Eitan: Completion/Unix/Command/_gcc: add sanitizers, standards aliases and fix -flto diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 21ba65724..254086473 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -5615,7 +5615,7 @@ __git_describe_branch () { (( $+functions[__git_describe_commit] )) || __git_describe_commit () { - __git_describe_branch $1 $2 $3 -M 'r:|/=**' "${(@)argv[4,-1]}" + __git_describe_branch $1 $2 $3 -M 'r:|/=* r:|=*' "${(@)argv[4,-1]}" } # Completion Wrappers @@ -6532,7 +6532,7 @@ __git_recent_commits () { expl=() _wanted commit-tags expl 'commit tag' compadd "$@" -a - tags && ret=0 expl=() - _wanted heads expl 'head' compadd "$@" -a - heads && ret=0 + _wanted heads expl 'head' compadd -M "r:|/=* r:|=*" "$@" -a - heads && ret=0 return $ret } @@ -6657,7 +6657,7 @@ __git_tags () { tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted tags expl tag compadd -M 'r:|/=**' "$@" -a - tags + _wanted tags expl tag compadd -M 'r:|/=* r:|=*' "$@" -a - tags } (( $+functions[__git_commit_tags] )) || @@ -6680,7 +6680,7 @@ __git_tags_of_type () { tags=(${${(M)${(f)"$(_call_program ${(q)type}-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/}) __git_command_successful $pipestatus || return 1 - _wanted $type-tags expl "$type tag" compadd -M 'r:|/=**' "$@" -a - tags + _wanted $type-tags expl "$type tag" compadd -M 'r:|/=* r:|=*' "$@" -a - tags } # Reference Argument Types @@ -6703,7 +6703,7 @@ __git_references () { _git_refs_cache_pwd=$PWD fi - _wanted references expl 'reference' compadd -M 'r:|/=**' -a - _git_refs_cache + _wanted references expl 'reference' compadd -M 'r:|/=* r:|=*' -a - _git_refs_cache } # ### currently unused; are some callers of __git_references supposed to call this function? @@ -6717,7 +6717,7 @@ __git_local_references () { _git_local_refs_cache_pwd=$PWD fi - _wanted references expl 'reference' compadd -M 'r:|/=**' -a - _git_local_refs_cache + _wanted references expl 'reference' compadd -M 'r:|/=* r:|=*' -a - _git_local_refs_cache } (( $+functions[__git_remote_references] )) || -- cgit v1.2.3 From 25e9590e09db9067dc9c38b213893920a66fb2ae Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Wed, 13 Jun 2018 12:48:59 -0600 Subject: 43006: complete modified files after `git stash --` --- ChangeLog | 3 +++ Completion/Unix/Command/_git | 3 +++ 2 files changed, 6 insertions(+) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 88b9aa6e4..ede97e7c4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2018-06-18 Oliver Kiddle + * 43006: Tim Smith: Completion/Unix/Command/_git: complete + modified files after `git stash --` + * users/23484: Completion/Unix/Command/_git: be consistent on matcher specs for branches to fix issue with partial matching diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index 254086473..b92a320df 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -1694,6 +1694,9 @@ _git-stash () { '(-m --message)'{-m,--message}'[specify stash description]' \ ':: :__git_modified_files' && ret=0 ;; + (--) + __git_modified_files + ;; (list) local -a log_options revision_options __git_setup_log_options -- cgit v1.2.3 From 8dd8bd43e6823e77a4a0ba9ccf83c89b7cdec04a Mon Sep 17 00:00:00 2001 From: dana Date: Mon, 18 Jun 2018 17:54:22 -0500 Subject: 43047: Add completion for hostname --- ChangeLog | 2 ++ Completion/Unix/Command/_hostname | 76 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+) create mode 100644 Completion/Unix/Command/_hostname (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 1b9e15063..9b80a023c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2018-06-18 dana + * 43047: Completion/Unix/Command/_hostname: Add hostname completion + * 43047: Completion/Unix/Type/_bind_addresses: Always return local IPs 2018-06-18 Peter Stephenson diff --git a/Completion/Unix/Command/_hostname b/Completion/Unix/Command/_hostname new file mode 100644 index 000000000..40a3189ae --- /dev/null +++ b/Completion/Unix/Command/_hostname @@ -0,0 +1,76 @@ +#compdef hostname + +local variant=$OSTYPE ret=1 +local -a context line state state_descr args aopts=( -A '-*' ) +local -A opt_args + +# May be overridden below +args=( '(-4 -6 -d -f -i -r -s)1: :_guard "^-*" "host name"' ) + +# On badly behaved systems it may be dangerous to call `hostname --help` or +# similar, so for now we'll avoid _pick_variant and just trust this. In the +# future, we should replace this by a method that can safely detect Solaris, +# BusyBox, etc. (@todo) +[[ $OSTYPE == linux* ]] && +(( $+commands[nisdomainname] || $+commands[ypdomainname] )) && +variant+=-net-tools + +case $variant in + *-net-tools) + aopts=( ) + args=( + '(: * -)'{-h,--help}'[display help information]' + '(: * -)'{-V,--version}'[display version information]' + + '(g)' # Get + '(: gs s)'{-A,--all-fqdns}'[display FQDNs resolved from network interface addresses]' + '(: gs s)'{-d,--domain}'[display DNS domain only]' + '(: gs s)'{-f,--fqdn,--long}'[display host name with DNS domain (FQDN)]' + '(: gs s)'{-i,--ip-address}'[display IP addresses for host (via DNS resolution)]' + '(: gs s)'{-I,--all-ip-addresses}'[display IP addresses for host (via network interfaces)]' + '(: gs s)'{-s,--short}'[display short host name only]' + + '(gs)' # Get/set + '(g)'{-y,--yp,--nis}'[display NIS domain only]' + + s # Set + '(-b --boot g)'{-b,--boot}'[always set a host name]' + '(: -F --file g)'{-F+,--file=}'[read host name to set from specified file]: :_files' + + o + '(-F --file g)1: :->host-or-domain' + ) + ;; + darwin*|dragonfly*|freebsd*|netbsd*|openbsd*) + args+=( + '(: -4 -6 -d -f)-s[display short host name only]' + ) + ;| # MATCH AGAIN + darwin*|freebsd*) + args+=( + '(: -d -s)-f[display host name with DNS domain (FQDN)]' + ) + ;| # MATCH AGAIN + freebsd*) + args+=( + '(: -f -s)-d[display DNS domain only]' + ) + ;; + dragonfly*) + args+=( + '(: -6 -r)-4[use first IPv4 address on interface (with -i)]' + '(: -4 -r)-6[use first IPv6 address on interface (with -i)]' + '(: -r)-i+[retrieve host name via specified interface]: :_net_interfaces' + '(: -4 -6 -i)-r+[retrieve host name via specified IP address]: :_bind_addresses' + ) + ;; +esac + +_arguments -s -S $aopts : $args && ret=0 + +[[ $state == host-or-domain ]] && { + [[ -prefix -* ]] || + if [[ -n ${opt_args[(i)*-(-y|--yp|--nis)]} ]]; then + _message -e nis-domains 'NIS domain' && ret=0 + else + _message -e host-names 'host name' && ret=0 + fi +} + +return ret -- cgit v1.2.3 From 05e4ee0587ae6e804117612bd459cfb23e337d1d Mon Sep 17 00:00:00 2001 From: dana Date: Wed, 20 Jun 2018 00:25:31 -0500 Subject: 43060: Expand stat completion --- ChangeLog | 5 +++ Completion/Unix/Command/_stat | 96 +++++++++++++++++++++++++++++++++++++++++++ Completion/Zsh/Command/_stat | 33 --------------- 3 files changed, 101 insertions(+), 33 deletions(-) create mode 100644 Completion/Unix/Command/_stat delete mode 100644 Completion/Zsh/Command/_stat (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 9b80a023c..8158c1313 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-06-20 dana + + * 43060: Completion/Unix/Command/_stat, + Completion/Zsh/Command/_stat: Expand stat completion + 2018-06-18 dana * 43047: Completion/Unix/Command/_hostname: Add hostname completion diff --git a/Completion/Unix/Command/_stat b/Completion/Unix/Command/_stat new file mode 100644 index 000000000..2e84d6bf0 --- /dev/null +++ b/Completion/Unix/Command/_stat @@ -0,0 +1,96 @@ +#compdef stat gstat zstat + +# Notes: +# - @todo It would be nice to complete the -c/-f format strings some day +# - @todo It should be possible to complete NFS file handles on FreeBSD and +# Dragonfly by parsing the output of `lsof -N`, but it's not available by +# default — is there another way? + +local expl variant precmd ret=1 +local -a context line state state_descr args aopts=( -A '-*' ) +local -A opt_args + +if [[ $service == zstat ]] || [[ $precommands[-1] == builtin ]]; then + variant=zsh +else + [[ $precommands[-1] == command ]] && precmd=command + _pick_variant -c "${precmd:+$precmd }${words[1]}" -r variant \ + gnu='Free Soft' zsh='no files given' unix --version +fi + +case $OSTYPE-$variant in + *-zsh) + args=( + "(-H)-A[assign the results to array, don't print]:array variable:_parameters -g '*array*'" + - set1 + +device +inode +mode +nlink +uid +gid +rdev + +size +atime +mtime +ctime +blksize +block +link + "(-A)-H[assign the results to associative array, don't print]:associative array variable:_parameters -g '*association*'" + '(:)-f[stat the specified file descriptor]:file descriptor:_file_descriptors' + '(-s)-F[specify strftime(3) format string]: :_date_formats zsh' + '(-s)-g[show times in GMT/UTC]' + # Note that this has the *opposite* effect of other variants' -L option! + "-L[don't dereference symbolic links; use lstat(2)]" + '(-N)-n[always show names of files]' + '(-n)-N[never show names of files]' + '-o[print file modes in octal rather than decimal]' + '-r[print raw data]' + '-s[print mode, UID, GID, and times as strings]' + '(-T)-t[always show type names]' + '(-t)-T[never show type names]' + '*: :_files' + - set2 + '-l[list stat types]' + ) + ;; + *-gnu) + aopts=( ) + args=( + '*: :_files' + '(: * -)--help[display help information]' + '(: * -)--version[display version information]' + '(-L --dereference)'{-L,--dereference}'[dereference symbolic links]' + + '(d)' # Display options + {-c+,--format=}'[display per the specified format string]:format string' + {-f,--file-system}'[display file-system status instead of file status]' + '--printf=[display as with -c, but interpret backslash escapes like printf(3)]' + {-t,--terse}'[display in terse format]' + ) + ;; + darwin*|dragonfly*|*bsd*) + args=( + '*: :->files-or-handles' + '(-H)-L[dereference symbolic links]' + '-q[suppress error messages about lstat(2)/stat(2) failure]' + + '(d)' # Primary display options + '(-F)-f+[display per the specified format string]:format string' + '-l[display in `ls -lT` format]' + '(-F -t)-r[display in raw (numerical) format]' + '(-F -t)-s[display in shell variable-assignment format]' + '(-F)-x[display in verbose (Linux-style) format]' + + D # Secondary display options + '(-f -r -s -x)-F[append file type indicators (implies -l)]' + '-n[suppress terminating newlines]' + '(-r -s)-t+[specify strftime(3) format string]: :_date_formats' + ) + ;| # MATCH AGAIN + dragonfly*|freebsd*) + args+=( + + df + '(-L)-H[treat arguments as hexadecimal-formatted NFS file handles]' + ) + ;; +esac + +(( $#args )) || args=( '*: :_files' ) + +_arguments -s -S $aopts : $args && ret=0 + +[[ $state == files-or-handles ]] && +if [[ -n ${opt_args[(i)*--H]} ]]; then + _message -e nfs-handles 'NFS file handle' +else + _files && ret=0 +fi + +return ret diff --git a/Completion/Zsh/Command/_stat b/Completion/Zsh/Command/_stat deleted file mode 100644 index 73bbef471..000000000 --- a/Completion/Zsh/Command/_stat +++ /dev/null @@ -1,33 +0,0 @@ -#compdef stat zstat - -local expl ret=1 - -if [[ $service == zstat ]] || - (( ${+builtins[stat]} )) || - { (( ! ${+builtins} )) && [[ $(type -w stat) == '*: builtin' ]] } -then - _arguments -s -S : \ - '(-H)-A[assign the results to array, don'\''t print]:array variable:_parameters -g "*array*"' \ - - set1 \ - +device +inode +mode +nlink +uid +gid +rdev \ - +size +atime +mtime +ctime +blksize +block +link \ - '(-A)-H[assign the results to associative array, don'\''t print]:associative array variable:_parameters -g "*association*"' \ - '(:)-f[stat a file descriptor]:file descriptor:_file_descriptors' \ - '(-s)-F:strftime(3) format string:_date_formats zsh' \ - '(-s)-g[show times in GMT/UTC]' \ - '-L[don'\''t dereference symbolic links; use lstat(2)]' \ - '(-N)-n[always show names of files]' \ - '(-n)-N[never show names of files]' \ - '-o[print file modes in octal rather than decimal]' \ - '-r[print raw data]' \ - '-s[print mode,uid,gid and times as strings]' \ - '(-T)-t[always show type names]' \ - '(-t)-T[never show type names]' \ - '*:files to stat:_files' \ - - set2 \ - '-l[list stat types]' -else - # TODO: system-specific completion - # TODO: choose this codepath if 'command stat ...' or '=stat ...' is used - _files -fi -- cgit v1.2.3 From 7caec474de577e59a6cf45952e5b87712967aa45 Mon Sep 17 00:00:00 2001 From: dana Date: Wed, 20 Jun 2018 00:26:41 -0500 Subject: 43061: Improve open (macOS) completion --- ChangeLog | 4 ++ Completion/Darwin/Command/_open | 78 ++++++++++++++++++++++++++++--------- Completion/Unix/Command/_webbrowser | 2 +- 3 files changed, 65 insertions(+), 19 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 8158c1313..526681632 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2018-06-20 dana + * 43061: Completion/Darwin/Command/_open, + Completion/Unix/Command/_webbrowser: Improve open completion, adjust + _webbrowser wording + * 43060: Completion/Unix/Command/_stat, Completion/Zsh/Command/_stat: Expand stat completion diff --git a/Completion/Darwin/Command/_open b/Completion/Darwin/Command/_open index eadad1831..2563e5eb5 100644 --- a/Completion/Darwin/Command/_open +++ b/Completion/Darwin/Command/_open @@ -1,5 +1,12 @@ #compdef open +# Notes: +# - open(1) says that -f opens the result in the default text editor. This is +# not true; the result is always opened in TextEdit unless another option is +# supplied to override it +# - We no longer try to restrict files to those associated with the specified +# app; this was a nice idea, but it's unreliable + _open_absolute_application_path() { local expl curcontext zstyle -T ":completion:${curcontext}:files" prefix-needed && \ @@ -8,34 +15,69 @@ _open_absolute_application_path() { } _open() { - local curcontext="$curcontext" state line expl + local curcontext=$curcontext ret=1 + local -a context expl line state state_descr tmp + local -A opt_args val_args - _arguments -C \ - '-a[specify application]: :->open_mac_applications' \ - '-e[open with TextEdit]' \ - '-f[reads input from standard input and opens with TextEdit]' \ - '*: :->open_files' + # No +, and no -S (--args covers that) + _arguments -s -C : \ + '(-a -b -e -f -R -t)-a+[specify application name]: :->applications' \ + '(: * -)--args[pass remaining arguments to application]:*:::argument' \ + '(-a -b -e -f -R -t)-b+[specify application bundle identifier]: :->bundle-ids' \ + '(-a -b -e -f -R -t)-e[open with TextEdit]' \ + '(-h)-f[open standard input with TextEdit or specified application]' \ + '(-R)-F[open application with fresh state]' \ + '-g[do not bring application to foreground]' \ + '(-f)-h[open library header file]' \ + '(-R)-n[always open new instance of application]' \ + '(-a -b -e -f -F -n -s -t -W --args)-R[reveal in Finder]' \ + '(-R)-s+[specify SDK name/version]: :->sdks' \ + '(-a -b -e -f -R -t)-t[open with default text editor]' \ + '(-R)-W[wait for application to exit]' \ + '(-f)*: :->files' \ + && ret=0 - case "$state" in - open_mac_applications) + case $state in + applications) _alternative \ "commands: :_mac_applications" \ - "files:: _open_absolute_application_path" + "files:: _open_absolute_application_path" \ + && ret=0 + ;; + bundle-ids) + autoload -Uz zargs + _retrieve_mac_apps + tmp=( ${(@)_mac_apps:#/System/Library/(Private|)Frameworks/*} ) + tmp=( ${(0)"$( + _call_program bundle-ids \ + zargs -n300 -P2 -- ${(@q)tmp} -- mdls -rn kMDItemCFBundleIdentifier + )"} ) + tmp=( ${(@)tmp:#\(null\)} ) + _values 'bundle identifier' $tmp com.apple.TextEdit && ret=0 ;; - open_files) - local app - if [[ -n "$words[(r)-a]" ]]; then - app="${(Q)words[words[(i)-a] + 1]}" - elif [[ -n "$words[(r)-e]" || -n "$words[(r)-f]" ]]; then - app="Text Edit" + files) + if (( $+opt_args[-h] )); then + tmp=( + /System/Library/Frameworks/*/Headers/*.h(#q-.N:t) + /usr/local/include/**/*.h(#q-.N:t) + /usr/include/**/*.h(#q-.N:t) + ) + _describe -t headers 'header file' tmp && ret=0 + else + _webbrowser && ret=0 fi - if [[ -n "$app" ]]; then - _wanted files expl "file for $app" _mac_files_for_application "$app" + ;; + sdks) + tmp=( /Library/Developer/CommandLineTools/SDKs/*.*.sdk(#qN:t:r) ) + if (( $#tmp )); then + _describe -t sdks 'SDK name/version' tmp && ret=0 else - _webbrowser + _message -e sdks 'SDK name/version' && ret=0 fi ;; esac + + return ret } _open "$@" diff --git a/Completion/Unix/Command/_webbrowser b/Completion/Unix/Command/_webbrowser index 4192aff54..e4f5fe092 100644 --- a/Completion/Unix/Command/_webbrowser +++ b/Completion/Unix/Command/_webbrowser @@ -1,3 +1,3 @@ #compdef amaya arena chimera dillo dwb express galeon grail gzilla hotjava konqueror light mmm Mosaic netrik opera opera-next retawq skipstone www xmosaic zen -_alternative 'files:file:_files' 'urls:URL:_urls' +_alternative 'files: :_files' 'urls: :_urls' -- cgit v1.2.3 From afd008d96bee0993ebbca697f93917b0897207bd Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Thu, 21 Jun 2018 13:28:24 +0200 Subject: 43073: various completion option updates --- ChangeLog | 14 ++++++++++ Completion/Linux/Command/_cryptsetup | 6 +++-- Completion/Linux/Command/_kpartx | 6 ++--- Completion/Linux/Command/_ss | 10 ++++--- Completion/Linux/Command/_sysstat | 12 +++++---- Completion/Linux/Command/_tune2fs | 2 +- Completion/Unix/Command/_ansible | 52 +++++++++++++++++++++++++----------- Completion/Unix/Command/_git | 49 ++++++++++++++++++++++----------- Completion/Unix/Command/_lynx | 33 ++++++++++++++--------- Completion/Unix/Command/_mpc | 18 ++++++++++++- Completion/Unix/Command/_readelf | 3 ++- Completion/Unix/Command/_sqlite | 27 ++++++++++++++++--- Completion/Unix/Command/_subversion | 5 +++- Completion/Unix/Command/_tmux | 8 ++++-- Completion/Unix/Command/_user_admin | 1 + Completion/Unix/Command/_wget | 11 ++++---- Completion/Unix/Command/_xxd | 4 +-- Completion/X/Command/_qiv | 20 +++++++++++--- Completion/Zsh/Command/_which | 7 ++--- Completion/Zsh/Command/_zed | 1 + 20 files changed, 209 insertions(+), 80 deletions(-) (limited to 'Completion/Unix/Command') diff --git a/ChangeLog b/ChangeLog index 34b6f7ebb..fff2b6d28 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2018-06-18 Oliver Kiddle + + * 43073: Completion/Linux/Command/_cryptsetup, + Completion/Linux/Command/_sysstat, Completion/Linux/Command/_ss, + Completion/Linux/Command/_kpartx, Completion/Linux/Command/_tune2fs, + Completion/Unix/Command/_ansible, Completion/Unix/Command/_git, + Completion/Unix/Command/_lynx, Completion/Unix/Command/_mpc, + Completion/Unix/Command/_readelf, Completion/Unix/Command/_sqlite, + Completion/Unix/Command/_subversion, Completion/Unix/Command/_tmux, + Completion/Unix/Command/_user_admin, Completion/Unix/Command/_wget, + Completion/Unix/Command/_xxd, Completion/X/Command/_qiv, + Completion/Zsh/Command/_which, Completion/Zsh/Command/_zed: + various completion option updates + 2018-06-20 Peter Stephenson * 43077: Src/builtin.c: failure of math evaluation didn't diff --git a/Completion/Linux/Command/_cryptsetup b/Completion/Linux/Command/_cryptsetup index ea7152ea1..351859586 100644 --- a/Completion/Linux/Command/_cryptsetup +++ b/Completion/Linux/Command/_cryptsetup @@ -33,7 +33,7 @@ _arguments -s \ '(--use-random)--use-urandom[use /dev/urandom to generate volume key]' \ '--shared[share device with another non-overlapping crypt segment]' \ '--uuid=[set device UUID]:uuid' \ - '--allow-discards[allow discards (aka TRIM) requests for device]' \ + '--allow-discards[allow discard (aka TRIM) requests for device]' \ '--header=[device or file with separated LUKS header]:file:_files' \ '--test-passphrase[do not activate device, just check passphrase]' \ '--tcrypt-hidden[use hidden header (hidden TCRYPT device)]' \ @@ -64,6 +64,7 @@ _arguments -s \ '--persistent[set activation flags persistent for device]' \ '--label=[set label for the LUKS2 device]:label' \ '--subsystem=[set subsystem label for the LUKS2 device]:subsystem' \ + '--unbound[create unbound (no assigned data segment) LUKS2 keyslot]' \ '(- : *)--version[show version information]' \ '(- : *)'{-\?,--help}'[display help information]' \ '(- : *)--usage[display brief usage]' \ @@ -86,6 +87,7 @@ case $state in 'luksAddKey:add a new key' 'luksRemoveKey:remove a key' 'luksChangeKey:change a key' + 'luksConvertKey:convert a key to new pbkdf parameters' 'luksKillSlot:wipe key from slot' 'luksUUID:print/change device UUID' 'isLuks:check if device is a LUKS partition' @@ -112,7 +114,7 @@ case $state in erase|convert|config|repair|(luks(AddKey|Erase|RemoveKey|DelKey|UUID|Dump)|isLuks)) args=( $device ) ;; - luks(Format|AddKey|RemoveKey|ChangeKey)) + luks(Format|AddKey|RemoveKey|ChangeKey|ConvertKey)) args=( $device ':key file:_files' ) ;; luksHeader*) args=( $device '--header-backup-file:file:_files' );; diff --git a/Completion/Linux/Command/_kpartx b/Completion/Linux/Command/_kpartx index 11c614c01..8f09c416d 100644 --- a/Completion/Linux/Command/_kpartx +++ b/Completion/Linux/Command/_kpartx @@ -1,6 +1,6 @@ #compdef kpartx -_arguments -s -w : \ +_arguments -s -S : \ '-a[add partition mappings]' \ '-r[read-only partition mappings]' \ '-d[delete partition mappings]' \ @@ -9,6 +9,6 @@ _arguments -s -w : \ '-p[set device name-partition number delimiter]' \ '-f[force creation of mappings]' \ '-g[force GUID partition table]' \ - '-v[Operate verbosely]' \ - '-s[don'\''t return until the partitions are created]' \ + '-v[operate verbosely]' \ + '-n[return before the partitions are created]' '!(-n)-s' \ '1: : _files' diff --git a/Completion/Linux/Command/_ss b/Completion/Linux/Command/_ss index dff289947..b1bfa207c 100644 --- a/Completion/Linux/Command/_ss +++ b/Completion/Linux/Command/_ss @@ -18,6 +18,7 @@ _arguments -C -s \ "($info -m --memory)"{-m,--memory}'[show socket memory usage]' \ "($info -p --processes)"{-p,--processes}'[show process using each socket]' \ "($info -i --info)"{-i,--info}'[show internal TCP information]' \ + "($info)--tipcinfo[show internal tipc socket information]" \ "($info -s --summary)"{-s,--summary}'[print summary statistics]' \ "($info -b --bpf)"{-b,--bpf}'[show bpf filter socket information]' \ "($info -E --events)"{-E,--events}'[continually display sockets as they are destroyed]' \ @@ -33,13 +34,14 @@ _arguments -C -s \ "($info -d --dccp)"{-d,--dccp}'[display DCCP sockets]' \ "($info -w --raw)"{-w,--raw}'[display RAW sockets]' \ "($info -x --unix)"{-x,--unix}'[display Unix domain sockets]' \ + "($info)--tipc[display only TIPC sockets]" \ "($info)--vsock[display only vsock sockets]" \ - "($info -f --family)"{-f,--family}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock)' \ + "($info -f --family)"{-f+,--family=}'[display sockets of specified type]:family:(unix inet inet6 link netlink unix vsock tipc)' \ "($info -K --kill)"{-K,--kill}'[forcibly close sockets, display what was closed]' \ "($info -H --no-header)"{-H,--no-header}'[suppress header line]' \ - "($info -A --query --socket)"{-A,--query,--socket}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram' \ - "($info -D)"{-D,--diag=}'[dump raw info to file]:file:_files' \ - "($info -F)"{-F,--filter=}'[read filter information from a file]:file:_files' \ + "($info -A --query --socket)"{-A+,--query=,--socket=}'[specify socket tables to show]: :_values -s , socket\ table all inet tcp udp raw unix packet netlink unix_dgram unix_stream unix_seqpacket packet_raw packet_dgram vsock_stream vsock_dgram tipc' \ + "($info -D)"{-D+,--diag=}'[dump raw info to file]:file:_files' \ + "($info -F)"{-F+,--filter=}'[read filter information from a file]:file:_files' \ "($info)*: :->filter" && ret=0 if [[ -n $state ]]; then diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat index 855bf0a70..8b7929ddd 100644 --- a/Completion/Linux/Command/_sysstat +++ b/Completion/Linux/Command/_sysstat @@ -9,7 +9,7 @@ _mpstat() { '(-A)-N[specify NUMA nodes]:NUMA node' \ '(-A)-n[report summary CPU statistics based on NUMA node placement]' \ '-o[display statistics in JSON]:format:(JSON)' \ - '(-A)-P[specify processor number]:processor: _values -s "," processor ON ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ + '(-A)-P[specify processor number]:processor: _values -s "," processor ALL {0..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \ '-u[report CPU utilization]' \ '(- 1 2)-V[display version information]' \ '1: : _guard "^-*" interval' \ @@ -85,29 +85,31 @@ _sar() { '-F[display statistics for mounted filesystems]' \ '-f[extract records from file]:record:_files' \ '-H[report hugepages utilization]' \ - '-h[display help]' \ + '(--human -p)-h[make output easier to read: implies --human and -p]' \ + '(- 1 2)--help[display usage information]' \ '--human[print sizes in human readable format]' \ '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \ '-i[select records as close as possible to interval]:interval' \ '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \ '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \ - '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \ + '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 FC SOFT ALL' \ '-o[save readings to file in binary form]:file:_files' \ '-P[report per-processor statistics]:processor: _values -s "," processors ALL' \ '-p[pretty-print device names]' \ '-q[report queue length and load averages]' \ '-R[report memory statistics]' \ - '-r[report memory utilization statistics]' \ + '-r[report memory utilization statistics]:: :(ALL)' \ '-S[report swap space utilization]' \ '-s[set starting time of report]:start time (HH\:MM\:SS)' \ '--sadc[print name of data collector]' \ '-t[display timestamps in original local time of file creator]' \ - '-u[report CPU utilization]: :(ALL)' \ + '-u[report CPU utilization]:: :(ALL)' \ '(- 1 2)-V[display version information]' \ '-v[report status of kernel tables]' \ '-W[report swapping statistics]' \ '-w[report task creation and system switching activity]' \ '-y[report TTY device activity]' \ + '-z[omit output for any devices lacking activity during sample period]' \ '1: : _guard "^-*" interval' \ '2: : _guard "^-*" count' } diff --git a/Completion/Linux/Command/_tune2fs b/Completion/Linux/Command/_tune2fs index af120e279..3d64f266c 100644 --- a/Completion/Linux/Command/_tune2fs +++ b/Completion/Linux/Command/_tune2fs @@ -24,7 +24,7 @@ _arguments -s -S \ '-m+[set the percentage of reserved filesystem blocks]:percentage' \ '-M+[set the last-mounted directory for the filesystem]:directory:_files -/' \ '-o+[mount options]:options:_values -s , debug bsdgroups user_xattr acl uid16 journal_data journal_data_ordered journal_data_writeback nobarrier block_validity discard nodelalloc' \ - '-O+[set or clear filesystem features]: :_values -s , feature dir_index dir_nlink encrypt extentextent extra_isize filetype flex_bg has_journalhuge_file large_file metadata_csum mmp project quota read-only resize_inode sparse_super uninit_bg' \ + '-O+[set or clear filesystem features]: :_values -s , feature 64bit dir_index dir_nlink ea_inode encrypt extent extra_isize filetype flex_bg has_journal large_dir huge_file large_file metadata_csum metadata_csum_seed mmp project quota read-only resize_inode sparse_super uninit_bg' \ '-r+[set the number of reserved filesystem blocks]:number' \ '-Q+[set quota feature on the superblock]: :_values -s , "quota option" usrquota grpquota prjquota' \ '-s+[set sparse super feature]:state:((0\:off 1\:on))' \ diff --git a/Completion/Unix/Command/_ansible b/Completion/Unix/Command/_ansible index f05dac8a6..330ef66b7 100644 --- a/Completion/Unix/Command/_ansible +++ b/Completion/Unix/Command/_ansible @@ -30,7 +30,7 @@ case $service in '(-D --diff)'{-D,--diff}'[show differences when changing small files and templates]' '(-b --become)'{-b,--become}'[escalate privileges on remote system]' '(-f --forks)'{-f+,--forks=}'[specify number of parallel processes to use]:processes [5]' - '--become-method=[specify privilege escalation method to use]:method [sudo]:(sudo su pbrun pfexec doas dzdo ksu runas pmrun)' + '--become-method=[specify privilege escalation method to use]:method [sudo]:(sesu sudo su pbrun pfexec doas dzdo ksu runas pmrun enable)' '--become-user=[specify remote user for running operations]:user:_users' "--syntax-check[perform a syntax check on the playbook, but don't execute it]" '!(-R --su-user -U --sudo-user)'{-R,-U,--su-user,--sudo-user}':user [root]:_users' @@ -39,17 +39,20 @@ case $service in ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull|ansible-vault) args+=( '--ask-vault-pass[ask for vault password]' - '--new-vault-id=[specify new vault identity to use for rekey]:vault id' - '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' '--vault-id=[specify vault identity to use]:vault identity' '--vault-password-file=[specify vault password file]:vault password file:_files' ) ;| ansible|ansible-console|ansible-inventory|ansible-playbook|ansible-pull) args+=( - '--list-hosts[output list of matching hosts]' - '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file]:inventory file:_files' + '(-i --inventory)'{-i+,--inventory=}'[specify inventory host file or host list]: : _alternative "files\:inventory file\:_files" + "hosts\:host\: _sequence _hosts"' '!(-i --inventory)--inventory-file=:inventory file:_files' + ) + ;| + ansible|ansible-console|ansible-playbook|ansible-pull) + args+=( + '--list-hosts[output list of matching hosts]' '(-l --limit)'{-l+,--limit=}'[further limit hosts to an additional pattern]:host subset:->hosts' ) ;| @@ -58,21 +61,22 @@ case $service in '(-e --extra-vars)'{-e+,--extra-vars=}'[set additional variables]:key=value or YAML/JSON' ) ;| - ansible-playbook|ansible-pull) + ansible|ansible-console|ansible-inventory) args+=( - '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' - "--skip-tags[only run plays and tasks whose tags don't match]" + '--playbook-dir=[specify substitute playbook directory]:directory:_directories' ) ;| - ansible|ansible-pull) + ansible-playbook|ansible-pull) args+=( - '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' + '(-t --tags)'{-t,--tags}'[only run plays and tasks tagged with these values]' + "--skip-tags[only run plays and tasks whose tags don't match]" ) ;| ansible) args+=( '(-a --args)'{-a+,--args=}'[specify command or module arguments]:arguments:->args' '(-B --background)'{-B+,--background=}'[run asynchronously, failing after specified time]:fail timeout (seconds)' + '(-m --module-name)'{-m+,--module-name=}'[specify module]:module:->plugins' '(-o --one-line)'{-o,--one-line}'[condense output]' '(-P --poll)'{-P+,--poll=}'[specify the poll interval if using -B]:interval (seconds) [15]' '(-t --tree)'{-t+,--tree=}'[specify directory for log output]:directory:_directories' @@ -98,14 +102,16 @@ case $service in ;; ansible-doc) args+=( - '(-l --list)'{-l,--list}'[list available plugins]' - '(-s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' + '(-l --list -F --list_files -s --snippet)'{-l,--list}'[list available plugins]' + '(-l --list -F --list_files -s --snippet)'{-F,--list_files}'[show plugin names and their source files without summaries]' + '(-l --list -F --list_files -s --snippet)'{-s,--snippet}'[show playbook snippet for specified plugins]' '(-t --type)'{-t+,--type=}'[choose plugin type]:plugin type [module]:(cache callback connection inventory lookup module strategy vars)' '*:plugin:->plugins' ) ;; ansible-inventory) args+=( + '--export[when doing an --list, represent in a way that is optimized for export]' '(-y --yaml)--graph[output inventory graph]' '--host[output specific host information]' '--list[output all hosts information]' @@ -125,7 +131,7 @@ case $service in ;; ansible-playbook) args+=( - '--flush-cache[clear the fact cache]' + '--flush-cache[clear the fact cache for every host in inventory]' '--force-handlers[run handlers even if a task fails]' '--list-tags[list all available tags]' '--list-tasks[list all tasks that would be executed]' @@ -139,6 +145,7 @@ case $service in "--check[don't make any changes]" '(-d --directory)'{-d+,--directory=}'[specify directory to checkout repository to]:directory:_directories' '--full[do a full instead of a shallow clone]' + '(-m --module-name)'{-m+,--module-name=}'[specify repository module used for checking out repository]:module:(git subversion hg bzr)' '--accept-host-key[adds the hostkey for the repo url if not already added]' '--purge[purge checkout after playbook run]' '(-f --force)'{-f,--force}'[run the playbook even if the repository could not be updated]' @@ -153,6 +160,8 @@ case $service in ;; ansible-vault) args=( -A "-*" $args + '--new-vault-id=[specify new vault identity to use for rekey]:vault id' + '--new-vault-password-file=[specify new vault password file to use for rekey]:file:_files' '*::args:->vault' ) ;; @@ -200,9 +209,15 @@ case $state in plugins) plugvar=_ansible_${plug}_plugins typeset -ga ${plug} - (( ${(P)#plugvar} )) || set -A ${plugvar} \ - ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:} - _describe -t plugins "${plug} plugin" $plugvar && ret=0 + if zstyle -T ":completion:${curcontext}:plugins" verbose; then + (( ${(P)#plugvar} )) || set -A ${plugvar} \ + ${${(f)"$(_call_program plugins ansible-doc -t $plug -l)"}/ ##/:} + _describe -t plugins "${plug} plugin" $plugvar && ret=0 + else + (( ${(P)#plugvar} )) || set -A ${plugvar} \ + ${${(f)"$(_call_program plugins ansible-doc -t $plug -F)"}%% *} + _wanted plugins expl "${plug} plugin" compadd -a $plugvar && ret=0 + fi ;; galaxy) curcontext="${curcontext%:*}-${line[1]}:" @@ -265,6 +280,11 @@ case $state in curcontext="${curcontext%:*}-${line[1]}:" args=() case $line[1] in + encrypt*|edit|rekey) + args+=( + '--encrypt-vault-id=[specify vault id to use to encrypt (required if more than one vault-id is provided)]:vault id' + ) + ;| (de|en)crypt*) args=( '--output=[specify output file name]:file:_files' ) ;| encrypt_string) args+=( diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git index b92a320df..38b872ea0 100644 --- a/Completion/Unix/Command/_git +++ b/Completion/Unix/Command/_git @@ -871,6 +871,7 @@ _git-fetch () { '(-n --no-tags -t --tags)'{-n,--no-tags}'[disable automatic tag following]' \ '(--all -m --multiple)'{-m,--multiple}'[fetch from multiple remotes]' \ '(-P --prune-tags)'{-P,--prune-tags}'[prune local tags no longer on remote and clobber changed tags]' \ + \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \ '--filter=[object filtering]:filter:_git_rev-list_filters' \ '*:: :->repository-or-group-or-refspec' && ret=0 @@ -959,9 +960,10 @@ _git-gc () { _arguments -S -s \ '--aggressive[more aggressively optimize]' \ '--auto[check whether housekeeping is required]' \ - '( --no-prune)--prune=[prune loose objects older than given date]: :__git_datetimes' \ + '( --no-prune)--prune=-[prune loose objects older than given date]::date [2 weeks ago]:__git_datetimes' \ '(--prune )--no-prune[do not prune any loose objects]' \ - '(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' + '(-q --quiet)'{-q,--quiet}'[suppress progress reporting]' \ + '--keep-largest-pack[repack all other packs except the largest pack]' \ } (( $+functions[_git-grep] )) || @@ -1768,7 +1770,10 @@ _git-status () { '--ignored=-[show ignored files as well]:mode [traditional]:(traditional matching no)' \ '(-z --null --column --no-column)'{-z,--null}'[use NUL termination on output]' \ '(--no-column -z --null)--column=-[display in columns]::column.status 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]' \ + "(--column)--no-column[don't display in columns]" \ + "(--no-renames -M --find-renames)--no-renames[don't detect renames]" \ + '(--no-renames -M --find-renames)-M[detect renames]' \ + '(--no-renames -M --find-renames)--find-renames=-[detect renames, optionally set similarity index]::similarity' \ '*: :__git_ignore_line_inside_arguments _files' } @@ -2155,16 +2160,18 @@ _git-config () { '(--global --system -f --file --blob)--local[use local config file]' \ '(--global --system --local --blob)'{-f+,--file=}'[use given config file]:config file:_files' \ '(--global --system --local -f --file)--blob=[read config from given blob object]:blob:__git_blobs' \ - '( --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \ - '(--bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \ - '(--bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \ - '(--bool --int --bool-or-int --expiry-date)--path[setting is a path]' \ - '(--bool --int --bool-or-int --path )--expiry-date[setting is an expiry date]' \ + '(-t --type --bool --int --bool-or-int --path --expiry-date)'{-t+,--type=}'[ensure that incoming and outgoing values are canonicalize-able as the given type]:type:(bool int bool-or-int path expiry-date color)' \ + '(-t --type --int --bool-or-int --path --expiry-date)--bool[setting is a boolean]' \ + '(-t --type --bool --bool-or-int --path --expiry-date)--int[setting is an integer]' \ + '(-t --type --bool --int --path --expiry-date)--bool-or-int[setting is an integer]' \ + '(-t --type --bool --int --bool-or-int --expiry-date)--path[setting is a path]' \ + '(-t --type --bool --int --bool-or-int --path)--expiry-date[setting is an expiry date]' \ '(-z --null)'{-z,--null}'[end values with NUL and newline between key and value]' \ '(--get --get-all --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--name-only[show variable names only]' \ '(--includes)'--no-includes"[don't respect \"include.*\" directives]" \ '(--no-includes)'--includes'[respect "include.*" directives in config files when looking up values]' \ '(--global --system --local -f --file --blob --get-urlmatch --replace-all --add --unset --unset-all --rename-section --remove-section -e --edit --get-color --get-colorbool)--show-origin[show origin of config]' \ + '(2 --add -e --edit -l --list --name-only --rename-section --remove-section --replace-all --unset --unset-all)--default=[with --get, use specified default value when entry is missing]:default' \ $name_arg \ $value_arg \ '::value regex' \ @@ -3708,11 +3715,17 @@ _git-replace () { '(: * --raw -f --force)'{-l,--list}'[list replace refs]:pattern' \ {-d,--delete}'[delete existing replace refs]:*:replacement:__git_objects' \ '(* 2 --format)'{-e,--edit}'[edit existing object and replace it with the new one]' \ - '(--raw --format)'{-g,--graft}'[rewrite the parents of a commit]' + '(--raw --format)'{-g,--graft}'[rewrite the parents of a commit]' \ + '--convert-graft-file[convert existing graft file]' } # Ancillary Commands (Interrogators) +(( $+functions[_git-annotate] )) || +_git-annotate() { + _git-blame "$@" +} + (( $+functions[_git-blame] )) || _git-blame () { local curcontext=$curcontext state line ret=1 @@ -3744,6 +3757,8 @@ _git-blame () { '(-n --show-number)'{-n,--show-number}'[show the line number in the original commit]' \ '-s[suppress author name and timestamp]' \ '-w[ignore whitespace when finding lines]' \ + '(--color-by-age)--color-lines[color redundant metadata from previous line differently]' \ + '(--color-lines)--color-by-age[color lines by age]' \ '--indent-heuristic[use indent-based heuristic to improve diffs]' \ $revision_options \ ':: :__git_revisions' \ @@ -3831,10 +3846,11 @@ _git-get-tar-commit-id () { _git-help () { _arguments -S -s \ '( -g --guides -i --info -m --man -w --web)'{-a,--all}'[show all available commands]' \ - '(-a --all -g --guides -m --man -w --web)'{-i,--info}'[show all available commands]' \ - '(-a --all -g --guides -i --info -w --web)'{-m,--man}'[show all available commands]' \ - '(-a --all -g --guides -i --info -m --man )'{-w,--web}'[show all available commands]' \ + '(-a --all -g --guides -m --man -w --web)'{-i,--info}'[display manual for the command in info format]' \ + '(-a --all -g --guides -i --info -w --web)'{-m,--man}'[display manual for the command in man format]' \ + '(-a --all -g --guides -i --info -m --man )'{-w,--web}'[display manual for the command in HTML format]' \ '(-g --guides)'{-g,--guides}'[prints a list of useful guides on the standard output]' \ + '(-v --verbose)'{-v,--verbose}'[print command descriptions]' \ ': : _alternative commands:command:_git_commands "guides:git guides:(attributes glossary ignore modules revisions tutorial workflows)"' } @@ -4703,6 +4719,7 @@ _git-pack-objects () { $thin_opt \ '--shallow[create packs suitable for shallow fetches]' \ '--honor-pack-keep[ignore objects in local pack with .keep file]' \ + '--keep-pack=[ignore named pack]:pack' \ '--compression=-[specify compression level]: :__git_compression_levels' \ '--keep-true-parents[pack parents hidden by grafts]' \ '--use-bitmap-index[use a bitmap index if available to speed up counting objects]' \ @@ -5037,7 +5054,9 @@ _git-ls-remote () { "--refs[don't show peeled tags]" \ '--exit-code[exit with status 2 when no matching refs are found in the remote repository]' \ '--get-url[expand the URL of the given repository taking into account any "url..insteadOf" config setting]' \ + '*--sort=[specify field name to sort on]:field:__git_ref_sort_keys' \ '--symref[show underlying ref in addition to the object pointed by it]' \ + \*{-o+,--server-option=}'[send specified string to the server when using protocol version 2]:option' \ ': :__git_any_repositories' \ '*: :__git_references' } @@ -6407,7 +6426,7 @@ __git_heads () { (( $+functions[__git_heads_local] )) || __git_heads_local () { - local gitdir + local f gitdir declare -a heads heads=(${(f)"$(_call_program headrefs git for-each-ref --format='"%(refname:short)"' refs/heads 2>/dev/null)"}) @@ -7742,8 +7761,8 @@ _git() { '(: -)--man-path[print the manpath for the man pages for this version of Git and exit]' \ '(: -)--info-path[print the path where the info files are installed and exit]' \ '(: -)--html-path[display path to HTML documentation and exit]' \ - '(-p --paginate)'{-p,--paginate}'[pipe output into $PAGER]' \ - '--no-pager[do not pipe git output into a pager]' \ + '(-p --paginate -P --no-pager)'{-p,--paginate}'[pipe output into a pager]' \ + '(-p --paginate -P --no-pager)'{-P,--no-pager}"[don't pipe git output into a pager]" \ '--git-dir=-[path to repository]: :_directories' \ '--work-tree=-[path to working tree]: :_directories' \ '--namespace=-[set the Git namespace]: :_directories' \ diff --git a/Completion/Unix/Command/_lynx b/Completion/Unix/Command/_lynx index 6c4d57f6f..d25b03975 100644 --- a/Completion/Unix/Command/_lynx +++ b/Completion/Unix/Command/_lynx @@ -1,7 +1,5 @@ #compdef lynx -# Lynx Version 2.8.7rel.1 (05 Jul 2009) - local curcontext="$curcontext" state line ret=1 typeset -A opt_args @@ -26,7 +24,9 @@ _arguments -C \ '-cmd_log=[log keystroke commands to the given file]:keystroke log:_files' \ '-cmd_script=[read keystroke commands from the given file (see -cmd_log)]:keystroke log:_files' \ '-color[forces color mode on, if available]' \ - '-connect_timeout=[set the N-second connection timeout (18000)]:connection timeout (seconds):' \ + '-collapse_br_tags[toggle collapsing of BR tags (on)]' \ + '-connect_timeout=[set the N-second connection timeout]:connection timeout (seconds) [18000]' \ + '-convert_to=[convert input]:format:_mime_types' \ '-cookie_file=[specifies a file to use to read cookies]:cookie file:_files' \ '-cookie_save_file=[specifies a file to use to store cookies]:cookie file:_files' \ '-cookies[toggles handling of Set-Cookie headers (on)]' \ @@ -34,7 +34,8 @@ _arguments -C \ '-crawl[with -traversal, output each page to a file with -dump, format output as with -traversal, but to stdout]' \ '-curses_pads[uses curses pad feature to support left/right shifting (on)]' \ '-debug_partial[incremental display stages with MessageSecs delay (off)]' \ - '-delay=[set NNN-second delay at statusline message (0.000)]:delay (seconds):' \ + '-default_colors[use terminal default foreground/background colors (on)]' \ + '-delay=[set NNN-second delay at statusline message]:delay (seconds) [0.000]' \ "-display=[set the display variable for X exec'ed programs]:display:_x_display" \ '-display_charset=[charset for the terminal output]:character set:' \ "-dont_wrap_pre[inhibit wrapping of text in
 when -dump'ing and -crawl'ing, mark wrapped lines in interactive session (off)]" \
@@ -47,7 +48,7 @@ _arguments -C \
   '-fileversions[include all versions of files in local VMS directory listings]' \
   '-force_empty_hrefless_a[force HREF-less 'A' elements to be empty (close them as soon as they are seen) (off)]' \
   '-force_html[forces the first document to be interpreted as HTML (off)]' \
-  '-force_secure[toggles forms-based vs old-style options menu (on)]' \
+  '-force_secure[toggle forcing of the secure flag for SSL cookies (off)]' \
   '-forms_options[toggles forms-based vs old-style options menu (on)]' \
   '-from[toggle transmission of From headers (on)]' \
   '-ftp[disable ftp access (off)]' \
@@ -57,11 +58,13 @@ _arguments -C \
   '-hiddenlinks=[hidden links: options are merge, listonly, or ignore]:option:(merge listonly ignore)' \
   "-historical[toggles use of '>' or '-->' as terminator for comments (off)]" \
   '-homepage=[set homepage separate from start page]:URL:->html' \
+  '-html5_charsets[toggle use of HTML5 charset replacements]' \
   '-image_links[toggles inclusion of links for all images (off)]' \
   '-index=[set the default index file to URL]:URL:->html' \
   '-ismap[toggles inclusion of ISMAP links when client-side MAPs are present (off)]' \
   '-justify[do justification of text (off)]' \
   '-link=[starting count for lnk#.dat files produced by -crawl (0)]:starting count:' \
+  '-list_inline[with -dump, show links inline with text]' \
   '-listonly[with -dump, forces it to show only the list of links (off)]' \
   '-localhost[disable URLs that point to remote hosts (off)]' \
   '-locexec[enable local program execution from local files only (if lynx was compiled with local execution enabled)]' \
@@ -91,6 +94,7 @@ _arguments -C \
   '-nostatus[disable the miscellaneous information messages (off)]' \
   '-notitle[disable the title at the top of each page (off)]' \
   '-nounderline[disable underline video-attribute]' \
+  "-nozap=[disable checks for the 'z' key]:duration:(all initially full)" \
   '-number_fields[force numbering of links as well as form input fields (off)]' \
   '-number_links[force numbering of links (off)]' \
   '-partial[toggles display partial pages while downloading (on)]' \
@@ -105,7 +109,7 @@ _arguments -C \
   '-pseudo_inlines[toggles pseudo-ALTs for inlines with no ALT string (on)]' \
   '-raw[toggles default setting of 8-bit character translations or CJK mode for the startup character set (off)]' \
   '-realm[restricts access to URLs in the starting realm (off)]' \
-  '-read_timeout=[set the N-second read-timeout (18000)]:timeout (seconds):' \
+  '-read_timeout=[set the N-second read-timeout]:timeout (seconds) [18000]' \
   '-reload[flushes the cache on a proxy server (only the first document affected) (off)]' \
   '-restrictions=[use -restrictions to see list]:options:->restrictions' \
   '-resubmit_posts[toggles forced resubmissions (no-cache) of forms with method POST when the documents they returned are sought with the PREV_DOC command or from the History List (off)]' \
@@ -113,6 +117,9 @@ _arguments -C \
   '-scrollbar[toggles showing scrollbar (off)]' \
   '-scrollbar_arrow[toggles showing arrows at ends of the scrollbar (on)]' \
   '-selective[require .www_browsable files to browse directories]' \
+  '-session=[resume from specified file on startup and save session to it on exit]:session file:_files' \
+  '-sessionin=[resume session from specified file on startup]:session file:_files' \
+  '-sessionout=[save session to specified file on exit]:session file:_files' \
   '-short_url[enables examination of beginning and end of long URL in status line (off)]' \
   "-show_cfg[show 'LYNX.CFG' setting (off)]" \
   '-show_cursor[toggles hiding of the cursor in the lower right corner (on)]' \
@@ -131,16 +138,18 @@ _arguments -C \
   '-trace[turns on Lynx trace mode (off)]' \
   '-trace_mask=[customize Lynx trace mode]:trace mask:(0 1 2 3 4 5 6 7)' \
   '-traversal[traverse all http links derived from startfile]' \
+  '-trim_blank_lines[toggle trimming of leading/trailing/collapsed-br blank lines (on)]' \
   '-trim_input_fields[trim input text/textarea fields in forms (off)]' \
   '-underline_links[toggles use of underline/bold attribute for links (off)]' \
   '-underscore[toggles use of _underline_ format in dumps (off)]' \
+  '-unique_urls[toggle use of unique-urls setting for -dump and -listonly options (off)]' \
   '-use_mouse[turn on mouse support (off)]' \
   '-useragent=[set alternate Lynx User-Agent header]:user-agent header:' \
   '-validate[accept only http URLs (meant for validation) implies more restrictions than -anonymous, but goto is allowed for http and https (off)]' \
   '-verbose[toggles [LINK\], [IMAGE\] and [INLINE\] comments with filenames of these images (on)]' \
   '(- *)-version[print Lynx version information]' \
   '-vikeys[enable vi-like key movement (off)]' \
-  '-width=[screen width for formatting of dumps (default is 80)]:number of columns:' \
+  '-width=[specify screen width for formatting of dumps]:number of columns [80]' \
   '-with_backspaces[emit backspaces in output if -dumping or -crawling]' \
   '-xhtml-parsing[enable XHTML 1.0 parsing (off)]' \
   ':URL:->html' && ret=0
@@ -148,12 +157,12 @@ _arguments -C \
 case "$state" in
 restrictions)
   _values -s ',' 'restriction' \
-    \? all bookmark bookmark_exec change_exec_perms chdir default \
-    dired_support disk_save dotfiles download editor exec exec_frozen \
+    \? all bookmark bookmark_exec change_exec_perms chdir compileopts_info \
+    default dired_support disk_save dotfiles download editor exec exec_frozen \
     externals file_url goto inside_ftp inside_news inside_rlogin \
-    inside_telnet jump lynx_cgi mail multibook news_post options_save \
-    outside_ftp outside_news outside_rlogin outside_telnet print shell \
-    suspend telnet_port useragent && return
+    inside_telnet jump lynxcfg_info lynxcfg_xinfo lynxcgi mail multibook \
+    news_post options_save outside_ftp outside_news outside_rlogin \
+    outside_telnet print shell suspend telnet_port useragent && return
   ;;
 html)
   _alternative 'files:file:_files -g "*.x#html#(-.)"' 'urls:URL:_urls' && return
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index 45d93550d..4f200c69e 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -37,6 +37,7 @@ _mpc_command() {
     disable:"disable an output"
     enable:"enable an output"
     toggleoutput:"toggle an output"
+    outputset:"set output attributes"
     idle:"wait until an event occurs"
     idleloop:"loop waiting for events"
     insert:"insert a song after the currently playing song in the playlist"
@@ -73,6 +74,7 @@ _mpc_command() {
     stop:"stop the currently playing playlists"
     toggle:"toggles Play/Pause, plays if stopped"
     update:"scan music directory for updates"
+    rescan:"rescan music directory (including unchanged files)"
     version:"report version of MPD"
     volume:"set volume"
     status:"display MPD status"
@@ -222,6 +224,16 @@ _mpc_toggleoutput() {
   _mpc_helper_outputs
 }
 
+_mpc_outputset() {
+  if (( CURRENT == 2 )); then
+    _mpc_helper_outputs
+  else
+    _values -w -S = attribute \
+      'dop:setting:(1 0)' \
+      'allowed_formats:formats'
+  fi
+}
+
 _mpc_move() {
   if (( $#words <= 3 )); then
     _mpc_helper_songnumbers
@@ -318,6 +330,10 @@ _mpc_update() {
   _mpc_helper_files
 }
 
+_mpc_rescan() {
+  _mpc_helper_files
+}
+
 if [[ $service = *MPD_HOST* ]]; then
   _hosts
   return
@@ -339,7 +355,7 @@ if [[ $state = formats ]]; then
   compset -P '([^%]|%[^%]#%)#'
   _wanted metadata expl 'metadata delimiter' compadd -p % -S % \
     artist album albumartist comment composer date disc genre performer title \
-    track time file position mtime mdate && ret=0
+    track time file position id prio mtime mdate && ret=0
 fi
 
 return ret
diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf
index 282431462..ce78baf27 100644
--- a/Completion/Unix/Command/_readelf
+++ b/Completion/Unix/Command/_readelf
@@ -7,6 +7,7 @@ _pick_variant -r variant elftoolchain=elftoolchain elfutils=elfutils binutils --
 
 args=(
   '(-a --all)'{-a,--all}'[show all tables]'
+  '(-g --section-groups)'{-g,--section-groups}'[show section groups]'
   '(-h --file-header)'{-h,--file-header}'[show file header]'
   '(-l --program-headers --segments)'{-l,--program-headers,--segments}'[show program headers]'
   '(-S --section-headers --sections)'{-S,--section-headers,--sections}'[show sections header]'
@@ -31,7 +32,6 @@ args=(
 case $variant in
   elftoolchain|binutils)
     args+=(
-      '(-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]'
@@ -49,6 +49,7 @@ case $variant in
   ;;
   elfutils)
     args+=(
+      '--dwarf-skeleton=[find skeleton compile units (with -w)]:file:_files'
       '--elf-section[used specified section as ELF input data]::section'
       '(-e --exception)'{-e,--exception}'[show sections for exception handling]'
       '(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]"
diff --git a/Completion/Unix/Command/_sqlite b/Completion/Unix/Command/_sqlite
index 58f7a9116..4604fb40c 100644
--- a/Completion/Unix/Command/_sqlite
+++ b/Completion/Unix/Command/_sqlite
@@ -1,6 +1,6 @@
 #compdef sqlite sqlite3
 
-local ret opt display_opt sqlite3
+local opt display_opt sqlite3 ign
 local -a options output_modes exclusive dashes
 
 [[ $service = sqlite3 ]] && sqlite3=true || unset sqlite3
@@ -31,16 +31,18 @@ for display_opt in $output_modes ; do
   options+=( "($exclusive)"$^dashes"-${opt}[set output mode to $display_opt]" )
 done
 
+(( $#words == 2 )) || ign='!'
 options+=(
   $^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]'
+  "$ign(- :)"$^dashes'-version[show SQLite version]'
+  "$ign(- :)"$^dashes'-help[show help]'
   '1:SQLite database file:_files'
-  '(- :)2:SQL to run'
+  '(- :)2: :_guard "^-*" "SQL to run"'
 )
 
 (( $+sqlite3 )) && options+=(
+  $^dashes'-A+[run .archive with arguments and exit]'
   $^dashes'-append[append the database to the end of the file]'
   $^dashes'-bail[stop after hitting an error]'
   $^dashes'-cmd[run specified command before reading stdin]:sqlite meta-command'
@@ -53,6 +55,23 @@ options+=(
   $^dashes'-readonly[open the database read-only]'
   $^dashes'-stats[print memory stats before each finalize]'
   $^dashes'-vfs[use specified default VFS]:vfs:(unix-dotfile unix-excl unix-none unix-namedsem)'
+  $^dashes'-zip[open the file as a ZIP Archive]'
 )
 
+if [[ -n $words[(r)-A*] ]]; then
+  options=( -s -w : '(-A --A)'${^dashes}-A "(-f --file -a --append)"${(M)options:#1:*}
+    '(-v --verbose)'{-v,--verbose}'[print each filename as it is processed]'
+    '(1 -a --append -f --file)'{-f+,--file=}'[specify archive file]:archive file:_files'
+    '(1 -a --append -f --file)'{-a,--append=}'[operate on specified file opened using the apndvfs VFS]:archive file:_files'
+    '(-C --directory)'{-C+,--directory=}'[change to specified directory to read/extract files]:directory:_directories'
+    '(-n --dryrun)'{-n,--dryrun}'[show the SQL that would have occurred]'
+    '*:file:_files'
+    + '(commands)' \
+    '(-c --create)'{-c,--create}'[create a new archive]'
+    '(-u --update)'{-u,--update}'[update or add files to an existing archive]'
+    '(-t --list)'{-t,--list}'[list contents of archive]'
+    '(-x --extract)'{-x,--extract}'[extract files from archive]'
+  )
+fi
+
 _arguments $options
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index b7e10c06b..e16be7e59 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -26,7 +26,7 @@ _svn () {
 
   _arguments -C -A "-*" \
     '(-)--help[print help information]' \
-    '(- *)--version[print client version information]' \
+    '(*)--version[print client version information]' \
     '1: :->cmds' \
     '*:: :->args' && ret=0
 
@@ -169,6 +169,9 @@ _svn () {
               '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"'
             )
           ;;
+	  (unshelve)
+	    args+=( '1:shelf name:compadd - ${${(f)"$(_call_program shelves svn unshelve -q --list)"}%%      *}' )
+	  ;;
           (*)
             case $usage in
               *(SRC|DST|TARGET|URL*PATH)*)
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 730959e84..ae3446a08 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -235,6 +235,7 @@ _tmux-choose-client() {
 _tmux-choose-tree() {
   [[ -n ${tmux_describe} ]] && print "put a window into tree choice mode" && return
   _arguments -s \
+    '-G[include all sessions in any session groups in the tree rather than only the first]' \
     '-N[start without the preview]' \
     '-F+[specify format for each list item]:format:__tmux-formats' \
     '-f+[filter items]:filter format:__tmux-formats' \
@@ -562,6 +563,8 @@ _tmux-paste-buffer() {
 _tmux-pipe-pane() {
   [[ -n ${tmux_describe} ]] && print "pipe output from a pane to a shell command" && return
   _arguments -s -A "-*" -S \
+    '-I[write stdout from command to the pane as if it were typed]' \
+    '-O[pipe output from the pane to the command (default unless -I used)]' \
     '-o[only open a pipe if none is currently opened]' \
     '-t+[specify target pane]:pane:__tmux-panes' \
     ':shell command:_cmdstring'
@@ -658,12 +661,13 @@ _tmux-save-buffer() {
 }
 
 _tmux-select-layout() {
-  [[ -n ${tmux_describe} ]] && print "choose a layout for a window" && return
+  [[ -n ${tmux_describe} ]] && print "choose a layout for a pane" && return
   _arguments -s -A "-*" -S \
+    '-E[spread the current pane and any panes next to it out evenly]' \
     '-n[behave like next-layout]' \
     '-o[revert to previous layout]' \
     '-p[behave like previous-layout]' \
-    '-t+[specify a target window]:target window:__tmux-windows' \
+    '-t+[specify a target pane]:target pane:__tmux-panes' \
     ':layout:(even-horizontal even-vertical main-horizontal main-vertical tiled)'
 }
 
diff --git a/Completion/Unix/Command/_user_admin b/Completion/Unix/Command/_user_admin
index 7eeec7e9b..fe28c13f5 100644
--- a/Completion/Unix/Command/_user_admin
+++ b/Completion/Unix/Command/_user_admin
@@ -150,6 +150,7 @@ case ${service%???}:${(M)service%???}:$OSTYPE in
   *:*:linux*)
     args+=(
       '(-R --root)'{-R,--root=}'[specify directory to chroot into]:directory:_directories'
+      '(-P --prefix)'{-P,--prefix=}"[specify root directory to apply changes in but don't chroot]:directory:_directories"
       '(-D -U -L -p --password)'{-p+,--password=}'[specify encrypted password]:encrypted password'
       '(-)'{-h,--help}'[display help information]'
     )
diff --git a/Completion/Unix/Command/_wget b/Completion/Unix/Command/_wget
index 1a7e2d0a3..2a4e722d8 100644
--- a/Completion/Unix/Command/_wget
+++ b/Completion/Unix/Command/_wget
@@ -22,6 +22,7 @@ _arguments -C -s \
   '(--config)--no-config' '--rejected-log=:file:_files' \
   '(--tries -t)'{--tries=,-t+}'[set number of retries]:number of retries' \
   '--retry-connrefused[retry even if connection is refused]' \
+  '--retry-on-http-error=[specify list of HTTP errors to retry]:http error' \
   '(--output-document -O)'{--output-document=,-O+}'[specify file to write documents to]:output file:_files' \
   '(--continue -c)'{--continue,-c}'[continue getting an existing file]'  \
   '--start-pos=:offset' '--show-progress' \
@@ -38,8 +39,7 @@ _arguments -C -s \
   '(--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]' \
-  '(--proxy -Y --no-proxy)--no-proxy[explicitly turn off proxy]' \
+  '--no-proxy[explicitly turn off proxy]' \
   '(--quota -Q)'{--quota=,-Q+}'[set retrieval quota]:number' \
   '--bind-address=[specify address to bind to (hostname or IP)]:bind address:_bind_addresses' \
   '--limit-rate=[specify limit to download rate]:download rate limit' \
@@ -48,7 +48,7 @@ _arguments -C -s \
   '--ignore-case[ignore case when matching files/directories]' \
   '(-4 --inet4-only -6 --inet6-only)'{-4,--inet4-only}'[connect only to IPv4 addresses]' \
   '(-4 --inet4-only -6 --inet6-only)'{-6,--inet6-only}'[connect only to IPv6 addresses]' \
-  '--prefer-family[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \
+  '--prefer-family=[connect first to addresses of specified family]:address family:(IPv6 IPv4 none)' \
   '(--http-user --ftp-user)--user[set both ftp and http user]:user' \
   '(--http-password --ftp-password)--password[set both ftp and http password]:password' \
   '(--password --http-password --ftp-password)--ask-password:[prompt for passwords]' \
@@ -67,7 +67,7 @@ _arguments -C -s \
   '(--user)--http-user=:user' \
   '(--password --ask-password)--http-password=:password' \
   '--no-cache[disallow server-cached data]' \
-  '--default-page=[specify default page name, normally index.html]' \
+  '--default-page=[specify default page name, normally index.html]:default page [index.html]' \
   '(--adjust-extension -E)'{--adjust-extension,-E}'[save all HTML/CSS documents with proper extensions]' \
   "--ignore-length[ignore \`Content-Length' header field]" \
   '*--header=[send a custom HTTP header]:header:->header' \
@@ -93,7 +93,7 @@ _arguments -C -s \
   "--auth-no-challenge[send basic HTTP authentication without first waiting for server's challenge]" \
   '--secure-protocol=[choose secure protocol]:protocol:(SSLv2 SSLv3 TLSv1 TLSv1_1 TLSv1_2 PFS)' \
   --https-only \
-  "--no-check-certificate=[don't check the server certificate]" \
+  "--no-check-certificate[don't check the server certificate]" \
   '--certificate=[specify client certificate]:client certificate file:_files' \
   '--certificate-type=[specify client certificate type]:certificate type:(PEM DER)' \
   '--private-key=[specify private key file]:key file:_files' \
@@ -104,6 +104,7 @@ _arguments -C -s \
   '--pinnedpubkey=:file:_files' \
   '--random-file[specify file with random data for seeding generator]:file:_files' \
   '--egd-file=[specify filename of EGD socket]:file:_files' \
+  '--ciphers=[set the priority string (GnuTLS) or cipher list string (OpenSSL) directly]:string' \
   '--no-hsts[disable HSTS]' \
   '--hsts-file[specify path of HSTS database]:file:_files' \
   '(--user)--ftp-user=:user' \
diff --git a/Completion/Unix/Command/_xxd b/Completion/Unix/Command/_xxd
index 1b1613a64..0034be519 100644
--- a/Completion/Unix/Command/_xxd
+++ b/Completion/Unix/Command/_xxd
@@ -26,7 +26,7 @@ arguments=(
   '(         -E -EBCDIC -i -include -p -postscript -plain -ps -r -revert              )'{-E,-EBCDIC}'[print human-readable part in EBCDIC rather than ASCII]'
   '(-i -include -p -postscript -plain -ps -r -revert)'{-e,-endian}'[little-endian dump]'
   '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -r -revert              )'{-i,-include}'[output in C include file style]'
-  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps                         )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]'
+  '(-b -bits -E -EBCDIC -i -include -p -postscript -plain -ps -C -capitalize          )'{-p,-postscript,-plain,-ps}'[read or write a plain hexdump (no line numbers or ASCII rendering)]'
 
   '(-b -bits -E -EBCDIC -i -include                           -r -revert -u -uppercase)'{-r,-revert}'[reverse mode\: read a hex dump and output binary data]'
   '(-b -bits                                                  -r -revert -u -uppercase)'{-u,-uppercase}'[output upper-case hex digits]'
@@ -34,7 +34,7 @@ arguments=(
   '(- :)'{-h,-help}'[display usage message]'
   '(- :)'{-v,-version}'[show program version]'
   '*'{-a,-autoskip}"[a single '*' replaces runs of NUL (toggleable)]"
-
+  '(-C -capitalize)'{-C,-capitalize}'[capitalize variable names in C include file style]'
   {-c+,-cols}'[specify number of octets per line]: :_guard "[0-9a-fA-Fx]#" "number of octets per line"'
   {-g+,-groupsize}'[specify the number of octets per group]: :_guard "[0-9]#" "number of octets per group"'
   {-l+,-len}'[specify number of octets to output]: :_guard "[0-9]#" "number of octets to output"'
diff --git a/Completion/X/Command/_qiv b/Completion/X/Command/_qiv
index d10407584..35ceec09a 100644
--- a/Completion/X/Command/_qiv
+++ b/Completion/X/Command/_qiv
@@ -5,7 +5,9 @@ _arguments -s \
   '(- *)'{-v,--version}'[display version information]' \
   '--display:display:_x_display' \
   \*{-F,--file}'[read file names from file]:file:_files' \
+  '(-B --browse)'{-B,--browse}'[scan directory of file for browsing]' \
   '(-e --center)'{-e,--center}'[disable window centering]' \
+  '(-C --cycle)'{-C,--cycle}"[don't cycle after last image]" \
   '(-w --fixed_width -W --fixed_zoom)'{-w,--fixed_width}'[use window with specified width]:width' \
   '(-w --fixed_width -W --fixed_zoom)'{-W,--fixed_zoom}'[use window with specified zoom factor]:zoom (percentage)' \
   '(-x -y -z --root --root_t --root_s -f --file *)'{-x,--root}'[use image as the current desktop background, centered]:image file:_files' \
@@ -13,6 +15,7 @@ _arguments -s \
   '(-x -y -z --root --root_t --root_s -f --file *)'{-z,--root_s}'[use image as the current desktop background, stretched]:image file:_files' \
   '(-m --maxpect)'{-m,--maxpect}'[expand image to fit screen size]' \
   '(-t --scale_down)'{-t,--scale_down}'[shrink images to fit screen size]' \
+  "--trashbin[move files to user's trash bin instead of .qiv-trash when deleting]" \
   '(-b --brightness)'{-b,--brightness}'[set brightness]:brightness (-32..32)' \
   '(-c --contrast)'{-c,--contrast}'[set contrast]:contrast (-32..32)' \
   '(-g --gamma)'{-g,--gamma}'[set gamma]:gamma (-32..32)' \
@@ -21,7 +24,7 @@ _arguments -s \
   '(-i --no_statusbar -I --statusbar)'{-I,--statusbar}'[enable statusbar]' \
   '(-p --transparency)'{-p,--transparency}'[enable transparency]' \
   '(-a --do_grab)'{-a,--do_grab}'[grab the pointer in windowed mode]' \
-  '(-G --disable_grab)'{-G,--disable_grab}'[disable pointer grabbing]' \
+  '(-G --disable_grab)'{-G,--disable_grab}'[disable pointer grabbing in fullscreen mode]' \
   '(-o --bg_color)'{-o,--bg_color}'[set root background color]:color:_x_color' \
   '(-s --slide)'{-s,--slide}'[start slideshow immediately]' \
   '(-r --random)'{-r,--random}'[shuffle images for slideshow]' \
@@ -31,6 +34,17 @@ _arguments -s \
   '(-f --fullscreen)'{-f,--fullscreen}'[use fullscreen window on startup]' \
   '(-P --ignore_path_sort)'{-P,--ignore_path_sort}'[sort images by just the filename]' \
   '(-M --merged_case_sort)'{-M,--merged_case_sort}'[sort images case-insensitively]' \
-  '(-N --numeric_sort)'{-N,--numeric_sort}'[numeric image sort]' \
+  '(-K --mtime_sort)'{-K,--mtime_sort}'[sort images by their modification time]' \
+  '(-N --numeric_sort -K --mtime_sort)'{-N,--numeric_sort}'[numeric image sort]' \
+  '(-D --no_sort -N --numeric_sort -K --mtime_sort -M --merged_case_sort -P --ignore_path_sort)'{-D,--no_sort}"[don't apply any sorting to the images]" \
   '(-T --watch)'{-T,--watch}'[reload the image if it changes]' \
-  '*:image file:_files -g "*.(#i)(bmp|eim|gif|jp([eg]|eg)|pcx|png|p[pngb]m|tif(|f)|tga|x[pb]m)(-.)"'
+  '(-u --recursivedir)'{-u,--recursivedir}'[recursively include all files]' \
+  '(-L --followlinks)'{-L,--followlinks}'[follow symlinks to directories]' \
+  '(-A --select_dir)'{-A,--select_dir}'[store selected files in specified directory]:directory [.qiv-select]:_directories' \
+  '(-l --autorotate)'{-l,--autorotate}"[don't autorotate JPEGs according to EXIF rotation tag]" \
+  '(-q --rotate)'{-q,--rotate}'[rotate image]:angle:((1\:90 2\:180 3\:270))' \
+  '(-X --xineramascreen)'{-X,--xineramascreen}'[specify preferred screen]:screen' \
+  '(-Y --source_profile)'{-Y,--source_profile}'[specify colour profile file as source profile]:colour profile file:_files' \
+  '(-Z --display_profile)'{-Z,--display_profile}'[specify colour profile file as display profile]:colour profile file:_files' \
+  '--vikeys[enable movement with h/j/k/l]' \
+  '*:image file:_files -g "*.(#i)(bmp|eim|gif|ico|jp([eg]|eg)|pcx|png|p[pngb]m|pjpeg|svg|tif(|f)|wmf|x[pb]m)(-.)"'
diff --git a/Completion/Zsh/Command/_which b/Completion/Zsh/Command/_which
index c43704ae8..9b789c86b 100644
--- a/Completion/Zsh/Command/_which
+++ b/Completion/Zsh/Command/_which
@@ -1,6 +1,6 @@
 #compdef which whence where type
 
-local farg aarg cargs args state line curcontext="$curcontext" ret=1
+local farg aarg xarg cargs args state line curcontext="$curcontext" ret=1
 
 cargs=( \
   '(-v -c)-w[print command type]' \
@@ -11,6 +11,7 @@ cargs=( \
   '*:commands:->command' )
 farg='-f[output contents of functions]'
 aarg='-a[print all occurrences in path]'
+xarg='-x+[specify spaces to use for indentation in function expansion]:spaces'
 
 case ${service} in
   whence)
@@ -19,8 +20,8 @@ case ${service} in
       '(-v -w)-c[csh-like output]' \
       "${cargs[@]}" "$farg" "$aarg" && ret=0
   ;;
-  where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;;
-  which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;;
+  where) _arguments -C -s -A "-*" -S "${cargs[@]}" "$xarg" && ret=0;;
+  which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$xarg" && ret=0;;
   type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;;
 esac
 
diff --git a/Completion/Zsh/Command/_zed b/Completion/Zsh/Command/_zed
index 211dae7df..6b68fadf0 100644
--- a/Completion/Zsh/Command/_zed
+++ b/Completion/Zsh/Command/_zed
@@ -5,5 +5,6 @@ case $service in
 (zed) _arguments -S : \
 	'(- 2):file:_files' \
 	'(1):shell function:_functions' \
+	'(1)-x+[specify spaces to use for indentation in function expansion]:spaces' \
 	'(1)-f[edit function]';;
 esac
-- 
cgit v1.2.3


From c919fa7f691fc18af1a9beb60b8426ebc2fc7eac Mon Sep 17 00:00:00 2001
From: Oliver Kiddle 
Date: Thu, 21 Jun 2018 14:57:39 +0200
Subject: 43078: add completion for the sed expression

---
 ChangeLog                    |   3 +
 Completion/Unix/Command/_sed | 217 ++++++++++++++++++++++++++++++++++++++++---
 2 files changed, 209 insertions(+), 11 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index fff2b6d28..c05911bd1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-06-18  Oliver Kiddle  
 
+	* 43078: Completion/Unix/Command/_sed: add completion for the
+	sed expression
+
 	* 43073: Completion/Linux/Command/_cryptsetup,
 	Completion/Linux/Command/_sysstat, Completion/Linux/Command/_ss,
 	Completion/Linux/Command/_kpartx, Completion/Linux/Command/_tune2fs,
diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed
index 80218051b..f03278364 100644
--- a/Completion/Unix/Command/_sed
+++ b/Completion/Unix/Command/_sed
@@ -1,16 +1,60 @@
 #compdef sed gsed psed s2p
 
-local inplace extended
-local -a args aopts=( -A '-*' )
+local variant inplace extended ign sep separator
+local -i nest=0
+local -a args aopts sedexpr cmds_none cmds_slash cmds_end substflags expl bsnl nl labels excl dedup
+local -a step range negate mods
+aopts=( -A '-*' )
+bsnl=( $'\\\n' )
+nl=$'\n'
+compquote nl
 
+cmds_none=(
+  '{:start group'
+  'q:quit after printing pattern space'
+  'h:copy pattern space to hold space'
+  '\::place label'
+  '#:comment'
+  '=:print current line number'
+  'a:append text'
+  'i:insert text'
+  'r:append contents of file'
+  'b:branch'
+  't:branch if s command has been successful'
+  'c:replace line with text'
+  'l:list current line in visually unambiguous form'
+  'w:write pattern space to file'
+)
+cmds_slash=(
+  's:substitute regex'
+  'y:transliterate characters'
+)
+cmds_end=(
+  'd:delete pattern space'
+  'D:delete up to the first newline in the pattern space'
+  'g:copy hold space to pattern space'
+  'G:append hold space to pattern space'
+  'H:append pattern space to hold space'
+  'n:read the next line of input into pattern space'
+  'N:append the next line of input to the pattern space'
+  'p:print the current pattern space'
+  'P:print upto the first newline of the current pattern space'
+  'x:exchange hold and pattern spaces'
+  '}:end group'
+)
+substflags=(
+  'g:replace all matches to the regular expression'
+  'p:print new pattern space if substitution made'
+  'w:write result to named file if substitution made'
+)
 args=(
   '(-n --quiet --silent)'{-n,--quiet,--silent}'[suppress automatic printing of pattern space]'
-  '(1)*'{-e+,--expression=}'[specify sed commands to run]:sed script'
-  '(1)*'{-f+,--file=}'[add contents of file to commands to run]: :_files'
-  '(-e)1: :_guard "^-*" sed script'
+  '(1)*'{-e+,--expression=}'[specify sed commands to run]:sed script:_sed_expressions'
+  '(1)*'{-f+,--file=}'[add contents of file to commands to run]:file:_files'
+  '(-e)1:sed script:_sed_expressions'
   '*:input file:_files'
 )
-inplace='[edit files in-place, running scripts separately for each file]::suffix for backup'
+inplace='[edit files in-place, running scripts separately for each file]:: :_guard "^(*[@/; ]*|?(#c6,)|-*)" "suffix for backup"'
 extended='[use extended regular expressions]'
 
 if [[ $service = (psed|s2p) ]]; then
@@ -18,11 +62,12 @@ if [[ $service = (psed|s2p) ]]; then
     "${(@)args:#(|\(*\))(|\*)--*}"
     '-a[delay opening files listed with w function]'
   )
-elif _pick_variant gnu=GNU unix --version; then
+elif _pick_variant -r variant gnu=GNU unix --version; then
   aopts=( )
+  (( $#words > 2 )) && ign='!'
   args+=(
     '--follow-symlinks[follow symlinks when processing in place]'
-    '(-i --in-place)'{-i+,--in-place=}$inplace
+    '(-i --in-place -s --separate)'{-i-,--in-place=-}$inplace
     '(-c --copy)'{-c,--copy}'[copy instead of rename when shuffling files in in-place mode]'
     '(-l --line-length)'{-l+,--line-length=}'[specify line-wrap length for the l command]'
     '(-r)--posix[disable GNU extensions]'
@@ -31,9 +76,28 @@ elif _pick_variant gnu=GNU unix --version; then
     '--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]'
-    '(- 1 :)--version[print program version]'
+    "${ign}(- 1 :)--help[print program usage]"
+    "${ign}(- 1 :)--version[print program version]"
   )
+  if [[ -z ${words[(r)--posix]} ]]; then
+    cmds_none+=(
+      'R:append a line from file'
+      'T:branch if no s command has been successful'
+      'W:write the first line of pattern space to file'
+      'v:fail if GNU extensions not supported or older than specified version'
+    )
+    cmds_end+=(
+      "e:execute a command and include it's output"
+      'F:print the filename of the current input file'
+      'Q:quit'
+      'z:empty the pattern space'
+    )
+    substflags+=(
+      'e:execute pattern space as a command and replace with result'
+      {i,I}':case-insensitive regular expression matching'
+      {m,M}':multi-line matching'
+    )
+  fi
 else
   args=( "${(@)args:#(|\(*\))(|\*)--*}" )
   case $OSTYPE in
@@ -49,11 +113,142 @@ else
     freebsd*) args+=( '-u[disable data buffering]' ) ;|
     freebsd*|netbsd*)
       args+=(
-        '-I+[edit files in-place, treating all files as a single input stream]::suffix for backup'
+        '-I+[edit files in-place, treating all files as a single input stream]:: :_guard "^(*[@/; \\\]*|?(#c6,)|-*)" "suffix for backup"'
       )
     ;;
     openbsd*) args+=( '-u[make output line buffered]' ) ;;
   esac
 fi
 
+zstyle -s ":completion:${curcontext}:address-forms" list-separator separator || separator=--
+step=( "~ $separator step" )
+negate=( "! $separator negated" )
+range=( ", $separator range" )
+mods=( "I $separator case-insensitive" "M $separator multi-line" )
+
+sedexpr=(
+  \( /$'*\0[ \t\n]#'/ \) # strip off any preceding arguments - handled by _arguments
+  \(
+    # Handle an optional address range
+    \(
+      \(
+        \(
+          '///' '/[^/]#//' ':regexes:regex:' # skip /pattern/
+        \|
+          '/\\(?)/' -'sep=${match#?}' # handle \xpatternx
+          \( '/\?/' \| '/?/' -'[[ $match != $sep ]]' \) \# '/?/' -'[[ $match = $sep ]]' ':regexes:regex:'
+        \)
+        $'/[ \t]#/'
+        \( \| '/[IM]##/' -'dedup=( ${(s..)match} )' ':address-forms:address form:compadd -S "" -d mods -F dedup I M' \) \#
+      \|
+        '/([0-9]##|$)[ \t]#/' # line number
+        \(
+          '/\~[ \t]#/' # addr1~N
+          '/[0-9]##[ \t]#/' ': _message -e steps "number - match where line number is a multiple"'
+        \| '//' ':address-forms:address form:compadd -S "" -d step \~' \)
+      \|
+        '/[]/' ': _guard "^([sy]|[^0-9$/\\\]*)" "address - line number or /pattern/"'
+      \)
+      \( # range end, also optional
+        '/[ \t]#,[ \t]#/' -'excl=( \\\# : )' # exclude comments and labels after ranges
+        \(
+          '///' '/[^/]#//' ':regexes:regex:' # handle /pattern/
+        \|
+          '/\\(?)/' -'sep=${match#?}' # handle \xpatternx
+          \( '/\?/' \| '/?/' -'[[ $match != $sep ]]' \) \# '/?/' -'[[ $match = $sep ]]' ':regexes:regex - 2:'
+        \|
+          '/+[ \t]#/' # addr1,+N
+          '/[0-9]##/' ': _message -e number "number of following lines"'
+        \|
+          '/\~[ \t]#/' # addr1,~N
+          '/[0-9]##/' ': _message -e number "following lines until line number is a multiple of specified number"'
+        \|
+          '/([0-9]##|$)/' # line number
+        \|
+          '/[]/' ': _message -e ranges "ending line - [+~]number, $ or /pattern/"'
+        \)
+      \|
+        '//' -'excl=( \\\# : )' ':address-forms:address form:compadd -S "" -d range ,'
+      \)
+      \(
+        '/!/' ':address-forms:address form:compadd -S "" -d negate !'
+      \| \)
+    \| // -'excl=( \{ )' \) # { ... } is only useful following a range so exclude {
+
+    $'/[ \t]#/' -'(( nest )) || excl+=( \} )' # whitespace + exclude } without preceding {
+    \( # First commands, for which the pattern fully terminates them
+      '/e[ \t]#/' $'/((\\\n|\\[^\n]|[^\\\n])##\n|[\n;])/' ':commands:command:_cmdstring' # GNU extension
+    \|
+      $'/{[ ;\t\n]#/' -'((++nest,1))' # opening brace
+    \|
+      '/\#/' # comments
+      $'/[^\n]##\n[\n; \t]#/' ':comments:comment:'
+    \|
+      $'/[aci]/' # a, c and i commands
+      \(
+        $'/[ \t]#/' -'[[ $variant = gnu && $+opt_args[--posix] = 0 ]]' # GNU allows, e.g. 'c string'
+      \|
+        $'/[ \t]#/' $'/\\\n/' ':newlines:newline:compadd -Q -S "" "$bsnl"'
+      \)
+      $'/(\\\n|\\[^\n]|[^\\\n])##\n[\n; \t]#/' ':strings:string:'
+    \|
+      $'/[RrwW][ \t]#/' $'/[^\n]##\n[\n; \t]#/' ':files:file:_files -S ""'
+    \| # Now commands with shared termination handling
+      \(
+        # branches/labels, GNU sed allows an empty label
+        $'/[:btT][ \t]#/' $'/[^ \t\n;]#/' $'%[ \t\n;]%' -'labels+=( $match )'
+            ':labels:label: _wanted -x labels expl label compadd -S "" -a labels'
+      \|
+        '/l/' $'/[ \t]#<->/' ':width:width:'
+      \|
+        '/s(?)/' -'sep=${match#s}' # Substitutions
+        \( '/\\?/' \| '/?/' -'[[ $match != $sep ]]' \) \#
+        '/?/' -'[[ $match = $sep ]]' ':regexes:source regex:'
+        \( '/\\?/' \| '/?/' -'[[ $match != $sep ]]' \) \#
+        '/?/' -'[[ $match = $sep ]]' ':regexes:substitute string (back-references with & and \1 .. \9):'
+        \( # Substitution flags
+          $'/w[ \t]#/' $'/[^\n]##/' $'%\n%' ':files:file:_files -S ""'
+        \|
+          # pass existing flags, building exclusion list from them
+          $'/[gpiImM0-9]#/' -'excl=( ${(s..)${${${match/[iI]/iI}/[mM]/mM}}/e/ew} )'
+          \(
+            '//' -'[[ -z ${excl[(r)[0-9]]} ]]' # exclude if numbers already there
+            '//' '%[^egpiImM0-9]%' ': _message -e numbers "number - substitute nth match"'
+          \|
+            '//' '%[^egpiImM0-9]%' $':flags:flag: _describe -t flags flag substflags -S "" -F excl'
+          \)
+        \)
+      \|
+        '/y(?)/' -'sep=${match#y}' # Character transliterations
+        \( '/\?/' \| '/?/' -'[[ $match != $sep ]]' \) \# '/?/' -'[[ $match = $sep ]]' ':source:source:'
+        \( '/\?/' \| '/?/' -'[[ $match != $sep ]]' \) \# '/?/' -'[[ $match = $sep ]]' ':dest:dest:'
+      \|
+        '/[qQ]/' -'[[ $variant = gnu && $+opt_args[--posix] = 0 ]]'
+        $'/[\t ]#<->/' '%[^0-9]%' ':exit-codes:exit code:'
+      \|
+        '/[=dDFhHgGnNpPqQxz]/' # stand-alone commands that take no argument
+        \( $'/[ \t]#/' $'%[#\n;}]%' \| $'/[ \t]/' '/[]/' ': _message "no arguments"' \| \)
+      \|
+        $'/v[ \t]#/' $'/[^\n;}]#/' $'%[\n;}]%' ':versions:version:'
+      \|
+        $'/}[ \t]#/' -'((--nest,1))' # closing }
+      \|
+        /'[]'/ ':commands:command: _describe -t sed-commands "sed command" cmds_none -S "" -F excl -- cmds_slash -S / -- cmds_end -F excl -r \; -S $nl'
+      \)
+      $'/[ \t]#/'
+      \( $'/}[ \t]#/' -'((--nest,1))' \| \) # closing } is allowed by GNU sed without preceding ; or newline
+      \(
+       '/\#/' $'/[^\n]##\n[\n; \t]#/' ':comments:comment:' # line end comments
+      \|
+        # add in and auto-removable newline if command is terminated
+        $'/[;\n][ ;\t\n]#/' $':separators:separator:compadd -r ";" -S $nl ""'
+      \|
+        $'/{[ \t]#/' -'((++nest,1))' # opening {, keep count of nesting level
+      \)
+    \)
+  \) \#
+)
+
+_regex_arguments _sed_expressions "$sedexpr[@]"
+
 _arguments -s -S $aopts : "$args[@]"
-- 
cgit v1.2.3


From 03b2cd1bb013212d1f6c2b897156ac87b455c2ee Mon Sep 17 00:00:00 2001
From: Eitan Adler 
Date: Tue, 19 Jun 2018 23:54:55 +0000
Subject: 43074: Completion for additional linker options for clang and
 sanitizers for gcc

---
 ChangeLog                    |  3 +++
 Completion/Unix/Command/_gcc | 21 +++++++++++----------
 2 files changed, 14 insertions(+), 10 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index c05911bd1..fe2f3192c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-06-18  Oliver Kiddle  
 
+	* 43074: Eitan: Completion/Unix/Command/_gcc: Completion for
+	additional linker options for clang and sanitizers for gcc
+
 	* 43078: Completion/Unix/Command/_sed: add completion for the
 	sed expression
 
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 9690df79f..5817318f6 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -338,7 +338,6 @@ h8/300)
   ;;
 esac
 
-local -a sanitizers
 if [[ "$service" = clang* ]]; then
     args=(
         $args
@@ -349,21 +348,23 @@ if [[ "$service" = clang* ]]; then
         -fshow-column -fshow-source-location -fcaret-diagnostics -fdiagnostics-fixit-info
         -fdiagnostics-parseable-fixits -fdiagnostics-print-source-range-info
         -fprint-source-range-info -fdiagnostics-show-option -fmessage-length
-    )
-    sanitizers=(
-        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
-        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
-        nullability-return object-size pointer-overflow return unsigned-integer-overflow
-        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
+        "-nostdinc[Do not search standard system directories or compiler builtin directories for include files]"
+        "-nostdlibinc[Do not search standard system directories for include files]"
+        "-nobuiltininc[Do not search builtin directory for include files]"
     )
 else
     args=(
       '-flto=-[Enable link-time optimization]::jobs:'
     )
+fi
+
+local -a sanitizers
     sanitizers=(
-        address memory
+        address alignment bool bounds enum float-cast-overflow float-divide-by-zero
+        integer-divide-by-zero memory nonnull-attribute null nullability-arg nullability-assign
+        nullability-return object-size pointer-overflow return unsigned-integer-overflow
+        returns-nonnull-attribute shift signed-integer-overflow unreachable vla-bound vptr
     )
-fi
 
 local -a languages
 languages=(
@@ -965,7 +966,7 @@ args+=(
 args+=(
   '-nostartfiles[Do not use the standard system startup files when linking]'
   '-nodefaultlibs[Do not use the standard system libraries when linking]'
-  '-nostdlib[Do not use the standard system startup files or libraries when linking]'
+  '-nostdlib[Do not use standard system startup files or libraries when linking]'
   '-rdynamic[Pass the flag -export-dynamic to the ELF linker, on targets that support it]'
   '-s[Remove all symbol table and relocation information from the executable]'
   '-static[On systems that support dynamic linking, this prevents linking with the shared libraries]'
-- 
cgit v1.2.3


From a0233a74e3677941f07bf4efba3cbd6fd3e9b918 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Mon, 25 Jun 2018 11:04:31 +0900
Subject: 43079, 43086: new utility to complete names of running processes

And new completions for dtruss, fs_usage and sc_usage.
---
 ChangeLog                           |  7 ++++++
 Completion/Darwin/Command/_fs_usage | 28 +++++++++++++++++++++++
 Completion/Darwin/Command/_sc_usage | 10 +++++++++
 Completion/Unix/Command/_dtruss     | 18 +++++++++++++++
 Completion/Unix/Type/_process_names | 44 +++++++++++++++++++++++++++++++++++++
 5 files changed, 107 insertions(+)
 create mode 100644 Completion/Darwin/Command/_fs_usage
 create mode 100644 Completion/Darwin/Command/_sc_usage
 create mode 100644 Completion/Unix/Command/_dtruss
 create mode 100644 Completion/Unix/Type/_process_names

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 7e8fcfe75..0d262243a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-06-25  Jun-ichi Takimoto 
+
+	* 43079, 43086: Completion/Unix/Type/_process_names,
+	Completion/Unix/Command/_dtruss, Completion/Darwin/Command/_fs_usage,
+	Completion/Darwin/Command/_sc_usage: new utility to complete names
+	of running processes, and three new completion functions which use it.
+
 2018-06-24  dana  
 
 	* unposted: Completion/Linux/Command/_opkg: Fix mistyped variable
diff --git a/Completion/Darwin/Command/_fs_usage b/Completion/Darwin/Command/_fs_usage
new file mode 100644
index 000000000..956816169
--- /dev/null
+++ b/Completion/Darwin/Command/_fs_usage
@@ -0,0 +1,28 @@
+#compdef fs_usage
+
+local curcontext="$curcontext" state state_descr line ret=1
+typeset -A opt_args
+
+_arguments -s -C -A '-*' : \
+  '-e[exclude fs_usage and the specified processes from sampling]' \
+  '-w[use wider output]' \
+  '*-f+[specify output filtering mode]:mode:(nework filesys pathname exec diskio cachehit)' \
+  '-b[annotate disk I/O events with BootCache info]' \
+  '(-R -S -E)-t+[specify run timeout]:seconds' \
+  '(-t)-R+[specify raw trace file to process]:raw trace file:_files' \
+  '(-t)-S+[specify time to begin processing the trace file]:seconds' \
+  '(-t)-E+[specify time to stop processing the trace file]:seconds' \
+  '*: :->pid-or-pname' && ret=0
+
+case $state in
+  (pid-or-pname)
+    if [[ -z $opt_args[-R] ]]; then
+      _alternative "processes:: _pids" \
+		  "processes-names:: _process_names -a" && ret=0
+    else
+      _message 'pid or process name in the trace file' && ret=0
+    fi
+    ;;
+esac
+
+return ret
diff --git a/Completion/Darwin/Command/_sc_usage b/Completion/Darwin/Command/_sc_usage
new file mode 100644
index 000000000..3a11a1bff
--- /dev/null
+++ b/Completion/Darwin/Command/_sc_usage
@@ -0,0 +1,10 @@
+#compdef sc_usage
+
+_arguments -s -A '-*' : \
+  '-c+[specify code file to use]:code file:_files' \
+  '-e[sort output by call count]' \
+  '-l[use scrolling output style instead of window updating style]' \
+  '-s+[specify sampling interval]:seconds' \
+  '(- :)-E[specify command path and args to excute]: :_absolute_command_paths:*:: :_normal' \
+  '1: : _alternative "processes:: _pids"
+	"processes-names:: _process_names -a"'
diff --git a/Completion/Unix/Command/_dtruss b/Completion/Unix/Command/_dtruss
new file mode 100644
index 000000000..bd1ae8bc5
--- /dev/null
+++ b/Completion/Unix/Command/_dtruss
@@ -0,0 +1,18 @@
+#compdef dtruss
+
+_arguments -s : \
+  '-a[print all details]' \
+  '-b+[specify dynamic variable buffer size]:buffer size (default 4m)' \
+  '-c[print system call counts]' \
+  '-d[print relative timestamps]' \
+  '-e[print elapsed times]' \
+  '-f[follow children as they are forked]' \
+  '-l[force printing of pid/lwpid per line]' \
+  "-L[don't print pid/lwpid per line]" \
+  '(-p :)-n+[examine processes with the specified name]: : _process_names -a' \
+  '-o[print on-cpu times]' \
+  '-s[print stack backtraces]' \
+  '(-n :)-p+[examine process with the specified pid]: : _pids' \
+  '-t+[examine only the specified syscall]: : _sys_calls' \
+  '1: : _command_names -e' \
+  '*:: : _normal'
diff --git a/Completion/Unix/Type/_process_names b/Completion/Unix/Type/_process_names
new file mode 100644
index 000000000..4f184ccb7
--- /dev/null
+++ b/Completion/Unix/Type/_process_names
@@ -0,0 +1,44 @@
+#autoload
+#
+# complete names of running processes
+#
+# options:
+#   -a: include all processes (owned by others, no tty, etc.)
+#   -t: use truncated process names (e.g., those in /proc/PID/stat)
+#				    (only on Linux and BSDs)
+#
+# this name has been used in _killall and documented in zshcompsys(1)
+local tagname='processes-names'
+typeset -a expl opts names all truncate
+
+zparseopts -E -D 'a=all' 't=truncate'
+(( $#all )) && opts=( -A )
+
+local hyphen='-'
+# on Linux, use BSD-style option to include processes on other ttys
+[[ $OSTYPE == linux* ]] && hyphen=''
+
+case $OSTYPE in
+  (linux*|freebsd*|openbsd*|netbsd*)
+    if (( $#truncate )); then
+      if [[ $OSTYPE == netbsd* ]]; then
+	opts+=(-co args=)
+      else
+	opts+=(${hyphen}o comm=)
+      fi
+      names=( ${${(f)"$(_call_program $tagname ps $opts 2>/dev/null)"}#-} )
+    else
+      opts+=(${hyphen}o args=)
+      names=( ${(f)"$(_call_program $tagname ps $opts 2>/dev/null )"} )
+      names=( ${${${${${names:#\[*]}%% *}%:}#-}:t}
+	       ${${${(M)names:#\[*]}#\[}%]} )
+    fi
+    ;;
+  (*)
+    # ignore -t option
+    opts+=(-o comm=)
+    names=( ${${${(f)"$(_call_program $tagname ps $opts 2>/dev/null)"}#-}:t} )
+    ;;
+esac
+
+_wanted $tagname expl 'process name' compadd "$@" -F '(ps)' -a - names
-- 
cgit v1.2.3


From 968cf17b2bb4d1dbed435fd57437ef8a8cb15841 Mon Sep 17 00:00:00 2001
From: Eric Cook 
Date: Wed, 27 Jun 2018 02:57:27 -0400
Subject: 43096: _vim: remove duplicate flag

---
 ChangeLog                    | 4 ++++
 Completion/Unix/Command/_vim | 1 -
 2 files changed, 4 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 51ebd1cc6..30369f08e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-06-27  Eric Cook  
+
+	* 43096: Eitan: Completion/Unix/Command/_vim, remove duplicate flag
+
 2018-06-25  Daniel Shahaf  
 
 	* 43091: Src/glob.c: In the (u) glob qualifier, expand and
diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index 042974338..9f2eacb1f 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -71,7 +71,6 @@ arguments=(
   '--startuptime[write startup timing messages to given file]:log file:_files'
   '--socketid[run GVIM in another window]'
   '-i[use specified viminfo file]:viminfo file [~/.viminfo]:_files'
-  '--clean[defaults, no plugins, no viminfo]'
   '(- *)'{-h,--help}'[print help and exit]'
   '(- *)--version[print version information and exit]'
   '(* -q)-t[edit file where tag is defined]:tag:_complete_tag'
-- 
cgit v1.2.3


From 3964c63d02638b60d337fdb119212c29ede19084 Mon Sep 17 00:00:00 2001
From: Daniel Hahler 
Date: Thu, 3 May 2018 12:26:18 +0200
Subject: 42746: _vim: handle special values for -u/-U

This is based on state=verbosity from the same file.
---
 ChangeLog                    |  5 +++++
 Completion/Unix/Command/_vim | 21 +++++++++++++++++++--
 2 files changed, 24 insertions(+), 2 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 30369f08e..26f0d882e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-06-27  Daniel Hahler  
+
+	* 42746: Completion/Unix/Command/_vim: _vim: handle special values for
+	-u/-U.
+
 2018-06-27  Eric Cook  
 
 	* 43096: Eitan: Completion/Unix/Command/_vim, remove duplicate flag
diff --git a/Completion/Unix/Command/_vim b/Completion/Unix/Command/_vim
index 9f2eacb1f..8853fac30 100644
--- a/Completion/Unix/Command/_vim
+++ b/Completion/Unix/Command/_vim
@@ -41,7 +41,7 @@ arguments=(
   '-T[set terminal type]:::_terminals'
   '--not-a-term[skip warning for input/output not being a terminal]'
   '--ttyfail[exit if input or output is not a terminal]'
-  '-u[use given vimrc file instead of default .vimrc]::rc file:_files'
+  '-u[use given vimrc file instead of default .vimrc]:config:->config'
   "--noplugin[don't load plugin scripts]"
   '-o-[number of windows to open (default: one for each file)]::window count: '
   '-O-[number of windows to vertically split open (default is one for each file)]::window count: '
@@ -89,7 +89,7 @@ arguments=(
   '--role[set unique role to identify main window]:role'
   '--socketid[open vim inside another GTK widget]:xid'
   '--echo-wid[echo window ID on stdout]'
-  '-U[use given gvimrc file instead of default .gvimrc]::rc file:_files'
+  '-U[use given gvimrc file instead of default .gvimrc]:gui config:->configgui'
 )
 
 _arguments -C -S $arguments && ret=0
@@ -119,6 +119,23 @@ elif [[ $state = verbosity ]]; then
     fi
     (( ret )) || break
   done
+elif [[ "$state" = config* ]]; then
+  _tags special files
+  local names=(
+      "NONE:'skip initialization from files and environment variables'"
+      "NORC:'same as NONE, but load plugins'"
+  )
+  # gvim only supports -U NONE to skip GUI initialization.
+  [[ $state != configgui || $service != *g* ]] && names+=(
+      "DEFAULTS:'same as NONE, but loads defaults.vim'"
+  )
+  while _tags; do
+    _requested special && _describe -V 'special' "(${(F)names})" && ret=0
+    if _requested files expl 'rc file'; then
+      _files "$expl[@]" && ret=0
+    fi
+    (( ret )) || break
+  done
 fi
 
 return ret
-- 
cgit v1.2.3


From bad472928166d118de10d9f03755d8958f158982 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Sun, 1 Jul 2018 22:41:15 +0900
Subject: 43107: add an option to _ttys to complete only open ttys

Use the option in _ps and _watch-snoop
---
 ChangeLog                           |  6 ++++++
 Completion/BSD/Command/_watch-snoop |  2 +-
 Completion/Unix/Command/_ps         |  4 ++--
 Completion/Unix/Type/_ttys          | 16 +++++++++++-----
 4 files changed, 20 insertions(+), 8 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 46b909d4d..e86b63e83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-01  Jun-ichi Takimoto 
+
+	* 43107: Completion/Unix/Type/_ttys, Completion/Unix/Command/_ps,
+	Completion/BSD/Command/_watch-snoop: add an option to _ttys to
+	complete only open ttys, and use it in _ps and _watch-snoop.
+
 2018-06-29  Peter Stephenson  
 
 	* users/23519: README, Completion/Unix/Type/_remote_files: Use tag
diff --git a/Completion/BSD/Command/_watch-snoop b/Completion/BSD/Command/_watch-snoop
index 182b6bb34..1a4af07cc 100644
--- a/Completion/BSD/Command/_watch-snoop
+++ b/Completion/BSD/Command/_watch-snoop
@@ -10,4 +10,4 @@ _arguments -w -S -s : \
   "-o[reconnect on overflow]" \
   "-t[print date and time at start]" \
   "-W[allow write access to observed tty]" \
-  ":tty device:_ttys -D"
+  "(-): : _ttys -Do"
diff --git a/Completion/Unix/Command/_ps b/Completion/Unix/Command/_ps
index a8208a365..72e711227 100644
--- a/Completion/Unix/Command/_ps
+++ b/Completion/Unix/Command/_ps
@@ -31,7 +31,7 @@ args=(
   '*-G+[select processes by real group]:group:_sequence -s , _groups'
   '*-g+[select processes by effective group or session]:group:_sequence -s , _groups'
   '*-s+[select processes by session leaders]:session leader:_sequence -s , _pids'
-  '*-t+[select processes by attached terminal]:tty:_sequence -s , _ttys -D'
+  '*-t+[select processes by attached terminal]:tty:_sequence -s , _ttys -Do'
   '*-u+[select processes by effective user]:user:_sequence -s , _users'
   '*-U+[select processes by real user]:user:_sequence -s , _users'
   '-o+[specify output format]:property:_sequence -s , _ps_props -'
@@ -211,7 +211,7 @@ if (( CURRENT > 1 )) && [[ $OSTYPE != (solaris*|linux-gnu) ||
     *J) _sequence _jails -0 && return ;;
     *[MNW]) _files && return ;;
     *t)
-      _wanted -C option-t-1 ttys expl tty _sequence -s , _ttys -D && return
+      _wanted -C option-t-1 ttys expl tty _sequence -s , _ttys -Do && return
     ;;
     *[pq]) _wanted -C "option-${words[CURRENT-1][-1]}-1" processes \
 	expl 'process ID' _sequence -s , _pids && return ;;
diff --git a/Completion/Unix/Type/_ttys b/Completion/Unix/Type/_ttys
index 5e5598570..7408395c8 100644
--- a/Completion/Unix/Type/_ttys
+++ b/Completion/Unix/Type/_ttys
@@ -4,16 +4,22 @@
 #
 # -d  strip /dev/ prefix from matches
 # -D  matches allowed with or without /dev/ prefix
+# -o  only complete those ttys to which processes are attached
 
 local -a ttys expl pre
-local stripdev optdev
+local stripdev optdev open
 
-zparseopts -D -K -E d=stripdev D=optdev
+zparseopts -D -K -E d=stripdev D=optdev o=open
 
-ttys=( /dev/tty?*(N) /dev/pts/^ptmx(N) )
-ttys=( ${ttys#/dev/} )
+if [[ -n $open ]]; then
+  ttys=( ${(u)${(f)"$(_call_program open-ttys ps -ao tty=)"}%% *} )
+  _description open-ttys expl 'open tty'
+else
+  ttys=( /dev/tty?*(N) /dev/pts/^ptmx(N) )
+  ttys=( ${ttys#/dev/} )
+  _description ttys expl 'tty'
+fi
 [[ -z $stripdev ]] && pre=( -p /dev/ )
 
-_description ttys expl 'tty'
 [[ -n $optdev ]] && compadd "$@" "$expl[@]" -M 'r:|/=* r:|=*' -a ttys && return
 compadd "$@" "$expl[@]" "$pre[@]" -M 'r:|/=* r:|=*' -a ttys
-- 
cgit v1.2.3


From e96e45ba98c2b0439544b994f4c87d49524adae9 Mon Sep 17 00:00:00 2001
From: Doron Behar 
Date: Mon, 18 Jun 2018 22:47:48 +0300
Subject: 43059: _gpg: Use explicit UIDs for state = public keys.

Use the `--with-colons` option and parse the output according to the
format specified in the documentation.
---
 ChangeLog                    |  5 ++++
 Completion/Unix/Command/_gpg | 62 +++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 7 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index e86b63e83..d323adcf6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-01  Doron Behar  
+
+	* 43059: Completion/Unix/Command/_gpg: Use explicit UIDs for
+	state = public keys.
+
 2018-07-01  Jun-ichi Takimoto 
 
 	* 43107: Completion/Unix/Type/_ttys, Completion/Unix/Command/_ps,
diff --git a/Completion/Unix/Command/_gpg b/Completion/Unix/Command/_gpg
index 48a36eff2..b35693d1f 100644
--- a/Completion/Unix/Command/_gpg
+++ b/Completion/Unix/Command/_gpg
@@ -206,20 +206,68 @@ fi
 
 case "$state" in
   public-keys)
-    _wanted public-keys expl 'public key' \
-	compadd ${${(Mo)$(_call_program public-keys $words[1] $needed --list-public-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
+    local public_keys_lines=(${(f)"$(_call_program public-keys ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)"})
+    local -a uids emails
+    local i j parts current_uid
+    for (( i = 1; i < ${#public_keys_lines[@]}; ++i )); do
+      parts=("${(@s.:.)public_keys_lines[$i]}")
+      if [[ ${parts[1]} == "fpr" ]]; then
+        current_uid="${parts[10]}"
+        i=$((i + 1))
+        parts=("${(@s.:.)public_keys_lines[$i]}")
+        while [[ ${parts[1]} == "uid" ]]; do
+          uids+=("${current_uid}")
+          emails+=("${parts[10]}")
+          i=$((i + 1))
+          parts=("${(@s.:.)public_keys_lines[$i]}")
+        done
+      fi
+    done
+    _describe -t public-keys 'public key' emails uids
   ;;
   secret-keys)
-    _wanted secret-keys expl 'secret key' compadd \
-	${${(Mo)$(_call_program secret-keys $words[1] $needed --list-secret-keys --list-options no-show-photos):%<*>}//(<|>)/} && return
+    local secret_keys_lines=(${(f)"$(_call_program secret-keys ${(q)words[1]} ${(q)needed} --list-secret-keys --list-options no-show-photos --with-colons)"})
+    local -a uids emails
+    local i j parts current_uid
+    for (( i = 1; i < ${#secret_keys_lines[@]}; ++i )); do
+      parts=("${(@s.:.)secret_keys_lines[$i]}")
+      if [[ ${parts[1]} == "fpr" ]]; then
+        current_uid="${parts[10]}"
+        i=$((i + 1))
+        parts=("${(@s.:.)secret_keys_lines[$i]}")
+        while [[ ${parts[1]} == "uid" ]]; do
+          uids+=("${current_uid}")
+          emails+=("${parts[10]}")
+          i=$((i + 1))
+          parts=("${(@s.:.)secret_keys_lines[$i]}")
+        done
+      fi
+    done
+    _describe -t secret-keys 'secret key' emails uids
   ;;
   ciphers)
     _wanted ciphers expl cipher compadd \
-        ${${(s.,.)${(M)${(f)${"$(_call_program ciphers $words[1] $needed --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return
+        ${${(s.,.)${(M)${(f)${"$(_call_program ciphers ${(q)words[1]} ${(q)needed} --version)"}//,$'\n' #/, }:#Cipher*}#*:}# } && return
   ;;
   (public-keyids)
-    _wanted public-keys expl 'public keyid' \
-      compadd ${(M)${${(f)"$(_call_program public-keyids $words[1] $needed --list-public-keys --list-options no-show-photos)"}## #}:#[0-9A-F](#c40)} && return
+    local public_keys_lines=(${(f)"$(_call_program public-keyids ${(q)words[1]} ${(q)needed} --list-public-keys --list-options no-show-photos --with-colons)"})
+    local -a uids emails
+    local i j parts current_uid
+    for (( i = 1; i < ${#public_keys_lines[@]}; ++i )); do
+      parts=("${(@s.:.)public_keys_lines[$i]}")
+      if [[ ${parts[1]} == "fpr" ]]; then
+        current_uid="${parts[10]}"
+        i=$((i + 1))
+        parts=("${(@s.:.)public_keys_lines[$i]}")
+        while [[ ${parts[1]} == "uid" ]]; do
+          uids+=("${current_uid}")
+          emails+=("${parts[10]}")
+          i=$((i + 1))
+          parts=("${(@s.:.)public_keys_lines[$i]}")
+        done
+      fi
+    done
+    _describe -t public-keyids 'public key' emails uids
   ;;
   (option-list)
     _sequence _wanted options expl option \
-- 
cgit v1.2.3


From 6ac79449d653142c2eff5ae64458a72de8b3431e Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Mon, 2 Jul 2018 17:41:39 +0900
Subject: 43108, 43121: _killall: complete various options

---
 ChangeLog                        |  5 +++
 Completion/Unix/Command/_killall | 78 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 78 insertions(+), 5 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index d323adcf6..191e2a156 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-02  Jun-ichi Takimoto 
+
+	* 43108, 43121: Completion/Unix/Command/_killall: complete
+	various options
+
 2018-07-01  Doron Behar  
 
 	* 43059: Completion/Unix/Command/_gpg: Use explicit UIDs for
diff --git a/Completion/Unix/Command/_killall b/Completion/Unix/Command/_killall
index 375b1bf74..6fdb0f277 100644
--- a/Completion/Unix/Command/_killall
+++ b/Completion/Unix/Command/_killall
@@ -1,9 +1,77 @@
 #compdef killall killall5
 
-if [[ $service = killall && "$OSTYPE" = (linux*|*bsd*|darwin*) ]]; then
-  _alternative \
-    'signals:: _signals -p' \
-    'processes-names:process:{ compadd "$expl[@]" ${${${${(f)"$(_call_program processes-names ps ${${EUID/(#s)0(#e)/xa}//[0-9]#/}ho command 2> /dev/null)"//[][\(\)]/}:#(ps|COMMAND|-*)}%%\ *}:t} }'
-else
+if [[ $service = killall5 || $OSTYPE != (linux|*bsd|dragonfly|darwin)* ]]; then
   _signals -p
+  return
+fi
+
+typeset -a opts args
+[[ $EUID = 0 || $_comp_priv_prefix[1] = sudo ]] && opts=( -a )
+
+if _pick_variant psmisc=PSmisc unix --version; then
+
+  local curcontext=$curcontext state state_descr line ret=1
+  typeset -A opt_args
+  args=(
+    '(-e --exact)'{-e,--exact}'[require exact match for names longer than 15 chars]'
+    '(-I --ignore-case)'{-I,--ignore-case}'[do case insensitive process name match]'
+    '(-g --process-group)'{-g,--process-group}'[kill the process group to which the process belongs]'
+    '(-i --interactive)'{-i,--interactive}'[interactively ask for confirmation before killing]'
+    '(- : *)'{-l,--list}'[list all known signal names]'
+    '(-n --ns)'{-n+,--ns=}'[match against the PID namespace of the given PID]: : _pids'
+    '(-o --older-than)'{-o+,--older-than=}'[match only processes older than the specified time]:time:->time'
+    '(-q --quiet)'{-q,--quiet}'[do not complain if no processes were killed]'
+    '(-r --regexp)'{-r,--regexp}'[interpret process name as extended regular expression]'
+    '(1 -s --signal)'{-s+,--signal=}'[send the specified signal]: : _signals'
+    '(-u --user)'{-u+,--user=}'[kill only processes owned by specified user]: : _users'
+    '(-v --verbose)'{-v,--verbose}'[report if the signal was successfully sent]'
+    '(-w --wait)'{-w,--wait}'[wait for all killed processes to die]'
+    '(- : *)'{-V,--version}'[display version information]'
+    '(-y --younger-than)'{-y+,--younger-than=}'[match only processes younger than the specified time]:time:->time'
+    "1: : _alternative 'signals: :_signals -p' 'processes-names: :_process_names $opts'"
+    "*: :_process_names $opts"
+  )
+  [[ $CURRENT = 2 || ( $CURRENT = 3 && $words[2] = (-Z|--context) ) ]] && \
+    args+=( '(-Z --context)'{-Z+,--context=}'[specify SELinux security context]:regex pattern: ' )
+
+  _arguments -s -S -C : $args && ret=0
+
+  case $state in
+    (time)
+      local -a units=( 's:seconds' 'm:minutes' 'h:hours' 'd:days'
+			'w:weeks' 'M:months' 'y:years' )
+      if compset -P '[0-9]##(|.[0-9]#)'; then
+	_alternative 'float-numbers:: _message "float number"' \
+		    'units:: _describe unit units' && ret=0
+      else
+	_message 'float number and unit' && ret=0
+      fi
+      ;;
+  esac
+
+  return ret
+
+else # bsd and darwin
+
+  if [[ $OSTYPE == (freebsd|dragonfly)* ]]; then
+    args=( '-j+[kill processes in specified jail]: :_jails -0' )
+    opts+=( -t )  # long process names must be truncated
+  fi
+  args+=(
+    '-v[be more verbose about what will be done]'
+    '-e[use effective user ID for -u option]'
+    '(- : *)-help[give a help on command usage and exit]'
+    '(- : *)-l[list names of available signals and exit]'
+    '-m[interpret specified name as a regular expression]'
+    '-s[show only what will be done, but do not send any signal]'
+    '-d[print info about processes matched, but do not send any signal]'
+    '-u+[limit to processes belonging to specified user]: : _users'
+    '-t+[limit to processes running on specified tty]: :_ttys -od'
+    "-c+[with -u or -t, limit to processes matching specified name]: :_process_names $opts"
+    '-z[do not skip zombies]'
+    "*: :_process_names $opts"
+    + '(signal)' -$signals[2,-3]
+  )
+  _arguments -s -S -A '-*' : $args
+
 fi
-- 
cgit v1.2.3


From 6fe0c24fdbe0444df91a11794532752fc56c78db Mon Sep 17 00:00:00 2001
From: dana 
Date: Tue, 3 Jul 2018 20:04:59 -0500
Subject: 43105: Improve pgrep/pkill completion

Contains minor changes to signal completion compared to the patch as originally
posted
---
 ChangeLog                      |   5 ++
 Completion/Unix/Command/_pgrep | 181 +++++++++++++++++++++++++++--------------
 2 files changed, 125 insertions(+), 61 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index df94d8c45..f57dbec82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-03  dana  
+
+	* 43105 (tweaked): Completion/Unix/Command/_pgrep: Add full procps
+	support, other improvements
+
 2018-07-03  Peter Stephenson  
 
 	* dana: 43134: Completion/Unix/Type/_signals: don't complete SIG
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index ec3f8bfd0..b6020e5a9 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -1,75 +1,134 @@
 #compdef pgrep pkill
 
-local curcontext="$curcontext" state line ret=1 expl
+# Notes:
+# - We assume that Linux systems use procps-ng — specifically, procps-ng >=3.3.4
+#   (which changed the behaviour of -f and added -a)
+# - We don't really need to keep pgopts and pkopts separate, but it seems like
+#   it should make things a bit easier to follow
+# - @todo We could complete log-in classes given to -c
+# - @todo We could complete routing tables given to -T
+
+local curcontext="$curcontext" state line ret=1 expl pgopts pkopts no
 typeset -A opt_args
-typeset -a arguments
-
-arguments=('-P[parent process id]:parent process id:->ppid'
-     '-F[match only in process in pidfile]:files:_files'
-     '-g[match only in process group ids]:group:->pgid'
-     '-G[match only real group id]:group:_groups'
-     '-j[match only in processes inside jails]:jail id:_sequence _jails -0 -o jid'
-     '-J[match only in project ids]:project id:->projid'
-     '-M[extract the name list from the specified core]:files:_files'
-     '-N[extract the name list from the specified system]:files:_files'
-     '-s[match only session id]:session id:->sid'
-     '-t[match only controlled by terminal]:terminal device:_sequence _ttys -d'
-     '-T[match only in processes specified routing table in rtable]'
-     '-u[match only effective user id]:user:_users'
-     '-U[match only real user id]:user:_users'
-     '(-n)-o[oldest process]'
-     '(-o)-n[newest process]'
-     '-a[include process ancestors in the match list]'
-     '-c[print a count of matching processes]'
-     '-f[match against full command line]'
-     '-i[ignore case distinctions]'
-     '-I[confirmation before attempting to single each process]'
-     '-L[given pidfile must be locked]'
-     '-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')
-
-if [[ $service == 'pgrep' ]]; then
-  arguments+=('-d[output delimiter]:delimiter:compadd ${(s\:\:)IFS}'
-        '-l[list name in addition to id]')
-fi
-
-local optchars
-case "$OSTYPE" in
+typeset -a arguments sig_arguments aopts
+
+# These arguments (a) are common to all variants (like -x), (b) are the most
+# common amongst all variants (like -a), or (c) have a single unambiguous
+# meaning amongst all variants (like --help). Many of them are filtered out or
+# overridden below
+arguments=(
+  '-a[include process ancestors in match list]'
+  '-c+[match only on specified login class]:login class'
+  '(-F --pidfile)'{-F+,--pidfile=}'[match only processes in specified PID file]:PID file:_files'
+  '(-f --full)'{-f,--full}'[match against full command line]'
+  '(-G --group)'{-G+,--group=}'[match only on specified real group IDs]: :_sequence _groups'
+  '(-g --pgroup)'{-g+,--pgroup=}'[match only on specified process group IDs]: :->pgid'
+  '(: * -)'{-h,--help}'[display help information]'
+  '-I[request confirmation before signalling each process]'
+  '-i[ignore case distinctions]'
+  '-J+[match only on specified project IDs]: :->projid'
+  '-j+[match only on specified jail IDs]:jail:_sequence _jails -0 -o jid'
+  '(-L --logpidfile)'{-L,--logpidfile}'[fail if PID file not locked (with -F)]'
+  '(-N)-M+[extract name list from specified core]:core file:_files'
+  '(-M)-N+[extract name list from specified system]:system file:_files'
+  '(-o -n --oldest --newest)'{-n,--newest}'[match newest process]'
+  '(-o -n --oldest --newest)'{-o,--oldest}'[match oldest process]'
+  '(-P --parent)'{-P+,--parent=}'[match only on specified parent process IDs]: :->ppid'
+  '(-l)-q[suppress normal output]'
+  '-S[search also in system processes (kernel threads)]'
+  '(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid'
+  # _signals is OK here — we do it differently below
+  '(ss)--signal=[specify signal to send to process]: :_signals -s'
+  '-T+[match only on specified routing table]:routing table'
+  '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]:terminal device:_sequence _ttys -d'
+  '(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users'
+  '(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users'
+  '(-v --inverse)'{-v,--inverse}'[negate matching]'
+  '(-x --exact)'{-x,--exact}'[match process name or command line (with -f) exactly]'
+  '--ns=[match only on same namespaces as specified PID]: :_pids'
+  '--nslist=[match only on specified namespaces (with --ns)]:namespace:(ipc mnt net pid user uts)'
+  '(: * -)'{-V,--version}'[display version information]'
+  '-z+[match only on specified zone IDs]:zone:_sequence _zones'
+)
+[[ $service == pgrep ]] && arguments+=(
+  '(-d --delimiter)'{-d+,--delimiter=}'[specify output delimiter]:delimiter:compadd ${(s<>)IFS}'
+  '(-q)-l[display process name (and arguments with -f)]'
+  '(-w --lightweight)'{-w,--lightweight}'[show all thread IDs instead of PID]'
+)
+[[ $service == pkill ]] && arguments+=(
+  '(-e --echo)'{-e,--echo}'[display signalled process]'
+  '-l[display kill command]'
+)
+
+case $OSTYPE in
   linux*)
-    optchars="cflvxdnoPgsuUGtw"
+    # Note: We deliberately exclude -v but not --inverse from pkill
+    pgopts=acdFfGghLlnoPstUuVvwx-
+    pkopts=ceFfGghLnoPstUuVx-
+    arguments=(
+      ${arguments:#((#s)|*\))(\*|)-[acl]*}
+      '(-c --count)'{-c,--count}'[display count of matching processes]'
+    )
+    [[ $service == pgrep ]] && arguments+=(
+      '(-a -l --list-full --list-name)'{-a,--list-full}'[display full command line]'
+      '(-a -l --list-full --list-name)'{-l,--list-name}'[display process name]'
+    )
     ;;
-  freebsd*)
-    optchars="LSafilnoqvxFGMNPUdgjstu"
+  dragonfly*|freebsd*)
+    pgopts=acdFfGgijLlMNnoPqSstUuvx
+    pkopts=acFfGgIijLlMNnoPstUuvx
     ;;
   openbsd*)
-    optchars="flnoqvxdGgPsTtUu"
+    pgopts=dfGglnoPqsTtUuvx
+    pkopts=fGgIlnoPqsTtUuvx
     ;;
   darwin*)
-    optchars="LafilnoqvxFGPUdgtu"
+    pgopts=adFfGgiLlnoPqtUuvx
+    pkopts=aFfGgIiLlnoPtUuvx
     ;;
   solaris*)
-    optchars="flvxdnoPgsuUGJtTcz"
-    arguments=( ${arguments##-T*} )
-    arguments=( ${arguments##-c*} )
-    arguments+=( '-T[match only processes in task ids]:taskid:->task' )
-    arguments+=( '-c[match only processes in contract ids]:taskid:->contract' )
+    pgopts=cdfGgJlnoPsTtUuvxz
+    pkopts=cfGgJnoPsTtUuvxz
+    arguments=(
+      ${arguments:#((#s)|*\))(\*|)-[cT]*}
+      '-c+[match only on specified contract IDs]: :->contract'
+      '-T+[match only on specified task IDs]: :->task'
+    )
     ;;
   *)
-    optchars="flvxdnoPgsuUGt"
+    pgopts=dfGgilnPstUuvx
+    pkopts=fGgilnPstUuvx
     ;;
 esac
-# Only keep relevant arguments according to $optchars.
-arguments=( ${(M)arguments:#(|\*)(|\(*\))-[$optchars]*}
-     '*:process name:->pname')
-if [[ $service == 'pkill' ]]; then
-  arguments+=('-'${^signals}'[signal]')
+
+if [[ $service == pgrep ]]; then
+  arguments=( ${(M)arguments:#((#s)|*\))(\*|)-[$pgopts]*} )
+else
+  arguments=( ${(M)arguments:#((#s)|*\))(\*|)-[$pkopts]*} )
+
+  # Signals on non-Linux systems can only be completed as the first argument
+  (( CURRENT != 2 )) && [[ $OSTYPE != linux* ]] && no='!'
+
+  # This is used for exclusion with --signal
+  sig_arguments=( + '(ss)' )
+
+  # This is very similar to _signals, but i've avoided it here because it
+  # doesn't behave the way i want it to
+  sig_arguments+=( $no'(--signal)-'${^signals[2,-3]} )
+  sig_arguments+=( '!(--signal)-'{0..$(( $#signals - 3 ))} )
+
+  # Complete the -SIG* variant if it's requested
+  if [[ $PREFIX$SUFFIX == -S* ]]; then
+    sig_arguments+=( '(--signal)-SIG'${^${(@)signals[2,-3]:#<->}} )
+  else
+    sig_arguments+=( '!(--signal)-SIG'${^${(@)signals[2,-3]:#<->}} )
+  fi
 fi
 
-_arguments -C -s -w $arguments && ret=0
+arguments+=( $sig_arguments + o '*: :->pname' )
+
+[[ $OSTYPE == linux* ]] || aopts+=( -A '*-' )
+_arguments -C -s -S $aopts : $arguments && ret=0
 
 case $state in
   (sid)
@@ -87,7 +146,7 @@ case $state in
       sid=(${(uon)$(ps -A -o sid=)})
     fi
 
-    _wanted sid expl 'session id' compadd -S ',' -q -F used $sid
+    _wanted sid expl 'session ID' compadd -S ',' -q -F used $sid
     ;;
 
   (ppid)
@@ -101,7 +160,7 @@ case $state in
       ppid=(${(uon)$(ps -A -o ppid=)})
     fi
 
-    _wanted ppid expl 'parent process id' compadd -S ',' -q -F used $ppid
+    _wanted ppid expl 'parent process ID' compadd -S ',' -q -F used $ppid
     ;;
 
   (pgid)
@@ -115,7 +174,7 @@ case $state in
       pgid=(${(uon)$(ps -A -o pgid=)})
     fi
 
-    _wanted pgid expl 'process group id' compadd -S ',' -q -F used $pgid
+    _wanted pgid expl 'process group ID' compadd -S ',' -q -F used $pgid
     ;;
 
   (projid)
@@ -125,7 +184,7 @@ case $state in
     used=(${(s:,:)IPREFIX})
     projid=(${(uon)$(ps -A -o project=)})
 
-    _wanted projid expl 'project id' compadd -S ',' -q -F used $projid
+    _wanted projid expl 'project ID' compadd -S ',' -q -F used $projid
     ;;
 
   (contract)
@@ -135,7 +194,7 @@ case $state in
     used=(${(s:,:)IPREFIX})
     ctid=(${(uon)$(ps -A -o ctid=)})
 
-    _wanted ctid expl 'contract id' compadd -S ',' -q -F used $ctid
+    _wanted ctid expl 'contract ID' compadd -S ',' -q -F used $ctid
     ;;
 
   (task)
@@ -145,7 +204,7 @@ case $state in
     used=(${(s:,:)IPREFIX})
     taskid=(${(uon)$(ps -A -o project=)})
 
-    _wanted taskid expl 'task id' compadd -S ',' -q -F used $taskid
+    _wanted taskid expl 'task ID' compadd -S ',' -q -F used $taskid
     ;;
 
   (pname)
-- 
cgit v1.2.3


From 7facf9695078c9ae5d16d0bf4dd11ed0e0b5edb4 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Wed, 11 Jul 2018 00:10:24 +0900
Subject: 43155: _gcc: escape ':' in action for -std

---
 ChangeLog                    | 4 ++++
 Completion/Unix/Command/_gcc | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 6e17484aa..3ca47e16e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-07-10  Jun-ichi Takimoto 
+
+	* 43155: Completion/Unix/Command/_gcc: escape : in action for -std
+
 2018-07-10  Peter Stephenson  
 
 	* 43156, 43157: Src/exec.c: need to allow for possible
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 5817318f6..5fcd020bd 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -415,7 +415,7 @@ args+=(
   '-print-file-name=-[Display the full path to library ]:library:->library'
   '-print-prog-name=-[Display the full path to compiler component ]:program:'
   '*-specs=-[Override built-in specs with the contents of ]:file:_files'
-  '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899:1990 iso9899:199409 c99 iso9899:1999 c11 iso9899:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899:2017 gnu++17 c++2a gnu++2a)'
+  '-std=-[assume that the input sources are for specified standard]:standard:(c90 c89 iso9899\:1990 iso9899\:199409 c99 iso9899\:1999 c11 iso9899\:2011 gnu90 gnu89 gnu99 gnu11 c++98 c++03 gnu++98 gnu++03 c++11 gnu++11 c++1y gnu++1y c++14 gnu++14 c++1z gnu++1z c++17 iso9899\:2017 gnu++17 c++2a gnu++2a)'
   '*-include:include file:_files -g \*.h\(-.\)'
   '*-imacros:macro input file:_files -g \*.h\(-.\)'
   '*-idirafter:second include path directory:_files -/'
-- 
cgit v1.2.3


From 5f2d265b3a9eddb14076cad595bd9f05b03fa069 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Wed, 11 Jul 2018 22:34:03 +0900
Subject: 43164: _gcc: fix 'args=' to 'args+=', and update a few options

---
 ChangeLog                    |  5 +++++
 Completion/Unix/Command/_gcc | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 3ca47e16e..39504af85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-11  Jun-ichi Takimoto 
+
+	* 43164: Completion/Unix/Command/_gcc: fix 'args=' to 'args+=',
+	and update a few options.
+
 2018-07-10  Jun-ichi Takimoto 
 
 	* 43155: Completion/Unix/Command/_gcc: escape : in action for -std
diff --git a/Completion/Unix/Command/_gcc b/Completion/Unix/Command/_gcc
index 5fcd020bd..5b97b8c30 100644
--- a/Completion/Unix/Command/_gcc
+++ b/Completion/Unix/Command/_gcc
@@ -339,8 +339,7 @@ h8/300)
 esac
 
 if [[ "$service" = clang* ]]; then
-    args=(
-        $args
+    args+=(
         "-flto=-[generate output files suitable for link time optimization]::style:(full thin)"
         -emit-llvm
         "-Qunused-arguments[don't emit warning for unused driver arguments]"
@@ -353,7 +352,7 @@ if [[ "$service" = clang* ]]; then
         "-nobuiltininc[Do not search builtin directory for include files]"
     )
 else
-    args=(
+    args+=(
       '-flto=-[Enable link-time optimization]::jobs:'
     )
 fi
@@ -383,7 +382,6 @@ languages=(
 
 # generic options (from --help)
 args+=(
-  -a -C -H -P -s
   '-###[print commands to run this compilation]'
   '-o:output file:_files -g "^*.(c|h|cc|C|cxx)(-.)"'
   '-x[Specify the language of the following input files]:input file language:('"$languages"')'
@@ -395,6 +393,10 @@ args+=(
   '*-A-:define assertion:'
   '*-D-:define macro:'
   '*-U-:undefine macro:'
+  '-C[do not discard comments during preprocess]'
+  '-CC[do not discard comments, including macro expansion]'
+  '-P[inhibit generation of linkemakers during preprocess]'
+  '-H[print name of each header file used]'
   '-E[Preprocess only; do not compile, assemble or link]'
   '-S[Compile only; do not assemble or link]'
   '-c[Compile and assemble, but do not link]'
-- 
cgit v1.2.3


From 73a3ad345c6915aff3ead289da36f0dbece28591 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Wed, 18 Jul 2018 00:38:10 +0900
Subject: 43177: _grep: support bzgrep, and add a few options for macOS

---
 ChangeLog                     |  5 +++++
 Completion/Unix/Command/_grep | 20 +++++++++++++-------
 2 files changed, 18 insertions(+), 7 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 060db0507..147eb359e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-18  Jun-ichi Takimoto 
+
+	* 43177: Completion/Unix/Command/_grep: support bzgrep, and add
+	a few options for macOS.
+
 2018-07-17  Peter Stephenson  
 
 	* unposted: Doc/Makefile.in: remove ftp_sites.yo.
diff --git a/Completion/Unix/Command/_grep b/Completion/Unix/Command/_grep
index 5f45ce9a8..3bc8d3fe0 100644
--- a/Completion/Unix/Command/_grep
+++ b/Completion/Unix/Command/_grep
@@ -1,4 +1,4 @@
-#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep -value-,GREP_OPTIONS,-default-
+#compdef grep egrep fgrep bsdgrep zgrep zegrep zfgrep ggrep gegrep gfgrep gzgrep gzegrep gzfgrep bzgrep bzegrep bzfgrep -value-,GREP_OPTIONS,-default-
 
 local arguments matchers command variant
 
@@ -11,13 +11,15 @@ else
   arguments=( '(-e --regexp -f --file)1: :_guard "^-*" pattern' )
   if [[ $service = z* ]]; then
     arguments+=( '*:files:_files -g "*.gz(-.)"' )
+  elif [[ $service = bz* ]]; then
+    arguments+=( '*:files:_files -g "*.bz2(-.)"' )
   else
     arguments+=( '*:files:_files' )
   fi
   command="$words[1]"
 fi
 
-if [[ $service != (|g)(|z)[ef]grep ]]; then
+if [[ $service != (|g|z|gz|bz)[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]'
@@ -66,7 +68,7 @@ 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+=(
+    [[ $service != (|g|z|gz|bz)[ef]grep ]] && arguments+=(
       $matchers{--perl-regexp,-P}'[use perl regular expression]'
     )
   ;|
@@ -76,15 +78,19 @@ case $variant:$OSTYPE in
       '(-z --null-data)'{-z,--null-data}'[input data separated by 0 byte, not newline]'
     )
   ;|
-  gpl2:freebsd*)
+  gpl2:(freebsd|darwin)*)
     arguments+=(
       '(--null --no-filename -h)--null[print 0 byte after each filename]'
+      '(-Z --decompress -J --bz2decompress)'{-J,--bz2decompress}"[decompress bzip2'ed input before searching]"
+      '(-Z --decompress -J --bz2decompress)'{-Z,--decompress}"[decompress gzip'ed input before searching]"
     )
   ;|
-  gpl2:(freebsd|darwin)*)
+  gpl2: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]"
+      '(-p -S)-O[follow symlinks on the command line]'
+      '(-O -S)-p[do not follow symlinks]'
+      '(-O -p)-S[follow all symlinks]'
+      '*--include-dir=[only search directories matching specified pattern]:directory pattern'
     )
   ;|
   (gnu:*|gpl2:netbsd*))
-- 
cgit v1.2.3


From 6ae241c43a12a1639195b31ea7649ae9643dd4c7 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Wed, 18 Jul 2018 17:13:11 +0900
Subject: 43182: _lldb: complete process name after option -n

---
 ChangeLog                     | 3 +++
 Completion/Unix/Command/_lldb | 5 +++--
 2 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 91e854f6a..cc3fe358c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,9 @@
 	* 43177: Completion/Unix/Command/_grep: support bzgrep, and add
 	a few options for macOS.
 
+	* 43182: Completion/Unix/Command/_lldb: complete process name
+	after option -n/--attach-name
+
 2018-07-17  Peter Stephenson  
 
 	* unposted: Doc/Makefile.in: remove ftp_sites.yo.
diff --git a/Completion/Unix/Command/_lldb b/Completion/Unix/Command/_lldb
index 16e346cfb..0426f69f2 100644
--- a/Completion/Unix/Command/_lldb
+++ b/Completion/Unix/Command/_lldb
@@ -2,7 +2,8 @@
 
 local curcontext=$curcontext state state_descr line expl ret=1
 typeset -A opt_args
-local -a args
+typeset -a opts args
+[[ $EUID = 0 || $_comp_priv_prefix[1] = sudo ]] && opts=( -a )
 
 args=(
   '*'{-o+,--one-line=}'[run one-line lldb command after loading executable]:lldb command: '
@@ -29,7 +30,7 @@ args=(
     '(-c --core)'{-c+,--core=}'[specify core file to open]:core file:_files -g "*core*(-.)"'
     '*::executable and arguments:->exe_args'
   - name
-    '(-n --attach-name)'{-n+,--attach-name=}'[attach to the named process]:process name'
+    '(-n --attach-name)'{-n+,--attach-name=}"[attach to the named process]: :_process_names $opts"
     '(-w --wait-for)'{-w,--wait-for}'[wait for the specified process to launch]'
   - pid
     '(-p --attach-pid)'{-p+,--attach-pid=}'[attach to the specified process]:pid:_pids'
-- 
cgit v1.2.3


From 2a8ecbd2d3d444138b7a488d5d6b8ad860f8fd6f Mon Sep 17 00:00:00 2001
From: Yasuhiro KIMURA 
Date: Thu, 19 Jul 2018 13:08:17 +0900
Subject: 43187: Fix completion error about 'm' option of 'install' command

---
 ChangeLog                        | 5 +++++
 Completion/Unix/Command/_install | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index cc3fe358c..da38d4760 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-19  Yasuhiro KIMURA  
+
+	* 43187: Completion/Unix/Command/_install: Fix completion error
+	about 'm' option of 'install' command
+
 2018-07-17  Peter Stephenson  
 
 	* Doron Behar: 43166: Completion/Unix/Type/_pspdf,
diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install
index f5056b5d0..4feb34ebf 100644
--- a/Completion/Unix/Command/_install
+++ b/Completion/Unix/Command/_install
@@ -11,7 +11,7 @@ common_args=(
   '(-C -c --compare)-c[copy files (default)]'
   '(-d --directory)'{-d,--directory}'[create directories]'
   '(-g --group)'{-g+,--group=}'[specify destination file group]: :_groups'
-  '(-m --mode)'{-m+,--mode=}'[specify destination file mode]: :_modes'
+  '(-m --mode)'{-m+,--mode=}'[specify destination file mode]: :_file_modes'
   '(-o --owner)'{-o+,--owner=}'[specify destination file owner]: :_users'
   '(-p --preserve-timestamps)'{-p,--preserve-timestamps}'[preserve modification times]'
   '(-s --strip)'{-s,--strip}'[strip binaries]'
-- 
cgit v1.2.3


From 71bc1296edfc548751354f4bf5832aba3fcd0b95 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Thu, 19 Jul 2018 17:04:09 +0900
Subject: 43189: _install: similar fix as 43187 for option -f

---
 ChangeLog                        | 5 +++++
 Completion/Unix/Command/_install | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index da38d4760..d068f5e35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-19  Jun-ichi Takimoto 
+
+	* 43189: Completion/Unix/Command/_install: similar fix as 43187
+	for option -f (_flags was renamed to _file_flags)
+
 2018-07-19  Yasuhiro KIMURA  
 
 	* 43187: Completion/Unix/Command/_install: Fix completion error
diff --git a/Completion/Unix/Command/_install b/Completion/Unix/Command/_install
index 4feb34ebf..80a1b0c00 100644
--- a/Completion/Unix/Command/_install
+++ b/Completion/Unix/Command/_install
@@ -41,7 +41,7 @@ else
   args+=(
     ${common_args##((#s)|*\))(\*|)--*}
     '-B+[specify backup suffix for -b]:backup suffix'
-    '-f+[specify destination file flags]: :_flags'
+    '-f+[specify destination file flags]: :_file_flags'
   )
   [[ $OSTYPE == dragonfly* ]] && args+=(
     '!-D+[no effect (compatibility with NetBSD)]: :_directories'
-- 
cgit v1.2.3


From 218a7e324dc52e5b9f2e724c1463fb0643a6036f Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Thu, 19 Jul 2018 17:26:11 +0900
Subject: 43183: fix '_ttys -o' and use it in _gdb/_pgrep

---
 ChangeLog                      | 4 ++++
 Completion/Unix/Command/_gdb   | 4 ++--
 Completion/Unix/Command/_pgrep | 2 +-
 Completion/Unix/Type/_ttys     | 2 +-
 4 files changed, 8 insertions(+), 4 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index d068f5e35..8a37503ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,10 @@
 	* 43189: Completion/Unix/Command/_install: similar fix as 43187
 	for option -f (_flags was renamed to _file_flags)
 
+	* 43183: Completion/Unix/Type/_ttys, Completion/Unix/Command/_gdb,
+	Completion/Unix/Command/_pgrep: fix '_ttys -o' on Linux, and use
+	it in _gdb and _pgrep.
+
 2018-07-19  Yasuhiro KIMURA  
 
 	* 43187: Completion/Unix/Command/_install: Fix completion error
diff --git a/Completion/Unix/Command/_gdb b/Completion/Unix/Command/_gdb
index 510e6f1fa..18f797633 100644
--- a/Completion/Unix/Command/_gdb
+++ b/Completion/Unix/Command/_gdb
@@ -5,12 +5,12 @@ local cur="$words[CURRENT]" prev w list ret=1 expl
 [[ "$PREFIX" = --* ]] &&
     _arguments -- '*=(CORE|SYM)FILE:core file:_files' \
 		  '*=EXECFILE:executable:_files -g \*\(-\*\)' \
-		  '*=TTY:terminal device:_ttys' && return 0
+		  '*=TTY: :_ttys -o' && return 0
 
 if compset -P '-(cd|directory)='; then
   _files -/
 elif compset -P '-tty='; then
-  _wanted devices expl 'terminal device' _ttys
+  _ttys -o
 elif compset -P '-(exec|se)='; then
   _description files expl executable
   _files "$expl[@]" -g '*(-*)'
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index b6020e5a9..86aef3462 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -40,7 +40,7 @@ arguments=(
   # _signals is OK here — we do it differently below
   '(ss)--signal=[specify signal to send to process]: :_signals -s'
   '-T+[match only on specified routing table]:routing table'
-  '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]:terminal device:_sequence _ttys -d'
+  '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do'
   '(-U --uid)'{-U+,--uid=}'[match only on specified real user IDs]: :_sequence _users'
   '(-u --euid)'{-u+,--euid=}'[match only on specified effective user IDs]: :_sequence _users'
   '(-v --inverse)'{-v,--inverse}'[negate matching]'
diff --git a/Completion/Unix/Type/_ttys b/Completion/Unix/Type/_ttys
index 7408395c8..3c40466cb 100644
--- a/Completion/Unix/Type/_ttys
+++ b/Completion/Unix/Type/_ttys
@@ -12,7 +12,7 @@ local stripdev optdev open
 zparseopts -D -K -E d=stripdev D=optdev o=open
 
 if [[ -n $open ]]; then
-  ttys=( ${(u)${(f)"$(_call_program open-ttys ps -ao tty=)"}%% *} )
+  ttys=( ${(u)${${(f)"$(_call_program open-ttys ps -Ao tty=)"}:#\?*}%% *} )
   _description open-ttys expl 'open tty'
 else
   ttys=( /dev/tty?*(N) /dev/pts/^ptmx(N) )
-- 
cgit v1.2.3


From 3ec9503f496a25cef96bd3ca42bf88d5a71322de Mon Sep 17 00:00:00 2001
From: dana 
Date: Thu, 19 Jul 2018 21:17:30 -0500
Subject: 43186: Add completion for cronie/dcron/Vixie crontab

Minor change from the patch as posted to the ML: BusyBox variant detection has
been expanded to cover dcron (which BusyBox's crontab is forked from).
---
 ChangeLog                        |  5 +++
 Completion/Unix/Command/_crontab | 68 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)
 create mode 100644 Completion/Unix/Command/_crontab

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 8a37503ba..21a910ae3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-19  dana  
+
+	* 43186 (tweaked): Completion/Unix/Command/_crontab: Add completion
+	for cronie/dcron/Vixie crontab
+
 2018-07-19  Jun-ichi Takimoto 
 
 	* 43189: Completion/Unix/Command/_install: similar fix as 43187
diff --git a/Completion/Unix/Command/_crontab b/Completion/Unix/Command/_crontab
new file mode 100644
index 000000000..cda7549a1
--- /dev/null
+++ b/Completion/Unix/Command/_crontab
@@ -0,0 +1,68 @@
+#compdef crontab
+
+# Notes:
+# - We assume a cronie-, dcron-, or Vixie-esque crontab
+# - BusyBox crontab is forked from dcron
+# - Generally only the super-user can use -c/-u; we aren't that restrictive
+# - @todo As usual, BusyBox multi-call isn't handled
+
+local variant sluser
+local -a args etargs ccargs clargs rcargs aopts
+
+_pick_variant -r variant \
+  dcron='-c*(#i)dir' \
+  cronie-selinux='(#i)selinux' \
+  cronie='(#i)cluster' \
+  unix --help
+variant+=-$OSTYPE
+
+# On Solaris, instead of using -u, the user can be specified as an optional
+# first operand with -e/-l/-r. We'll treat it as an optional *argument* to one
+# of those options, though, since the logic is a bit simpler
+if [[ $variant == *-solaris* ]]; then
+  sluser='::user whose crontab to work with:_users'
+else
+  etargs+=( '(cl)-u+[specify user whose crontab to work with]: :_users' )
+fi
+
+case $variant in
+  dcron-*)
+    etargs+=( '-c+[specify crontab directory]:crontab directory:_directories' )
+    ;;
+  cronie-selinux-*)
+    ccargs+=( '(-l cl nc rc)-s[append SELinux context (with -e)]' )
+    ;& # FALL THROUGH
+  cronie-*)
+    etargs+=( '(: * -)-V[display version information]' )
+    clargs+=(
+      '(: * -)-c[display cluster host]'
+      '(: * -)-n+[specify cluster host]: :_hosts'
+    )
+    ;& # FALL THROUGH
+  *-linux*)
+    rcargs+=( '(cc cl nc)-i[prompt for confirmation (with -r)]' )
+    ;;
+  *-freebsd*)
+    rcargs+=( '(cc cl nc)-f[bypass confirmation prompt (with -r)]' )
+    ;;
+esac
+
+(( $#etargs )) && args+=( + et $etargs ) # Misc.
+(( $#clargs )) && args+=( + cl $clargs ) # Work with cluster
+args+=(
+  + nc # Install new crontab
+  '(cc cl rc sl):crontab to install:_files'
+  + cc # Edit/display current crontab
+  "(-l cl nc rc)-e[edit current crontab]$sluser"
+  "(-e -s cl nc rc)-l[display current crontab]$sluser"
+  $ccargs
+  + rc # Remove current crontab
+  "(cc cl nc)-r[remove current crontab]$sluser"
+  $rcargs
+)
+
+# Implementations that use GNU's getopt(3) probably support permutation; this
+# should be accurate enough
+[[ $OSTYPE == linux* ]] || aopts=( -A '-*' )
+
+_arguments -s -S $aopts : $args
-- 
cgit v1.2.3


From e558f231310c55896d1fac3ad207c3a7ed3a1cf8 Mon Sep 17 00:00:00 2001
From: Jun-ichi Takimoto 
Date: Fri, 20 Jul 2018 18:40:05 +0900
Subject: 43192: _pgrep: simplify completions of list of IDs

---
 ChangeLog                      |   5 ++
 Completion/Unix/Command/_pgrep | 111 ++++++++---------------------------------
 2 files changed, 27 insertions(+), 89 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 21a910ae3..fced40fa9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-07-20  Jun-ichi Takimoto 
+
+	* 43192: Completion/Unix/Command/_pgrep: simplify the completions
+	of comma-separated list of IDs.
+
 2018-07-19  dana  
 
 	* 43186 (tweaked): Completion/Unix/Command/_crontab: Add completion
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index 86aef3462..3b4d082a7 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -1,7 +1,7 @@
 #compdef pgrep pkill
 
 # Notes:
-# - We assume that Linux systems use procps-ng — specifically, procps-ng >=3.3.4
+# - We assume that Linux systems use procps-ng - specifically, procps-ng >=3.3.4
 #   (which changed the behaviour of -f and added -a)
 # - We don't really need to keep pgopts and pkopts separate, but it seems like
 #   it should make things a bit easier to follow
@@ -26,7 +26,6 @@ arguments=(
   '(: * -)'{-h,--help}'[display help information]'
   '-I[request confirmation before signalling each process]'
   '-i[ignore case distinctions]'
-  '-J+[match only on specified project IDs]: :->projid'
   '-j+[match only on specified jail IDs]:jail:_sequence _jails -0 -o jid'
   '(-L --logpidfile)'{-L,--logpidfile}'[fail if PID file not locked (with -F)]'
   '(-N)-M+[extract name list from specified core]:core file:_files'
@@ -37,7 +36,7 @@ arguments=(
   '(-l)-q[suppress normal output]'
   '-S[search also in system processes (kernel threads)]'
   '(-s --session)'{-s+,--session=}'[match only on specified process session IDs]: :->sid'
-  # _signals is OK here — we do it differently below
+  # _signals is OK here - we do it differently below
   '(ss)--signal=[specify signal to send to process]: :_signals -s'
   '-T+[match only on specified routing table]:routing table'
   '(-t --terminal)'{-t+,--terminal=}'[match only on specified controlling terminals]: :_sequence _ttys -do'
@@ -87,11 +86,12 @@ case $OSTYPE in
     pkopts=aFfGgIiLlnoPtUuvx
     ;;
   solaris*)
-    pgopts=cdfGgJlnoPsTtUuvxz
-    pkopts=cfGgJnoPsTtUuvxz
+    pgopts=cdfGglnoPsTtUuvxz
+    pkopts=cfGgnoPsTtUuvxz
     arguments=(
       ${arguments:#((#s)|*\))(\*|)-[cT]*}
       '-c+[match only on specified contract IDs]: :->contract'
+      '-J+[match only on specified project IDs]: :->projid'
       '-T+[match only on specified task IDs]: :->task'
     )
     ;;
@@ -130,115 +130,48 @@ arguments+=( $sig_arguments + o '*: :->pname' )
 [[ $OSTYPE == linux* ]] || aopts+=( -A '*-' )
 _arguments -C -s -S $aopts : $arguments && ret=0
 
+# complete comma-separated list of various IDs
+# $1: tag, $2: description, $3: keyword for 'ps -o'
+_pgrep_sequence () {
+    _sequence _wanted $1 expl "$2" \
+	      compadd - ${(un)$(_call_program $1 ps -A -o $3=)}
+}
+
 case $state in
   (sid)
     if [[ $OSTYPE == openbsd* ]]; then
-      break
-    fi
-
-    compset -P '*,'
-
-    local -a used sid
-    used=(${(s:,:)IPREFIX})
-    if [[ $OSTYPE == freebsd* ]]; then
-      sid=(${(uon)$(ps -ax -o sid=)})
+      _message 'session ID'
     else
-      sid=(${(uon)$(ps -A -o sid=)})
+      _pgrep_sequence session-ids 'session ID' sid
     fi
-
-    _wanted sid expl 'session ID' compadd -S ',' -q -F used $sid
     ;;
-
   (ppid)
-    compset -P '*,'
-
-    local -a used ppid
-    used=(${(s:,:)IPREFIX})
-    if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then
-      ppid=(${(uon)$(ps -ax -o ppid=)})
-    else
-      ppid=(${(uon)$(ps -A -o ppid=)})
-    fi
-
-    _wanted ppid expl 'parent process ID' compadd -S ',' -q -F used $ppid
+    _pgrep_sequence ppids 'parent process ID' ppid
     ;;
-
   (pgid)
-    compset -P '*,'
-
-    local -a used pgid
-    used=(${(s:,:)IPREFIX})
-    if [[ $OSTYPE == (freebsd|openbsd|darwin)* ]]; then
-      pgid=(${(uon)$(ps -ax -o pgid=)})
-    else
-      pgid=(${(uon)$(ps -A -o pgid=)})
-    fi
-
-    _wanted pgid expl 'process group ID' compadd -S ',' -q -F used $pgid
+    _pgrep_sequence pgids 'process group ID' pgid
     ;;
-
   (projid)
-    compset -P '*,'
-
-    local -a used projid
-    used=(${(s:,:)IPREFIX})
-    projid=(${(uon)$(ps -A -o project=)})
-
-    _wanted projid expl 'project ID' compadd -S ',' -q -F used $projid
+    _pgrep_sequence project-ids 'project ID' project
     ;;
-
   (contract)
-    compset -P '*,'
-
-    local -a used ctid
-    used=(${(s:,:)IPREFIX})
-    ctid=(${(uon)$(ps -A -o ctid=)})
-
-    _wanted ctid expl 'contract ID' compadd -S ',' -q -F used $ctid
+    _pgrep_sequence contract-ids 'contract ID' ctid
     ;;
-
   (task)
-    compset -P '*,'
-
-    local -a used taskid
-    used=(${(s:,:)IPREFIX})
-    taskid=(${(uon)$(ps -A -o project=)})
-
-    _wanted taskid expl 'task ID' compadd -S ',' -q -F used $taskid
+    _pgrep_sequence task-ids 'task ID' taskid
     ;;
-
   (pname)
     local ispat="pattern matching "
     if (( ${+opt_args[-x]} )); then
       ispat=""
     fi
-
-    local command
     if (( ${+opt_args[-f]} )); then
-      if [[ "$OSTYPE" == freebsd* ]] && (( ${+opt_args[-S]} )); then
-        command="$(ps -axH -o command=)"
-      elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then
-        command="$(ps -ax -o command=)"
-      elif [[ "$OSTYPE" == solaris* ]]; then
-        command="$(ps -A -o args=)"
-      else
-        command="$(ps -A o cmd=)"
-      fi
-      _wanted pname expl $ispat'process command line' compadd ${(u)${(f)${command}}}
+      _wanted process-args expl $ispat'process command line' \
+	compadd ${${(f)"$(_call_program process-args ps -A -o args=)"}% *}
     else
-      if [[ "$OSTYPE" == freebsd* ]] && (( ${+opt_args[-S]} )); then
-        command="$(ps -axcH -o command=)"
-      elif [[ "$OSTYPE" == (freebsd|openbsd|darwin)* ]]; then
-        command="$(ps -axc -o command=)"
-      elif [[ "$OSTYPE" == solaris* ]]; then
-        command="$(ps -A -o comm=)"
-      else
-        command="$(ps -A co cmd=)"
-      fi
-      _wanted pname expl $ispat'process name' compadd ${(u)${(f)${command}}}
+      _wanted processes-names expl $ispat'process name' _process_names -a -t
     fi
     ;;
-
 esac && ret=0
 
 return ret
-- 
cgit v1.2.3


From 627c91357c29e6fbe8b32d1b5f17f02d555d8360 Mon Sep 17 00:00:00 2001
From: dana 
Date: Fri, 20 Jul 2018 11:15:32 -0500
Subject: 43196: Add completion for nginx

---
 ChangeLog                      |  4 ++++
 Completion/Unix/Command/_nginx | 20 ++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 Completion/Unix/Command/_nginx

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index fced40fa9..4fc87616b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-07-20  dana  
+
+	* 43196: Completion/Unix/Command/_nginx: Add completion for nginx
+
 2018-07-20  Jun-ichi Takimoto 
 
 	* 43192: Completion/Unix/Command/_pgrep: simplify the completions
diff --git a/Completion/Unix/Command/_nginx b/Completion/Unix/Command/_nginx
new file mode 100644
index 000000000..7d785c822
--- /dev/null
+++ b/Completion/Unix/Command/_nginx
@@ -0,0 +1,20 @@
+#compdef nginx
+
+local -ah signals=(
+  'quit\:shut down gracefully (SIGQUIT)'
+  'reload\:reload configuration (SIGHUP)'
+  'reopen\:re-open log files (SIGUSR1)'
+  'stop\:shut down quickly (SIGTERM)'
+)
+
+_arguments -s -S : \
+  '(: * -)'{-\?,-h}'[display help information]' \
+  '(: * -)-v[display version information]' \
+  '(: * -)-V[display version information and configure options]' \
+  '-c+[specify configuration file]:configuration file:_files' \
+  '-g+[specify global configuration directives]:configuration directives' \
+  '-p+[specify prefix path]:prefix path:_directories' \
+  '(-s)-q[suppress non-error messages (with -t/-T)]' \
+  "(-q -t -T)-s+[send specified signal to master process]:signal:((${(j< >)${(@q-)signals}}))" \
+  '(-s -T)-t[test configuration]' \
+  '(-s -t)-T[test and dump configuration]'
-- 
cgit v1.2.3


From 79153bec16073c6e28e6f22e260c79f98ad32e66 Mon Sep 17 00:00:00 2001
From: dana 
Date: Wed, 25 Jul 2018 12:10:11 -0500
Subject: 43203: Add completion for lua

---
 ChangeLog                    |  2 ++
 Completion/Unix/Command/_lua | 63 ++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 Completion/Unix/Command/_lua

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index b796c9313..207d42946 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-07-25  dana  
 
+	* 43203: Completion/Unix/Command/_lua: Add completion for lua
+
 	* Simon Ruderich: 43200: Completion/Linux/Command/_iptables: Add
 	completion for ip6tables*
 
diff --git a/Completion/Unix/Command/_lua b/Completion/Unix/Command/_lua
new file mode 100644
index 000000000..7254d3819
--- /dev/null
+++ b/Completion/Unix/Command/_lua
@@ -0,0 +1,63 @@
+#compdef lua -P lua[0-9.-]##
+
+# Complete lua library names. We go out of our way here to support sub-modules
+# (of the format foo.bar.baz), even though the way `lua -l` handles those isn't
+# very nice, because it might be useful for informational purposes
+(( $+functions[_lua_libraries] )) ||
+_lua_libraries() {
+  local p pre
+  local -a tmp tmp2
+
+  # Get Lua's library search path
+  tmp=( ${(s<;>)${(@f)"$(
+    _call_program library-path $words[1] -e '"print(package.path)"'
+  )"}} )
+  # Support C modules, which aren't explicitly included in the above
+  tmp+=( ${(@)${(@M)tmp:#*'?.lua'}/%.lua/.so} )
+
+  for p in ${(@u)tmp}; do
+    # Don't recurse infinitely into the current directory; we'll just trust
+    # that all other paths are sensible
+    if [[ $p == './?'* ]]; then
+      tmp=( ${~${${(b)p}/'\?'/'*'}}(#qN) )
+    else
+      tmp=( ${~${${(b)p}/'\?'/'**/*'}}(#qN) )
+    fi
+    tmp2+=( ${(@)tmp##${p%%'?'*}} )
+  done
+
+  tmp=( ${(@)tmp2%%(/init.lua|.lua|.so)} )
+  tmp=( ${(@u)${(@)tmp//\//.}} )
+
+  _wanted -x libraries expl 'Lua library' compadd -a "$@" - tmp
+}
+
+_lua() {
+  local ret=1
+  local -a context expl line state state_descr
+  local -A opt_args
+
+  # Stacking not supported, no arguments are exclusive except `-`
+  _arguments -S -A '-*' : \
+    '*-e+[execute specified command string]:command string' \
+    '-E[ignore environment variables]' \
+    '-i[enter interactive mode]' \
+    '*-l+[specify library or module to require]: :_lua_libraries' \
+    '-v[display version information]' \
+    '(1 -)-[stop argument parsing and execute script on stdin]' \
+    '1:Lua script:_files' \
+    '*:: :->arg' \
+  && ret=0
+
+  [[ $state == arg ]] &&
+  if [[ $line[1] == - ]]; then
+    _description files expl 'script argument'
+    _files "${(@)expl}" && ret=0
+  else
+    _normal && ret=0
+  fi
+
+  return ret
+}
+
+_lua "$@"
-- 
cgit v1.2.3


From 96ea5e32b442ff2406f1d7268cccdd73baf313ea Mon Sep 17 00:00:00 2001
From: dana 
Date: Tue, 31 Jul 2018 20:46:09 -0500
Subject: 43207: Improve _bind_addresses, _php

Minor change from the patch as posted to the ML: _php now calls _bind_addresses
with -K, since it can't actually listen on a link-local address.
---
 ChangeLog                            |   6 +
 Completion/Unix/Command/_php         | 234 +++++++++++++++++++++++++----------
 Completion/Unix/Type/_bind_addresses |  37 +++++-
 3 files changed, 211 insertions(+), 66 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index e8acff0eb..cf35c734f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2018-07-31  dana  
+
+	* 43207 (tweaked): Completion/Unix/Type/_bind_addresses,
+	Completion/Unix/Command/_php: Add options to control _bind_addresses
+	behaviour, improve PHP completion
+
 2018-07-31  Jun-ichi Takimoto 
 
 	* 43219 (except term{cap,info}.c): Src/Modules/db_gdbm.c,
diff --git a/Completion/Unix/Command/_php b/Completion/Unix/Command/_php
index d03f3395e..c4c4ab3e2 100644
--- a/Completion/Unix/Command/_php
+++ b/Completion/Unix/Command/_php
@@ -1,71 +1,177 @@
-#compdef php
+#compdef php -P php[0-9.-]
 
-# PHP 5.0.4  (cli)
-# PHP 4.3.11 (cli)
+# Notes:
+# - We make no distinction between internal and user functions
+# - We don't complete CGI options, which are rarely used interactively
+# - Exclusivity on some of the miscellaneous options isn't very accurate
+# - @todo Arguments to an -f script aren't completed accurately -- we need to
+#   massage words/CURRENT so that the -f arg becomes words[1], but if we just
+#   leave it at that the output will break if the script has any options of its
+#   own. We would want to complete script options only following `--`, as in
+#   `php -f /bin/foo -- -`
 
-local curcontext="$curcontext" line state expl
-typeset -A opt_args
+# Complete PHP class names
+(( $+functions[_php_classes] )) ||
+_php_classes() {
+  local cmd
+  local -a tmp
 
-local -a args
-local exclusions php_suffix
+  cmd='foreach ( get_declared_classes() as $c ) { echo "$c\n"; }'
+  tmp=( ${(f)"$( _call_program classes $words[1] -r ${(q)cmd} )"} )
 
-zstyle -s ":completion:${curcontext}:" suffixes php_suffix '|' || php_suffix='php|phar'
-local php_files=":PHP file:_files -g '*.($php_suffix)(-.)'"
+  _wanted -x classes expl 'PHP class' compadd -a "$@" - tmp
+}
+
+# Complete PHP extensions/module names; use --zend for Zend extensions only
+(( $+functions[_php_extensions] )) ||
+_php_extensions() {
+  local idx
+  local -a expl zend tmp
+
+  zparseopts -a zend -D -E -- -zend
+
+  # `php -m` lists all extensions under two sections called '[PHP Modules]' and
+  # '[Zend Modules]'. An extension can (but won't necessarily) exist under both
+  # of these at the same time
+  tmp=( ${(f)"$( _call_program extensions $words[1] -m )"} )
+  idx=${tmp[(i)\[Zend Modules\]]}
+
+  # Get only Zend extensions (for --rz)
+  if (( $#zend )); then
+    tmp=( ${(@)tmp[(idx+1),-1]} )
+  # Get PHP extensions (for everything else)
+  else
+    tmp=( ${(@)tmp[2,(idx-1)]} )
+  fi
+
+  _wanted -x extensions expl 'PHP extension' compadd -a "$@" - tmp
+}
+
+# Complete PHP function names
+(( $+functions[_php_functions] )) ||
+_php_functions() {
+  local cmd
+  local -a expl tmp
+
+  cmd='
+    foreach ( get_defined_functions() as $a ) {
+      foreach ( $a as $f ) {
+        echo "$f\n";
+      }
+    }
+  '
+  tmp=( ${(f)"$( _call_program functions $words[1] -r ${(q)cmd} )"} )
+
+  _wanted -x functions expl 'PHP function' compadd -a "$@" - tmp
+}
+
+_php() {
+  local curcontext=$curcontext php_suffix php_files ret=1
+  local -a context expl line state state_descr args
+  local -A opt_args
+
+  zstyle -s ":completion:${curcontext}:" suffixes php_suffix '|' ||
+  php_suffix='php|php5|phar'
+
+  php_files=":PHP file:_files -g '*.($php_suffix)(#q-.)'"
 
-if _pick_variant php5=PHP\ 5 php4 --version; then
-  exclusions="-B --process-begin -R --process-code -F --process-file -E --process-end"
   args=(
-    '(-B --process-begin -f --file -r --run 1)'{-B,--process-begin}'[run specified PHP code before processing input lines]:PHP code:'
-    '(-R --process-code -F --process-file -f --file -r --run 1)'{-R,--process-code}'[run specified PHP code for every input line]:PHP code:'
-    '(-F --process-file -R --process-code -f --file -r --run 1)'{-F,--process-file}'[parse and execute specified file for every input line]'$php_files
-    '(-E --process-end -f --file -r --run 1)'{-E,--process-end}'[run specified PHP code after processing all input lines]:PHP code:'
-    '(-H --hide-args)'{-H,--hide-args}'[hide any passed arguments from external tools]'
+    + mc # Misc. options
+    '(-a --interactive)'{-a,--interactive}'[run interactively]'
+    '*'{-d+,--define=}'[define INI directive]: :->directive'
+    '(-e --profile-info)'{-e,--profile-info}'[generate extended information for debugger/profiler]'
+    '(-H --hide-args)'{-H,--hide-args}'[hide script name and arguments from external tools]'
+    '(fi im pb pf rf rn sc sv *)--ini[display configured INI paths]'
+    # Note: PHP does not automatically prepend extension_dir to extension file
+    # names (the way it does when parsing the INI file) at the command line
+    '*'{-z+,--zend-extension=}'[load specified Zend extension]:Zend extension:_files -g "*.so(|.*)(#q-.)"'
+
+    + '(fi)' # File arguments
+    "(im pb pf rf sv)"{-f+,--file=}'[parse and/or execute specified file]'$php_files
+    '(-)1'$php_files
+
+    + '(hv)' # Help/version options; kept separate by convention
+    '(- 1 *)'{-h,--help}'[display help information]'
+    '(- 1 *)'{-v,--version}'[display version information]'
+    '!(- 1 *)'{-\?,-\\\?,--usage}
+
+    + '(im)' # Info/module options (exclusive with everything but -c/-n)
+    '(fi mc pb pf rf rn sc sv *)'{-i,--info}'[display configuration information (phpinfo())]'
+    '(fi mc pb pf rf rn sc sv *)'{-m,--modules}'[display installed extensions]'
+
+    + '(in)' # php.ini set/disable options (unrelated to --ini!)
+    {-c+,--php-ini=}'[specify php.ini or containing directory]:INI file or directory:_files -g "*.ini(-.)"'
+    {-n,--no-php-ini}'[ignore php.ini]'
+
+    + '(pb)' # Input-processing begin/end options
+    '(-B --process-begin fi im rf rn sc sv)'{-B+,--process-begin=}'[run specified PHP code before processing input lines]:PHP code:'
+    '(-E --process-end fi im rf rn sc sv)'{-E+,--process-end=}'[run specified PHP code after processing input lines]:PHP code:'
+
+    + '(pf)' # Input-processing options
+    '(fi im rf rn sc sv)'{-R+,--process-code=}'[run specified PHP code for every input line]:PHP code:'
+    '(fi im rf rn sc sv)'{-F+,--process-file=}'[parse and execute specified file for every input line]'$php_files
+
+    + '(rf)' # Reflection options
+    '(fi im rn pb pf sc sv *)'{--rc=,--rclass=}'[display information about specified class]: :_php_classes'
+    '(fi im rn pb pf sc sv *)'{--re=,--rextension=}'[display information about specified extension]: :_php_extensions'
+    '(fi im rn pb pf sc sv *)'{--rf=,--rfunction=}'[display information about specified function]: :_php_functions'
+    '(fi im rn pb pf sc sv *)'{--ri=,--rextinfo=}'[display configuration information about specified extension]: :_php_extensions'
+    '(fi im rn pb pf sc sv *)'{--rz=,--rzendextension=}'[display information about specified Zend extension]: :_php_extensions --zend'
+
+    + '(rn)' # Run-script options
+    "(fi im pb pf rf sc sv)"{-r+,--run=}'[run specified PHP code]:PHP code:'
+
+    + '(sc)' # Source-checking/formatting options
+    '(im pb pf rf rn sv *)'{-l,--syntax-check}'[check syntax only (lint)]'
+    '(im pb pf rf rn sv *)'{-s,--syntax-highlight}'[display HTML syntax-highlighted source]'
+    '!(im pb pf rf rn sv *)--syntax-highlighting'
+    '(im pb pf rf rn sv *)'{-w,--strip}'[display source stripped of comments and whitespace]'
+
+    + sv # Built-in Web server options
+    '(-S --server fi im pb pf rf rn sc *)'{-S+,--server=}'[start Web server on specified address/port]: :->server'
+    '(-t --docroot fi im pb pf rf rn sc *)'{-t+,--docroot=}'[specify Web-server document root]:document root:_directories'
+
+    + ar # Script-argument operands
+    '(-)*:: :->argument'
   )
-fi
-
-args+=(
-  '(-a --interactive)'{-a,--interactive}'[run interactively]'
-  '(-c --php-ini -n --no-php-ini)'{-c,--php-ini}'[look for php.ini file in the specified directory]:INI file or directory:_files -g "*.ini(-.)"'
-  '(-c --php-ini -n --no-php-ini)'{-n,--no-php-ini}'[no php.ini file will be used]'
-  '(-d --define)'{-d,--define}'[define INI entry]:configuration directive:->directive'
-  '(-e --profile-info)'{-e,--profile-info}'[generate extended information for debugger/profiler]'
-  "(-f --file -r --run $exclusions 1)"{-f,--file}'[parse specified file]'$php_files
-  '(- 1 *)'{-h,--help}'[display help information]'
-  '(- 1 *)'{-i,--info}'[PHP information]'
-  '(-   *)'{-l,--syntax-check}'[syntax check only (lint)]'
-  '(- 1 *)'{-m,--modules}'[show compiled in modules]'
-  "(-r --run -f --file $exclusions -l --syntax-check -s --syntax-highlight -w --strip 1)"{-r,--run}'[run the specified PHP code without using script tags ]:PHP code:'
-  '(- 1 *)'{-s,--syntax-highlight}'[display colour syntax highlighted source]'
-  '(- 1 *)'{-v,--version}'[display version information]'
-  '(-   *)'{-w,--strip}'[display source with stripped comments and whitespace]'
-  '(-z --zend-extension)'{-z,--zend-extension}'[load specified Zend extension]:extension file:->extension'
-  '(-)1'$php_files
-  '(-)*::script argument: _normal'
-)
-
-_arguments -C -s -S "$args[@]" && return 0
-
-case $state in
-  directive)
-    local -a directives suf
-    local code='foreach (ini_get_all() as $k => $v) { echo "$k\n"; }'
-    directives=( $(_call_program directives $words[1] -r ${(q)code} 2>/dev/null) )
-    if compset -P 1 '*='; then
-      _default && return 0
-    else
-      compset -S '=*' || suf=( -qS '=' )
-      _wanted directives expl 'configuration directive' compadd "$suf[@]" -a directives && return 0
-    fi
-  ;;
-  extension)
-    local -a paths
-    if [[ -r /etc/ld.so.conf ]]; then
-      paths=( ${(f)"$(
Date: Tue, 7 Aug 2018 14:11:57 +0800
Subject: 43253: hg --style deprecated in favour of --template

---
 ChangeLog                   |  5 +++++
 Completion/Unix/Command/_hg | 18 +++++++++---------
 2 files changed, 14 insertions(+), 9 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 462e21781..dbaa1c52a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-07  Peter Stephenson  
+
+	* Anton Shestakov: 43253: Completion/Unix/Command/_hg: hg
+	--style is deprecated, use --template.
+
 2018-08-01  Jun-ichi Takimoto 
 
 	* 43227: Src/Modules/termcap.c, Src/Modules/terminfo.c,
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 8eaa457c8..50ab7132c 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -389,9 +389,9 @@ _hg_diff_opts=(
 _hg_dryrun_opts=(
   '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
 
-_hg_style_opts=(
-  '--style[display using template map file]:'
-  '--template[display with template]:')
+_hg_template_opts=(
+  '--template[display with template]:template'
+)
 
 _hg_commit_opts=(
   '(-m --message -l --logfile --edit -e)'{-e,--edit}'[edit commit message]'
@@ -565,7 +565,7 @@ _hg_cmd_grep() {
 }
 
 _hg_cmd_heads() {
-  _arguments -s : $_hg_global_opts $_hg_style_opts \
+  _arguments -s : $_hg_global_opts $_hg_template_opts \
   '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of rev]:revision:_hg_tags'
 }
 
@@ -592,7 +592,7 @@ _hg_cmd_import() {
 }
 
 _hg_cmd_incoming() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
+  _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
@@ -616,7 +616,7 @@ _hg_cmd_locate() {
 }
 
 _hg_cmd_log() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_style_opts \
+  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_template_opts \
   '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
   '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
   '(--copies -C)'{-C,--copies}'[show copied files]' \
@@ -644,7 +644,7 @@ _hg_cmd_merge() {
 }
 
 _hg_cmd_outgoing() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_style_opts \
+  _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
@@ -654,7 +654,7 @@ _hg_cmd_outgoing() {
 }
 
 _hg_cmd_parents() {
-  _arguments -s : $_hg_global_opts $_hg_style_opts \
+  _arguments -s : $_hg_global_opts $_hg_template_opts \
   '(--rev -r)'{-r+,--rev=}'[show parents of the specified rev]:revision:_hg_tags' \
   ':last modified file:_hg_files'
 }
@@ -785,7 +785,7 @@ _hg_cmd_tag() {
 }
 
 _hg_cmd_tip() {
-  _arguments -s : $_hg_global_opts $_hg_style_opts \
+  _arguments -s : $_hg_global_opts $_hg_template_opts \
   '(--patch -p)'{-p,--patch}'[show patch]'
 }
 
-- 
cgit v1.2.3


From ea33441f457f6b8c9c36f516cc54f0ae0b272730 Mon Sep 17 00:00:00 2001
From: Anton Shestakov 
Date: Tue, 7 Aug 2018 14:11:58 +0800
Subject: 43251: fix some return values of _hg functions

---
 ChangeLog                   |  3 +++
 Completion/Unix/Command/_hg | 28 ++++++++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index dbaa1c52a..af2138040 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-07  Peter Stephenson  
 
+	* Anton Shestakov: 43251: Completion/Unix/Command/_hg: fix
+	return value of some hg completion functions.
+
 	* Anton Shestakov: 43253: Completion/Unix/Command/_hg: hg
 	--style is deprecated, use --template.
 
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 50ab7132c..0526fdd81 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -523,24 +523,28 @@ _hg_cmd_copy() {
 }
 
 _hg_cmd_diff() {
+  local context state state_descr line ret=1
   typeset -A opt_args
+
   _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
   '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \
   '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
   '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
   '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \
   '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \
-  '*:file:->diff_files'
+  '*:file:->diff_files' && ret=0
 
   if [[ $state == 'diff_files' ]]
   then
     if [[ -n $opt_args[-r] ]]
     then
-      _hg_files
+      _hg_files && ret=0
     else
-      _hg_modified
+      _hg_modified && ret=0
     fi
   fi
+
+  return ret
 }
 
 _hg_cmd_export() {
@@ -698,43 +702,47 @@ _hg_cmd_rename() {
 }
 
 _hg_cmd_resolve() {
-  local context state line
+  local context state state_descr line ret=1
   typeset -A opt_args
 
   _arguments -s : $_hg_global_opts \
   '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
   '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
   '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
-  '*:file:_hg_unresolved'
+  '*:file:_hg_unresolved' && ret=0
 
   if [[ $state == 'resolve_files' ]]
   then
     _alternative 'files:resolved files:_hg_resolved' \
-      'files:unresolved files:_hg_unresolved'
+      'files:unresolved files:_hg_unresolved' && ret=0
   fi
+
+  return ret
 }
 
 _hg_cmd_revert() {
-  local context state line
+  local context state state_descr line ret=1
   typeset -A opt_args
 
   _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
   '(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_tags' \
   '--no-backup[do not save backup copies of files]' \
-  '*:file:->diff_files'
+  '*:file:->diff_files' && ret=0
 
   if [[ $state == 'diff_files' ]]
   then
     if [[ -n $opt_args[-r] ]]
     then
-      _hg_files
+      _hg_files && ret=0
     else
       typeset -a status_files
       _hg_status mard
-      _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files
+      _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files && ret=0
     fi
   fi
+
+  return ret
 }
 
 _hg_cmd_serve() {
-- 
cgit v1.2.3


From ea4cc2e98535b0f76eb6385086581379f6884e74 Mon Sep 17 00:00:00 2001
From: Anton Shestakov 
Date: Tue, 7 Aug 2018 14:11:59 +0800
Subject: 43250: add hg forget, phase, summary completion

---
 ChangeLog                   |  3 +++
 Completion/Unix/Command/_hg | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index af2138040..0317aa783 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-07  Peter Stephenson  
 
+	* Anton Shestakov: 43250: Completion/Unix/Command/_hg: Add hg
+	forget, phase, summary completions.
+
 	* Anton Shestakov: 43251: Completion/Unix/Command/_hg: fix
 	return value of some hg completion functions.
 
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 0526fdd81..6a0cf50bf 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -554,6 +554,11 @@ _hg_cmd_export() {
   '*:revision:_hg_tags'
 }
 
+_hg_cmd_forget() {
+  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  '*:file:_hg_files'
+}
+
 _hg_cmd_grep() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
   '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
@@ -668,6 +673,16 @@ _hg_cmd_paths() {
   ':path:_hg_paths'
 }
 
+_hg_cmd_phase() {
+  _arguments -s : $_hg_global_opts \
+  '(--public -p --draft -d --secret -s)'{-p,--public}'[set changeset phase to public]' \
+  '(--public -p --draft -d --secret -s)'{-d,--draft}'[set changeset phase to draft]' \
+  '(--public -p --draft -d --secret -s)'{-s,--secret}'[set changeset phase to secret]' \
+  '(--force -f)'{-f,--force}'[allow to move boundary backward]' \
+  '*'{-r+,--rev=}'[target revision]:revision:_hg_tags' \
+  '*:revision:_hg_tags'
+}
+
 _hg_cmd_pull() {
   _arguments -s : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
@@ -782,6 +797,11 @@ _hg_cmd_status() {
   '*:files:_files'
 }
 
+_hg_cmd_summary() {
+  _arguments -s : $_hg_global_opts \
+  '--remote[check for push and pull]'
+}
+
 _hg_cmd_tag() {
   _arguments -s : $_hg_global_opts \
   '(--local -l)'{-l,--local}'[make the tag local]' \
-- 
cgit v1.2.3


From ac9dfc9e938714380bd59514fd067434228cc19b Mon Sep 17 00:00:00 2001
From: Anton Shestakov 
Date: Tue, 7 Aug 2018 14:12:00 +0800
Subject: 43252: fix various hg options for completion

---
 ChangeLog                   |   3 +
 Completion/Unix/Command/_hg | 189 +++++++++++++++++++++++++++-----------------
 2 files changed, 121 insertions(+), 71 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 0317aa783..c7c48ad2a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-07  Peter Stephenson  
 
+	* Anton Shestakov: 43252: Completion/Unix/Command/_hg: fix up
+	various hg options for completion.
+
 	* Anton Shestakov: 43250: Completion/Unix/Command/_hg: Add hg
 	forget, phase, summary completions.
 
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 6a0cf50bf..18e3d77e5 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -359,22 +359,22 @@ _hg_clone_dest() {
 
 # Common options
 _hg_global_opts=(
-    '(--repository -R)'{-R+,--repository=}'[repository root directory]:repository:_files -/'
-    '--cwd[change working directory]:new working directory:_files -/'
-    '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, assume yes for any required answers]'
+    '(--repository -R)'{-R+,--repository=}'[repository root directory or name of overlay bundle file]:repository:_files -/'
+    '--cwd=[change working directory]:new working directory:_files -/'
+    '(--noninteractive -y)'{-y,--noninteractive}'[do not prompt, automatically pick the first choice for all prompts]'
     '(--verbose -v)'{-v,--verbose}'[enable additional output]'
     '*--config[set/override config option]:defined config items:_hg_config'
     '(--quiet -q)'{-q,--quiet}'[suppress output]'
     '(--help -h)'{-h,--help}'[display help and exit]'
-    '--debug[debug mode]'
+    '--debug[enable debugging output]'
     '--debugger[start debugger]'
-    '--encoding[set the charset encoding (default: UTF8)]'
-    '--encodingmode[set the charset encoding mode (default: strict)]'
-    '--lsprof[print improved command execution profile]'
-    '--traceback[print traceback on exception]'
+    '--encoding=[set the charset encoding]:encoding'
+    '--encodingmode=[set the charset encoding mode]:encoding mode'
+    '--traceback[always print a traceback on exception]'
     '--time[time how long the command takes]'
-    '--profile[profile]'
+    '--profile[print command execution profile]'
     '--version[output version information and exit]'
+    '--hidden[consider hidden changesets]'
 )
 
 _hg_pat_opts=(
@@ -384,7 +384,8 @@ _hg_pat_opts=(
 _hg_diff_opts=(
   '(--text -a)'{-a,--text}'[treat all files as text]'
   '(--git -g)'{-g,--git}'[use git extended diff format]'
-  "--nodates[don't include dates in diff headers]")
+  '--nodates[omit dates from diff headers]'
+)
 
 _hg_dryrun_opts=(
   '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
@@ -399,8 +400,10 @@ _hg_commit_opts=(
   '(-e --edit -m --message --logfile -l)'{-l+,--logfile=}'[read the commit message from ]:log file:_files')
 
 _hg_remote_opts=(
-  '(--ssh -e)'{-e+,--ssh=}'[specify ssh command to use]:'
-  '--remotecmd[specify hg command to run on the remote side]:')
+  '(--ssh -e)'{-e+,--ssh=}'[specify ssh command to use]:command'
+  '--remotecmd=[specify hg command to run on the remote side]:remote command'
+  '--insecure[do not verify server certificate (ignoring web.cacerts config)]'
+)
 
 _hg_cmd() {
   _call_program hg hg --config ui.verbose=0 --config defaults."$1"= \
@@ -414,26 +417,28 @@ _hg_cmd_add() {
 
 _hg_cmd_addremove() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
-  '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:' \
+  '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \
   '*:unknown or missing files:_hg_addremove'
 }
 
 _hg_cmd_annotate() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
   '(--rev -r)'{-r+,--rev=}'[annotate the specified revision]:revision:_hg_tags' \
-  '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
+  "--no-follow[don't follow copies and renames]" \
   '(--text -a)'{-a,--text}'[treat all files as text]' \
-  '(--user -u)'{-u,--user}'[list the author]' \
-  '(--date -d)'{-d,--date}'[list the date]' \
+  '(--user -u)'{-u,--user}'[list the author (long with -v)]' \
+  '(--file -f)'{-f,--file}'[list the filename]' \
+  '(--date -d)'{-d,--date}'[list the date (short with -q)]' \
   '(--number -n)'{-n,--number}'[list the revision number (default)]' \
   '(--changeset -c)'{-c,--changeset}'[list the changeset]' \
+  '(--line-number -l)'{-l,--line-number}'[show line number at the first appearance]' \
   '*:files:_hg_files'
 }
 
 _hg_cmd_archive() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
   '--no-decode[do not pass files through decoders]' \
-  '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:' \
+  '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:prefix' \
   '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_tags' \
   '(--type -t)'{-t+,--type=}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
   '*:destination:_files'
@@ -442,9 +447,9 @@ _hg_cmd_archive() {
 _hg_cmd_backout() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
     '--merge[merge with old dirstate parent after backout]' \
-    '(--date -d)'{-d+,--date=}'[record datecode as commit date]:date code:' \
+    '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
     '--parent[parent to choose when backing out merge]' \
-    '(--user -u)'{-u+,--user=}'[record user as commiter]:user:' \
+    '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
     '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \
     '(--message -m)'{-m+,--message=}'[specify commit message]:text' \
     '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files'
@@ -453,6 +458,7 @@ _hg_cmd_backout() {
 _hg_cmd_bisect() {
   _arguments -s : $_hg_global_opts \
   '(-)'{-r,--reset}'[reset bisect state]' \
+  '(--extend -e)'{-e,--extend}'[extend the bisect range]' \
   '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \
   '(--good -g --bad -b --skip -s --reset -r)'{-b,--bad}'[mark changeset bad]'::revision:_hg_tags \
   '(--good -g --bad -b --skip -s --reset -r)'{-s,--skip}'[skip testing changeset]' \
@@ -463,9 +469,9 @@ _hg_cmd_bisect() {
 _hg_cmd_bookmarks() {
   _arguments -s : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[force]' \
-  '(--rev -r)'{-r+,--rev=}'[set bookmark at revision]:revision:_hg_tags' \
-  '(--delete -d)'{-d,--delete}'[delete a given bookmark]' \
-  '(--rename -m)'{-m+,--rename=}'[rename given bookmark]:bookmark:_hg_bookmarks_internal' \
+  '(--rev -r --delete -d --rename -m)'{-r+,--rev=}'[set bookmark at revision]:revision:_hg_tags' \
+  '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
+  '(--rev -r --delete -d --rename -m)'{-m+,--rename=}'[rename given bookmark]:bookmark:_hg_bookmarks_internal' \
   '(--inactive -i)'{-i,--inactive}'[mark a bookmark inactive]' \
   ':bookmark:_hg_bookmarks_internal'
 }
@@ -478,28 +484,33 @@ _hg_cmd_branch() {
 
 _hg_cmd_branches() {
   _arguments -s : $_hg_global_opts \
-  '(--active -a)'{-a,--active}'[show only branches that have unmerge heads]'
+  '(--closed -c)'{-c,--closed}'[show normal and closed branches]'
 }
 
 _hg_cmd_bundle() {
   _arguments -s : $_hg_global_opts $_hg_remote_opts \
-  '(--force -f)'{-f,--force}'[run even when remote repository is unrelated]' \
-  '(2)*--base[a base changeset to specify instead of a destination]:revision:_hg_tags' \
+  '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \
+  '(2)*--base[a base changeset assumed to be available at the destination]:revision:_hg_tags' \
+  '*'{-b+,--branch=}'[a specific branch you would like to bundle]:branch:_hg_branches_internal' \
+  '*'{-r+,--rev=}'[a changeset intended to be added to the destination]:revision:_hg_tags' \
+  '--all[bundle all changesets in the repository]' \
+  '--type[bundle compression type to use (default: bzip2)]:bundle type' \
   ':output file:_files' \
   ':destination repository:_files -/'
 }
 
 _hg_cmd_cat() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
-  '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:filespec:' \
+  '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \
   '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \
+  '--decode[apply any matching decode filter]' \
   '*:file:_hg_files'
 }
 
 _hg_cmd_clone() {
   _arguments -s : $_hg_global_opts $_hg_remote_opts \
   '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
-  '(--rev -r)'{-r+,--rev=}'[a changeset you would like to have after cloning]:' \
+  '(--rev -r)'{-r+,--rev=}'[include the specified changeset]:revision' \
   '--uncompressed[use uncompressed transfer (fast over LAN)]' \
   ':source repository:_hg_remote' \
   ':destination:_hg_clone_dest'
@@ -510,8 +521,12 @@ _hg_cmd_commit() {
   '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
   '(--message -m)'{-m+,--message=}'[specify commit message]:text' \
   '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' \
-  '(--date -d)'{-d+,--date=}'[record datecode as commit date]:date code:' \
-  '(--user -u)'{-u+,--user=}'[record user as commiter]:user:' \
+  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
+  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
+  '--amend[amend the parent of the working directory]' \
+  '--close-branch[mark a branch head as closed]' \
+  '(--interactive -i)'{-i,--interactive}'[use interactive mode]' \
+  '(--secret -s)'{-s,--secret}'[use the secret phase for committing]' \
   '*:file:_hg_committable'
 }
 
@@ -549,7 +564,7 @@ _hg_cmd_diff() {
 
 _hg_cmd_export() {
   _arguments -s : $_hg_global_opts $_hg_diff_opts \
-  '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
+  '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \
   '--switch-parent[diff against the second parent]' \
   '*:revision:_hg_tags'
 }
@@ -575,28 +590,42 @@ _hg_cmd_grep() {
 
 _hg_cmd_heads() {
   _arguments -s : $_hg_global_opts $_hg_template_opts \
+  '(--topo -t)'{-t,--topo}'[show topological heads only]' \
+  '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \
   '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of rev]:revision:_hg_tags'
 }
 
 _hg_cmd_help() {
   _arguments -s : $_hg_global_opts \
+  '(--extension -e)'{-e,--extension}'[show only help for extensions]' \
+  '(--command -c)'{-c,--command}'[show only help for commands]' \
+  '(--keyword -k)'{-k,--keyword}'[show topics matching keyword]' \
   '*:mercurial command:_hg_commands'
 }
 
 _hg_cmd_identify() {
   _arguments -s : $_hg_global_opts \
   '(--rev -r)'{-r+,--rev=}'[identify the specified rev]:revision:_hg_tags' \
-  '(--num -n)'{-n+,--num=}'[show local revision number]' \
-  '(--id -i)'{-i+,--id=}'[show global revision id]' \
-  '(--branch -b)'{-b+,--branch=}'[show branch]' \
-  '(--tags -t)'{-t+,--tags=}'[show tags]'
+  '(--num -n)'{-n,--num}'[show local revision number]' \
+  '(--id -i)'{-i,--id}'[show global revision id]' \
+  '(--branch -b)'{-b,--branch}'[show branch]' \
+  '(--tags -t)'{-t,--tags}'[show tags]' \
+  '(--bookmarks -B)'{-B,--bookmarks}'[show bookmarks]'
 }
 
 _hg_cmd_import() {
   _arguments -s : $_hg_global_opts \
-  '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count:' \
+  '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count' \
   '(--message -m)'{-m+,--message=}'[use  as commit message]:text:' \
   '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
+  '--bypass[apply patch without touching the working directory]' \
+  '--no-commit[do not commit, just update the working directory]' \
+  '--partial[commit even if some hunks fail]' \
+  '--exact[abort if patch would apply lossily]' \
+  '--import-branch[use any branch information in patch (implied by --exact)]' \
+  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
+  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
+  '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \
   '*:patch:_files'
 }
 
@@ -605,7 +634,7 @@ _hg_cmd_incoming() {
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
-  '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
+  '*'{-r+,--rev=}'[a remote changeset intended to be added]:revision:_hg_tags' \
   '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
   '--bundle[file to store the bundles into]:bundle file:_files' \
   ':source:_hg_remote'
@@ -620,7 +649,7 @@ _hg_cmd_locate() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
   '(--rev -r)'{-r+,--rev=}'[search repository as it stood at revision]:revision:_hg_tags' \
   '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
-  '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
+  '(--fullpath -f)'{-f,--fullpath}'[print complete paths from the filesystem root]' \
   '*:search pattern:_hg_files'
 }
 
@@ -629,25 +658,26 @@ _hg_cmd_log() {
   '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
   '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
   '(--copies -C)'{-C,--copies}'[show copied files]' \
-  '(--keyword -k)'{-k+,--keyword=}'[search for a keyword]:' \
-  '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:' \
-  '*'{-r,--rev}'[show the specified revision or range]:revision:_hg_revrange' \
+  '*'{-k+,--keyword=}'[search for a keyword]:keyword' \
+  '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \
+  '*'{-r+,--rev=}'[show the specified revision or revset]:revision:_hg_revrange' \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
   '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
-  '(--prune -P)'{-P+,--prune=}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
+  '*'{-P+,--prune=}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
   '*:files:_hg_files'
 }
 
 _hg_cmd_manifest() {
   _arguments -s : $_hg_global_opts \
+  '--all[list files from all revisions]' \
   ':revision:_hg_tags'
 }
 
 _hg_cmd_merge() {
   _arguments -s : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
-  '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
+  '(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \
   '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
   ':revision:_hg_mergerevs'
 }
@@ -657,7 +687,7 @@ _hg_cmd_outgoing() {
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
-  '(--rev -r)'{-r+,--rev=}'[a specific revision you would like to push]' \
+  '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_tags' \
   '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
   ':destination:_hg_remote'
 }
@@ -687,25 +717,24 @@ _hg_cmd_pull() {
   _arguments -s : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
-  '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision:' \
+  '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision' \
   ':source:_hg_remote'
 }
 
 _hg_cmd_push() {
   _arguments -s : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[force push]' \
-  '(--rev -r)'{-r+,--rev=}'[a specific revision you would like to push]:revision:_hg_tags' \
+  '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_tags' \
   '*'{-B,--bookmark=}'[bookmark to push]:bookmark:_hg_bookmarks_internal' \
   '*'{-b,--branch=}'[branch to push]:branch:_hg_branches_internal' \
-  '--insecure[do not verify server certificate]' \
   '--new-branch[allow pushing a new branch]' \
   ':destination:_hg_remote'
 }
 
 _hg_cmd_remove() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts \
-  '(--after -A)'{-A,--after}'[record remove that has already occurred]' \
-  '(--force -f)'{-f,--force}'[remove file even if modified]' \
+  '(--after -A)'{-A,--after}'[record delete for missing files]' \
+  '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \
   '*:file:_hg_files'
 }
 
@@ -721,9 +750,11 @@ _hg_cmd_resolve() {
   typeset -A opt_args
 
   _arguments -s : $_hg_global_opts \
+  '(--all -a)'{-a,--all}'[select all unresolved files]' \
+  '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
   '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
   '(--mark -m --list -l --unmark -u)'{-m,--mark}'[mark files as resolved]:*:unresolved files:_hg_unresolved' \
-  '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[unmark files as resolved]:*:resolved files:_hg_resolved' \
+  '(--unmark -u --list -l --mark -m)'{-u,--unmark}'[mark files as unresolved]:*:resolved files:_hg_resolved' \
   '*:file:_hg_unresolved' && ret=0
 
   if [[ $state == 'resolve_files' ]]
@@ -742,7 +773,8 @@ _hg_cmd_revert() {
   _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
   '(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_tags' \
-  '--no-backup[do not save backup copies of files]' \
+  '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \
+  '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
   '*:file:->diff_files' && ret=0
 
   if [[ $state == 'diff_files' ]]
@@ -762,21 +794,29 @@ _hg_cmd_revert() {
 
 _hg_cmd_serve() {
   _arguments -s : $_hg_global_opts \
-  '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file]:log file:_files' \
-  '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file]:log file:_files' \
+  '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write to]:log file:_files' \
+  '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log file:_files' \
   '(--daemon -d)'{-d,--daemon}'[run server in background]' \
-  '(--port -p)'{-p+,--port=}'[listen port]:listen port:' \
-  '(--address -a)'{-a+,--address=}'[interface address]:interface address:' \
-  '(--name -n)'{-n+,--name=}'[name to show in web pages]:repository name:' \
-  '(--templates -t)'{-t,--templates}'[web template directory]:template dir:_files -/' \
-  '--style[web template style]:style' \
+  '(--port -p)'{-p+,--port=}'[port to listen on (default: 8000)]:listen port' \
+  '(--address -a)'{-a+,--address=}'[address to listen on (default: all interfaces)]:interface address' \
+  '--prefix[prefix path to serve from (default: server root)]:prefix' \
+  '(--name -n)'{-n+,--name=}'[name to show in web pages (default: working directory)]:repository name' \
+  '--web-conf=[name of the hgweb config file]:config file:_files' \
+  '--pid-file=[name of file to write process ID to]:pid file:_files' \
+  '--cmdserver[for remote clients]' \
+  '(--templates -t)'{-t+,--templates=}'[web template directory]:template dir:_files -/' \
+  '--style=[web template style]:style' \
   '--stdio[for remote clients]' \
-  '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]'
+  '(--ipv6 -6)'{-6,--ipv6}'[use IPv6 in addition to IPv4]' \
+  '--certificate=[SSL certificate file]:certificate file:_files'
 }
 
 _hg_cmd_showconfig() {
   _arguments -s : $_hg_global_opts \
-  '(--untrusted -u)'{-u+,--untrusted=}'[show untrusted configuration options]' \
+  '(--untrusted -u)'{-u,--untrusted}'[show untrusted configuration options]' \
+  '(--edit -e)'{-e,--edit}'[edit user config]' \
+  '(--local -l --global -g)'{-l,--local}'[edit repository config]' \
+  '(--local -l --global -g)'{-g,--global}'[edit global config]' \
   ':config item:_hg_config'
 }
 
@@ -788,12 +828,13 @@ _hg_cmd_status() {
   '(--removed -r)'{-r,--removed}'[show only removed files]' \
   '(--deleted -d)'{-d,--deleted}'[show only deleted (but tracked) files]' \
   '(--clean -c)'{-c,--clean}'[show only files without changes]' \
-  '(--unknown -u)'{-u,--unknown}'[show only unknown files]' \
+  '(--unknown -u)'{-u,--unknown}'[show only unknown (not tracked) files]' \
   '(--ignored -i)'{-i,--ignored}'[show ignored files]' \
   '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
   '(--copies -C)'{-C,--copies}'[show source of copied files]' \
   '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
-  '--rev[show difference from revision]:revision:_hg_tags' \
+  '*--rev=[show difference from revision]:revision:_hg_tags' \
+  '--change=[list the changed files of a revision]:revision:_hg_tags' \
   '*:files:_files'
 }
 
@@ -805,10 +846,12 @@ _hg_cmd_summary() {
 _hg_cmd_tag() {
   _arguments -s : $_hg_global_opts \
   '(--local -l)'{-l,--local}'[make the tag local]' \
-  '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message:' \
-  '(--date -d)'{-d+,--date=}'[record datecode as commit date]:date code:' \
-  '(--user -u)'{-u+,--user=}'[record user as commiter]:user:' \
+  '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message' \
+  '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
+  '(--user -u)'{-u+,--user=}'[record the specified user as committer]:user' \
   '(--rev -r)'{-r+,--rev=}'[revision to tag]:revision:_hg_tags' \
+  '(--force -f)'{-f,--force}'[force tag]' \
+  '--remove[remove a tag]' \
   ':tag name:'
 }
 
@@ -820,12 +863,14 @@ _hg_cmd_tip() {
 _hg_cmd_unbundle() {
   _arguments -s : $_hg_global_opts \
   '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
-  ':files:_files'
+  '*:files:_files'
 }
 
 _hg_cmd_update() {
   _arguments -s : $_hg_global_opts \
-  '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
+  '(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \
+  '(--check -c)'{-c,--check}'[require clean working directory]' \
+  '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
   '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \
   ':revision:_hg_tags'
 }
@@ -833,7 +878,7 @@ _hg_cmd_update() {
 # HGK
 _hg_cmd_view() {
   _arguments -s : $_hg_global_opts \
-  '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:' \
+  '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \
   ':revision range:_hg_tags'
 }
 
@@ -1005,10 +1050,12 @@ _hg_cmd_qtop() {
 
 _hg_cmd_strip() {
   _arguments -s : $_hg_global_opts \
-  '(--force -f)'{-f,--force}'[force multi-head removal]' \
-  '(--backup -b)'{-b,--backup}'[bundle unrelated changesets]' \
-  '(--nobackup -n)'{-n,--nobackup}'[no backups]' \
-  ':revision:_hg_tags'
+  '*'{-r+,--rev=}'[revision]:revision:_hg_tags' \
+  '(--force -f)'{-f,--force}'[force removal of changesets, discard uncommitted changes (no backup)]' \
+  '--no-backup[no backups]' \
+  '(--keep -k)'{-k,--keep}'[do not modify working directory during strip]' \
+  '*'{-B+,--bookmark=}'[remove revs only reachable from given bookmark]:bookmark:_hg_bookmarks_internal' \
+  '*:revision:_hg_tags'
 }
 
 _hg "$@"
-- 
cgit v1.2.3


From bf8b61182043ec5457bfcc97f4969949678e0385 Mon Sep 17 00:00:00 2001
From: Anton Shestakov 
Date: Tue, 7 Aug 2018 14:12:01 +0800
Subject: 43254: remove hg -w completion, add hg -S

---
 ChangeLog                   |   3 +
 Completion/Unix/Command/_hg | 138 ++++++++++++++++++++++----------------------
 2 files changed, 72 insertions(+), 69 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index c7c48ad2a..7a4cb05a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-07  Peter Stephenson  
 
+	* Anton Shestakov: 43254: Completion/Unix/Command/_hg: Remove hg
+	-w and add hg -S.
+
 	* Anton Shestakov: 43252: Completion/Unix/Command/_hg: fix up
 	various hg options for completion.
 
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 18e3d77e5..2b2d3c4ec 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -82,7 +82,7 @@ _hg() {
 
   if [[ -z "$cmd" ]]
   then
-    _arguments -s -w : $_hg_global_opts \
+    _arguments -s -S : $_hg_global_opts \
     ':mercurial command:_hg_commands'
     return
   fi
@@ -119,7 +119,7 @@ _hg() {
     _hg_cmd_${cmd}
   else
     # complete unknown commands normally
-    _arguments -s -w : $_hg_global_opts \
+    _arguments -s -S : $_hg_global_opts \
       '*:files:_hg_files'
   fi
 }
@@ -411,18 +411,18 @@ _hg_cmd() {
 }
 
 _hg_cmd_add() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '*:unknown files:_hg_unknown'
 }
 
 _hg_cmd_addremove() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \
   '*:unknown or missing files:_hg_addremove'
 }
 
 _hg_cmd_annotate() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--rev -r)'{-r+,--rev=}'[annotate the specified revision]:revision:_hg_tags' \
   "--no-follow[don't follow copies and renames]" \
   '(--text -a)'{-a,--text}'[treat all files as text]' \
@@ -436,7 +436,7 @@ _hg_cmd_annotate() {
 }
 
 _hg_cmd_archive() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '--no-decode[do not pass files through decoders]' \
   '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:prefix' \
   '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_tags' \
@@ -445,7 +445,7 @@ _hg_cmd_archive() {
 }
 
 _hg_cmd_backout() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
     '--merge[merge with old dirstate parent after backout]' \
     '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
     '--parent[parent to choose when backing out merge]' \
@@ -456,7 +456,7 @@ _hg_cmd_backout() {
 }
 
 _hg_cmd_bisect() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(-)'{-r,--reset}'[reset bisect state]' \
   '(--extend -e)'{-e,--extend}'[extend the bisect range]' \
   '(--good -g --bad -b --skip -s --reset -r)'{-g,--good}'[mark changeset good]'::revision:_hg_tags \
@@ -467,7 +467,7 @@ _hg_cmd_bisect() {
 }
 
 _hg_cmd_bookmarks() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[force]' \
   '(--rev -r --delete -d --rename -m)'{-r+,--rev=}'[set bookmark at revision]:revision:_hg_tags' \
   '(--rev -r --delete -d --rename -m)'{-d,--delete}'[delete a given bookmark]' \
@@ -477,18 +477,18 @@ _hg_cmd_bookmarks() {
 }
 
 _hg_cmd_branch() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[set branch name even if it shadows an existing branch]' \
   '(--clean -C)'{-C,--clean}'[reset branch name to parent branch name]'
 }
 
 _hg_cmd_branches() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--closed -c)'{-c,--closed}'[show normal and closed branches]'
 }
 
 _hg_cmd_bundle() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[run even when the destination is unrelated]' \
   '(2)*--base[a base changeset assumed to be available at the destination]:revision:_hg_tags' \
   '*'{-b+,--branch=}'[a specific branch you would like to bundle]:branch:_hg_branches_internal' \
@@ -500,7 +500,7 @@ _hg_cmd_bundle() {
 }
 
 _hg_cmd_cat() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \
   '(--rev -r)'{-r+,--rev=}'[revision]:revision:_hg_tags' \
   '--decode[apply any matching decode filter]' \
@@ -508,7 +508,7 @@ _hg_cmd_cat() {
 }
 
 _hg_cmd_clone() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
   '(--noupdate -U)'{-U,--noupdate}'[do not update the new working directory]' \
   '(--rev -r)'{-r+,--rev=}'[include the specified changeset]:revision' \
   '--uncompressed[use uncompressed transfer (fast over LAN)]' \
@@ -517,7 +517,7 @@ _hg_cmd_clone() {
 }
 
 _hg_cmd_commit() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
   '(--message -m)'{-m+,--message=}'[specify commit message]:text' \
   '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' \
@@ -531,7 +531,7 @@ _hg_cmd_commit() {
 }
 
 _hg_cmd_copy() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--after -A)'{-A,--after}'[record a copy that has already occurred]' \
   '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
   '*:file:_hg_files'
@@ -541,7 +541,7 @@ _hg_cmd_diff() {
   local context state state_descr line ret=1
   typeset -A opt_args
 
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
   '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \
   '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
   '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
@@ -563,19 +563,19 @@ _hg_cmd_diff() {
 }
 
 _hg_cmd_export() {
-  _arguments -s : $_hg_global_opts $_hg_diff_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_diff_opts \
   '(--output -o)'{-o+,--output=}'[print output to file with formatted name]:format string' \
   '--switch-parent[diff against the second parent]' \
   '*:revision:_hg_tags'
 }
 
 _hg_cmd_forget() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '*:file:_hg_files'
 }
 
 _hg_cmd_grep() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--print0 -0)'{-0,--print0}'[end filenames with NUL]' \
   '--all[print all revisions with matches]' \
   '(--follow -f)'{-f,--follow}'[follow changeset or file history]' \
@@ -589,14 +589,14 @@ _hg_cmd_grep() {
 }
 
 _hg_cmd_heads() {
-  _arguments -s : $_hg_global_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_template_opts \
   '(--topo -t)'{-t,--topo}'[show topological heads only]' \
   '(--closed -c)'{-c,--closed}'[show normal and closed branch heads]' \
   '(--rev -r)'{-r+,--rev=}'[show only heads which are descendants of rev]:revision:_hg_tags'
 }
 
 _hg_cmd_help() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--extension -e)'{-e,--extension}'[show only help for extensions]' \
   '(--command -c)'{-c,--command}'[show only help for commands]' \
   '(--keyword -k)'{-k,--keyword}'[show topics matching keyword]' \
@@ -604,7 +604,7 @@ _hg_cmd_help() {
 }
 
 _hg_cmd_identify() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--rev -r)'{-r+,--rev=}'[identify the specified rev]:revision:_hg_tags' \
   '(--num -n)'{-n,--num}'[show local revision number]' \
   '(--id -i)'{-i,--id}'[show global revision id]' \
@@ -614,7 +614,7 @@ _hg_cmd_identify() {
 }
 
 _hg_cmd_import() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--strip -p)'{-p+,--strip=}'[directory strip option for patch (default: 1)]:count' \
   '(--message -m)'{-m+,--message=}'[use  as commit message]:text:' \
   '(--force -f)'{-f,--force}'[skip check for outstanding uncommitted changes]' \
@@ -630,7 +630,7 @@ _hg_cmd_import() {
 }
 
 _hg_cmd_incoming() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
@@ -641,12 +641,12 @@ _hg_cmd_incoming() {
 }
 
 _hg_cmd_init() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
   ':dir:_files -/'
 }
 
 _hg_cmd_locate() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--rev -r)'{-r+,--rev=}'[search repository as it stood at revision]:revision:_hg_tags' \
   '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
   '(--fullpath -f)'{-f,--fullpath}'[print complete paths from the filesystem root]' \
@@ -654,7 +654,7 @@ _hg_cmd_locate() {
 }
 
 _hg_cmd_log() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_template_opts \
   '(--follow --follow-first -f)'{-f,--follow}'[follow changeset or history]' \
   '(-f --follow)--follow-first[only follow the first parent of merge changesets]' \
   '(--copies -C)'{-C,--copies}'[show copied files]' \
@@ -669,13 +669,13 @@ _hg_cmd_log() {
 }
 
 _hg_cmd_manifest() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '--all[list files from all revisions]' \
   ':revision:_hg_tags'
 }
 
 _hg_cmd_merge() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
   '(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \
   '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
@@ -683,7 +683,7 @@ _hg_cmd_merge() {
 }
 
 _hg_cmd_outgoing() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
@@ -693,18 +693,18 @@ _hg_cmd_outgoing() {
 }
 
 _hg_cmd_parents() {
-  _arguments -s : $_hg_global_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_template_opts \
   '(--rev -r)'{-r+,--rev=}'[show parents of the specified rev]:revision:_hg_tags' \
   ':last modified file:_hg_files'
 }
 
 _hg_cmd_paths() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   ':path:_hg_paths'
 }
 
 _hg_cmd_phase() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--public -p --draft -d --secret -s)'{-p,--public}'[set changeset phase to public]' \
   '(--public -p --draft -d --secret -s)'{-d,--draft}'[set changeset phase to draft]' \
   '(--public -p --draft -d --secret -s)'{-s,--secret}'[set changeset phase to secret]' \
@@ -714,7 +714,7 @@ _hg_cmd_phase() {
 }
 
 _hg_cmd_pull() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--update -u)'{-u,--update}'[update to new tip if changesets were pulled]' \
   '(--rev -r)'{-r+,--rev=}'[a specific revision up to which you would like to pull]:revision' \
@@ -722,7 +722,7 @@ _hg_cmd_pull() {
 }
 
 _hg_cmd_push() {
-  _arguments -s : $_hg_global_opts $_hg_remote_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts \
   '(--force -f)'{-f,--force}'[force push]' \
   '*'{-r+,--rev=}'[a changeset intended to be included in the destination]:revision:_hg_tags' \
   '*'{-B,--bookmark=}'[bookmark to push]:bookmark:_hg_bookmarks_internal' \
@@ -732,14 +732,14 @@ _hg_cmd_push() {
 }
 
 _hg_cmd_remove() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--after -A)'{-A,--after}'[record delete for missing files]' \
   '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \
   '*:file:_hg_files'
 }
 
 _hg_cmd_rename() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--after -A)'{-A,--after}'[record a rename that has already occurred]' \
   '(--force -f)'{-f,--force}'[forcibly copy over an existing managed file]' \
   '*:file:_hg_files'
@@ -749,7 +749,7 @@ _hg_cmd_resolve() {
   local context state state_descr line ret=1
   typeset -A opt_args
 
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--all -a)'{-a,--all}'[select all unresolved files]' \
   '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
   '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
@@ -770,7 +770,7 @@ _hg_cmd_revert() {
   local context state state_descr line ret=1
   typeset -A opt_args
 
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
   '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \
   '(--rev -r)'{-r+,--rev=}'[revision to revert to]:revision:_hg_tags' \
   '(--no-backup -C)'{-C,--no-backup}'[do not save backup copies of files]' \
@@ -793,7 +793,7 @@ _hg_cmd_revert() {
 }
 
 _hg_cmd_serve() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write to]:log file:_files' \
   '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log file:_files' \
   '(--daemon -d)'{-d,--daemon}'[run server in background]' \
@@ -812,7 +812,7 @@ _hg_cmd_serve() {
 }
 
 _hg_cmd_showconfig() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--untrusted -u)'{-u,--untrusted}'[show untrusted configuration options]' \
   '(--edit -e)'{-e,--edit}'[edit user config]' \
   '(--local -l --global -g)'{-l,--local}'[edit repository config]' \
@@ -821,7 +821,7 @@ _hg_cmd_showconfig() {
 }
 
 _hg_cmd_status() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '(--all -A)'{-A,--all}'[show status of all files]' \
   '(--modified -m)'{-m,--modified}'[show only modified files]' \
   '(--added -a)'{-a,--added}'[show only added files]' \
@@ -839,12 +839,12 @@ _hg_cmd_status() {
 }
 
 _hg_cmd_summary() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '--remote[check for push and pull]'
 }
 
 _hg_cmd_tag() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--local -l)'{-l,--local}'[make the tag local]' \
   '(--message -m)'{-m+,--message=}'[message for tag commit log entry]:message' \
   '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
@@ -856,18 +856,18 @@ _hg_cmd_tag() {
 }
 
 _hg_cmd_tip() {
-  _arguments -s : $_hg_global_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_template_opts \
   '(--patch -p)'{-p,--patch}'[show patch]'
 }
 
 _hg_cmd_unbundle() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--update -u)'{-u,--update}'[update to new tip if changesets were unbundled]' \
   '*:files:_files'
 }
 
 _hg_cmd_update() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \
   '(--check -c)'{-c,--check}'[require clean working directory]' \
   '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
@@ -877,7 +877,7 @@ _hg_cmd_update() {
 
 # HGK
 _hg_cmd_view() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--limit -l)'{-l+,--limit=}'[limit number of changes displayed]:limit' \
   ':revision range:_hg_tags'
 }
@@ -932,35 +932,35 @@ _hg_qseries_opts=(
   '(--summary -s)'{-s,--summary}'[print first line of patch header]')
 
 _hg_cmd_qapplied() {
-  _arguments -s : $_hg_global_opts $_hg_qseries_opts
+  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
 }
 
 _hg_cmd_qdelete() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--keep -k)'{-k,--keep}'[keep patch file]' \
   '*'{-r+,--rev=}'[stop managing a revision]:applied patch:_hg_revrange' \
   '*:unapplied patch:_hg_qdeletable'
 }
 
 _hg_cmd_qdiff() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
   '*:pattern:_hg_files'
 }
 
 _hg_cmd_qfold() {
-  _arguments -s : $_hg_global_opts $_h_commit_opts \
+  _arguments -s -S : $_hg_global_opts $_h_commit_opts \
   '(--keep -k)'{-k,--keep}'[keep folded patch files]' \
   '*:unapplied patch:_hg_qunapplied'
 }
 
 _hg_cmd_qgoto() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--force -f)'{-f,--force}'[overwrite any local changes]' \
   ':patch:_hg_qseries'
 }
 
 _hg_cmd_qguard() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--list -l)'{-l,--list}'[list all patches and guards]' \
   '(--none -n)'{-n,--none}'[drop all guards]' \
   ':patch:_hg_qseries' \
@@ -968,12 +968,12 @@ _hg_cmd_qguard() {
 }
 
 _hg_cmd_qheader() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   ':patch:_hg_qseries'
 }
 
 _hg_cmd_qimport() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--existing -e)'{-e,--existing}'[import file in patch dir]' \
   '(--name -n 2)'{-n+,--name=}'[patch file name]:name:' \
   '(--force -f)'{-f,--force}'[overwrite existing files]' \
@@ -982,17 +982,17 @@ _hg_cmd_qimport() {
 }
 
 _hg_cmd_qnew() {
-  _arguments -s : $_hg_global_opts $_hg_commit_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_commit_opts \
   '(--force -f)'{-f,--force}'[import uncommitted changes into patch]' \
   ':patch:'
 }
 
 _hg_cmd_qnext() {
-  _arguments -s : $_hg_global_opts $_hg_qseries_opts
+  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
 }
 
 _hg_cmd_qpop() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--all -a :)'{-a,--all}'[pop all patches]' \
   '(--name -n)'{-n+,--name=}'[queue name to pop]:' \
   '(--force -f)'{-f,--force}'[forget any local changes]' \
@@ -1000,11 +1000,11 @@ _hg_cmd_qpop() {
 }
 
 _hg_cmd_qprev() {
-  _arguments -s : $_hg_global_opts $_hg_qseries_opts
+  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
 }
 
 _hg_cmd_qpush() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--all -a :)'{-a,--all}'[apply all patches]' \
   '(--list -l)'{-l,--list}'[list patch name in commit text]' \
   '(--merge -m)'{-m+,--merge=}'[merge from another queue]:' \
@@ -1014,20 +1014,20 @@ _hg_cmd_qpush() {
 }
 
 _hg_cmd_qrefresh() {
-  _arguments -s : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_commit_opts \
   '(--git -g)'{-g,--git}'[use git extended diff format]' \
   '(--short -s)'{-s,--short}'[short refresh]' \
   '*:files:_hg_files'
 }
 
 _hg_cmd_qrename() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   ':patch:_hg_qseries' \
   ':destination:'
 }
 
 _hg_cmd_qselect() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '(--none -n :)'{-n,--none}'[disable all guards]' \
   '(--series -s :)'{-s,--series}'[list all guards in series file]' \
   '--pop[pop to before first guarded applied patch]' \
@@ -1036,20 +1036,20 @@ _hg_cmd_qselect() {
 }
 
 _hg_cmd_qseries() {
-  _arguments -s : $_hg_global_opts $_hg_qseries_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts \
   '(--missing -m)'{-m,--missing}'[print patches not in series]'
 }
 
 _hg_cmd_qunapplied() {
-  _arguments -s : $_hg_global_opts $_hg_qseries_opts
+  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
 }
 
 _hg_cmd_qtop() {
-  _arguments -s : $_hg_global_opts $_hg_qseries_opts
+  _arguments -s -S : $_hg_global_opts $_hg_qseries_opts
 }
 
 _hg_cmd_strip() {
-  _arguments -s : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts \
   '*'{-r+,--rev=}'[revision]:revision:_hg_tags' \
   '(--force -f)'{-f,--force}'[force removal of changesets, discard uncommitted changes (no backup)]' \
   '--no-backup[no backups]' \
-- 
cgit v1.2.3


From 99fd8c0fe97b6e481ea41c16c753f3033aa1b47a Mon Sep 17 00:00:00 2001
From: Marc Cornellà 
Date: Tue, 7 Aug 2018 16:45:31 +0200
Subject: unposted (PR #26): __git_files: fix double quotation of star

This fixes the double quote introduced by aa160fc8, so that the end result of
the parameter expansion is $pref followed by \* (a quoted star), meaning
`git ls-files` gets a literal star, not an expanded list of matching files, as
was intended in commit cc7437bf.

Fixes completion of `git add ../`.
---
 ChangeLog                    | 5 +++++
 Completion/Unix/Command/_git | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 5b3ace6a9..110f8636d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-12  Marc Cornellà  
+
+	* unposted (PR #26): Completion/Unix/Command/_git: __git_files:
+	fix double quotation of star
+
 2018-08-09  Peter Stephenson  
 
 	* 43264: Src/params.c, Test/D04parameter.ztst:
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 38b872ea0..eac0c8476 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -6812,7 +6812,7 @@ __git_files () {
   local pref=$gitcdup$gitprefix$PREFIX
 
   # First allow ls-files to pattern-match in case of remote repository
-  files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\\\*}:-.} 2>/dev/null)"})
+  files=(${(0)"$(_call_program files git ls-files -z --exclude-standard ${(q)opts} -- ${(q)${pref:+$pref\*}:-.} 2>/dev/null)"})
   __git_command_successful $pipestatus || return
 
   # If ls-files succeeded but returned nothing, try again with no pattern
-- 
cgit v1.2.3


From 8178698bb2f0f24d97e3ebf9d0dd8bdfb25677d6 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf 
Date: Mon, 13 Aug 2018 11:15:32 +0000
Subject: unposted: _make: Allow pasted arguments for GNU make's -j option.

---
 ChangeLog                     | 5 +++++
 Completion/Unix/Command/_make | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index c5ffd0b7c..ff357f5f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-13  Daniel Shahaf  
+
+	* unposted: Completion/Unix/Command/_make: Allow pasted arguments
+	for GNU make's -j option.
+
 2018-08-13  Peter Stephenson  
 
 	* dana: 43275: Doc/Zsh/mod_mathfunc.yo, Src/Modules/mathfunc.c,
diff --git a/Completion/Unix/Command/_make b/Completion/Unix/Command/_make
index 1761bba71..e23906373 100644
--- a/Completion/Unix/Command/_make
+++ b/Completion/Unix/Command/_make
@@ -177,7 +177,7 @@ _make() {
       '(- *)'{-h,--help}'[print help message and exit]'
       '(-i --ignore-errors)'{-i,--ignore-errors}'[ignore errors from recipes]'
       '*'{-I,--include-dir=}'[search DIRECTORY for included makefiles]:search path for included makefile:->dir'
-      '(-j --jobs)'{-j,--jobs=}'[allow N jobs at once; infinite jobs with no arg]:number of jobs'
+      '(-j --jobs)'{-j+,--jobs=}'[allow N jobs at once; infinite jobs with no arg]:number of jobs'
       '(-k --keep-going)'{-k,--keep-going}"[keep going when some targets can't be made]"
       '(-l --load-average --max-load)'{-l,--load-average=,--max-load}"[don't start multiple jobs unless load is below N]:load"
       '(-L --check-symlink-times)'{-L,--check-symlink-times}'[use the latest mtime between symlinks and target]'
-- 
cgit v1.2.3


From 9567bfe061679ebdddd371bb829c004fe6e58588 Mon Sep 17 00:00:00 2001
From: dana 
Date: Wed, 15 Aug 2018 16:15:24 -0500
Subject: 43302: Fix _du -B spec

---
 ChangeLog                   | 4 ++++
 Completion/Unix/Command/_du | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index ff357f5f2..1565ea370 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-08-15  dana  
+
+	* 43302: Completion/Unix/Command/_du: Change -B to -B+
+
 2018-08-13  Daniel Shahaf  
 
 	* unposted: Completion/Unix/Command/_make: Allow pasted arguments
diff --git a/Completion/Unix/Command/_du b/Completion/Unix/Command/_du
index e812b635e..711f43471 100644
--- a/Completion/Unix/Command/_du
+++ b/Completion/Unix/Command/_du
@@ -6,7 +6,7 @@ if _pick_variant gnu=Free\ Soft unix --version /dummy/no-such-file; then
   _arguments -s \
     '(-a --all -s --summarize)'{-a,--all}'[write counts for all files]' \
     '--apparent-size[print apparent sizes rather than disc usage]' \
-    '(-B --block-size -k)'{-B,--block-size=}'[specify block size]:size (bytes)' \
+    '(-B --block-size -k)'{-B+,--block-size=}'[specify block size]:size (bytes)' \
     '(-B --block-size -k --apparent-size -b --bytes)'{-b,--bytes}'[equivalent to --apparent-size --block-size=1]' \
     '(-c --total)'{-c,--total}'[produce a grand total]' \
     '(-H -D --dereference-args -L --dereference -P --no-dereference)'{-H,-D,--dereference-args}'[dereference arguments that are symlinks]' \
@@ -64,7 +64,7 @@ else
     'netbsd*' '-i[output inode usage instead of blocks]' \
     '(darwin*|freebsd*|netbsd*|solaris2.<11->)' '(-h -k -g -B)-m[use block size of 1M-byte]' \
     '(darwin|freebsd<8->.|netbsd)*' '(-h -k -m -B)-g[use block size of 1G-byte]' \
-    'freebsd*' '(-h -k -m -g)-B[block size]:block size (bytes)' \
+    'freebsd*' '(-h -k -m -g)-B+[block size]:block size (bytes)' \
     '(darwin|*bsd|dragonfly)*' '-c[display grand total]' \
     'freebsd*' '-l[count sizes many times if hard linked]' \
     '(freebsd|netbsd)*' '-n[ignore files and directories with nodump flag set]' \
-- 
cgit v1.2.3


From 01bc3c124a8c1dc8a5c45f5f5d67bba6e29cabff Mon Sep 17 00:00:00 2001
From: Oliver Kiddle 
Date: Thu, 23 Aug 2018 01:19:54 +0200
Subject: 43301: add some functions from zsh-completions project

---
 ChangeLog                          |   7 ++
 Completion/Debian/Command/_debuild |  20 ++++++
 Completion/Unix/Command/_ack       | 138 +++++++++++++++++++++++++++++++++++++
 Completion/Unix/Command/_scons     |  59 ++++++++++++++++
 Completion/Unix/Command/_vpnc      |  54 +++++++++++++++
 Completion/X/Command/_geany        |  30 ++++++++
 6 files changed, 308 insertions(+)
 create mode 100644 Completion/Debian/Command/_debuild
 create mode 100644 Completion/Unix/Command/_ack
 create mode 100644 Completion/Unix/Command/_scons
 create mode 100644 Completion/Unix/Command/_vpnc
 create mode 100644 Completion/X/Command/_geany

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index f6fc5855e..52cf22461 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-08-23  Oliver Kiddle  
+
+	* 43301 (based on work by Julien Nicoulaud):
+	Completion/Debian/Command/_debuild, Completion/Unix/Command/_ack,
+	Completion/Unix/Command/_scons, Completion/Unix/Command/_vpnc,
+	Completion/X/Command/_geany: functions from zsh-completions project
+
 2018-08-21  Daniel Shahaf  
 
 	* unposted: Doc/Zsh/compsys.yo: docs: Fix duplicated words
diff --git a/Completion/Debian/Command/_debuild b/Completion/Debian/Command/_debuild
new file mode 100644
index 000000000..5b1d0ea37
--- /dev/null
+++ b/Completion/Debian/Command/_debuild
@@ -0,0 +1,20 @@
+#compdef debuild
+
+local ign noc
+
+(( $#words > 2 )) && ign='!'
+(( CURRENT != 2 )) && noc='!'
+
+_arguments \
+  "${ign}(- 1 *)"{-h,--help}'[display usage information]' \
+  "${ign}(- 1 *)--version[display version and copyright information]" \
+  ${noc}{--no-conf,--noconf}"[don't read devscripts config files]" \
+  {-r-,--rootcmd=}'[specify command used to become root if debuild not setuid root]: : _command_names -e' \
+  '(--preserve-env)*'{-e-,--preserve-envvar=}'[preserve environment variable]:environment variable:_parameters -g "*export*"' \
+  '(-e --preserve-envvar)--preserve-env[preserve all environment vars (except PATH)]' \
+  '*'{-e-,--set-envvar=}'[preserve environment variable]:environment variable:_parameters -g "*export*" -qS=' \
+  '--prepend-path=[prepend to the sanitised PATH]: :_dir_list' \
+  '(-D)-d[skip checking of build dependencies]' \
+  '(-d)-D[force checking of build dependencies]' \
+  '--check-dirname-level[specify how much to check directory names]:level [1]:((0\:never 1\:only\ if\ program\ changes\ directory 2\:always))' \
+  '--check-dirname-regex[specify what constitutes a matching directory name]:perl regex [PACKAGE(-.*)?]'
diff --git a/Completion/Unix/Command/_ack b/Completion/Unix/Command/_ack
new file mode 100644
index 000000000..626e54e0f
--- /dev/null
+++ b/Completion/Unix/Command/_ack
@@ -0,0 +1,138 @@
+#compdef ack ack2 ack-grep ack-standalone
+
+local curcontext="$curcontext" update_policy ign suf ret=1
+local -a state line
+local -A opt_args
+
+_ack_types_caching_policy() {
+  # Rebuild if ackrc more recent than cache.
+  [[ -f ${ACKRC:-$HOME/.ackrc} && ${ACKRC:-$HOME/.ackrc} -nt "$1" ]] && return 0
+
+  # Rebuild if cache is older than one week.
+  local -a oldp
+  oldp=( "$1"(Nmw+1) )
+  (( $#oldp )) && return 0
+
+  return 1
+}
+
+zstyle -s ":completion:${curcontext}:" cache-policy update_policy
+[[ -z "$update_policy" ]] && zstyle ":completion:${curcontext}:" cache-policy _ack_types_caching_policy
+
+typeset -ga _ack_raw_types
+if _cache_invalid ack-types || ! _retrieve_cache ack-types; then
+  (( ${+commands[${words[1]}]} )) && _ack_raw_types=(
+      ${(S)${(S)${(f)${${"$(_call_program file-types $words[1] --help=types)"}#*--\[no\]}}%; first line matches \/*\/}#*no\]} )
+  [[ $#_ack_raw_types -gt 0 ]] && _store_cache ack-types _ack_raw_types
+fi
+
+(( $#words > 2 )) && ign='!'
+
+_arguments -C -s -S \
+  '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{-i,--ignore-case}'[match case-insensitively]' \
+  '(-i --ignore-case --no-smart-case --nosmart-case --lines)--smart-case[case-insensitive match unless pattern includes uppercase]' \
+  '(-i --ignore-case --smart-case --no-smart-case --nosmart-case --lines)'{--no-smart-case,--nosmart-case}'[disable --smart-case option]' \
+  '(-v --invert-match)'{-v,--invert-match}'[select non-matching lines]' \
+  '(-w --word-regexp)'{-w,--word-regexp}'[force pattern to match only whole words]' \
+  '(-Q --literal)'{-Q,--literal}'[use literal strings]' \
+  '(1)*--lines=[only print specific lines of each file]:line number (list and/or range)' \
+  '(-l --files-with-matches -L --files-without-matches)'{-l,--files-with-matches}"[output matching files' names only]" \
+  '(-L --files-without-matches -l --files-with-matches)'{-L,--files-without-matches}"[output non-matching files' names only]" \
+  '--output=[output result of expression for each line (turns off text highlighting)]:perl expression' \
+  '-o[show only matching part of line]' \
+  '--passthru[print all lines, whether matching or not]' \
+  '(1)--match=[specify the pattern explicitly]:pattern' \
+  '(-m --max-count)'{-m+,--max-count=}'[stop after specified no of matches in each file]:max number of matches' \
+  '-1[stop after reporting first match of any kind]' \
+  '(-H --with-filename -h --no-filename)'{-H,--with-filename}'[print filename with each match]' \
+  '(-h --no-filename -H --with-filename)'{-h,--no-filename}'[suppress printing of filenames]' \
+  '(-c --count)'{-c,--count}'[only print a count of matching lines]' \
+  '--column[print column number of first match on each line]' \
+  '(-A --after-context -C --context)'{-A+,--after-context=}'[specify lines of trailing context]::lines [2]' \
+  '(-B --before-context -C --context)'{-B+,--before-context=}'[specify lines of leading context]::lines [2]' \
+  '(-C --context -A --after-context -B --before-context)'{-C+,--context=}'[specify lines of context]:lines [2]' \
+  '--print0[separate filenames with a null instead of a newline]' \
+  '-s[suppress error messages about nonexistent or unreadable files]' \
+  "(--nopager)--pager=[direct ack's output through program]: : _command_names -e" \
+  "(--pager)--nopager[don't send output through a pager; overrides .ackrc, ACK_PAGER & ACK_PAGER_COLOR]" \
+  '(--noheading --heading)'{--noheading,--heading}'[print a filename heading above results, default on]' \
+  '(--nobreak --break)'{--nobreak,--break}'[print a break between results from different files, default on]' \
+  '(--nogroup)--group[group matches by file name]' \
+  "(--group)--nogroup[don't group matches by file name]" \
+  '(--nocolor --nocolour)--colo'{,u}'r[enable color highlighting of output]' \
+  '(--color --colour --color-filename --color-match --color-lineno)--nocolo'{,u}'r[suppress the color]' \
+  '(--nocolor --nocolour --color --colour)--color-filename=[sets the color to be used for filenames]:color:->colors' \
+  '(--nocolor --nocolour --color --colour)--color-match=[sets the color to be used for matches]:color:->colors' \
+  '(--nocolor --nocolour --color --colour)--color-lineno=[specify color for line numbers]:color:->colors' \
+  '--flush[flush output on every line]' \
+  '(1)-f[only print the files that would be searched, without actually doing any searching]' \
+  '(1)-g[print files where the relative path + filename matches the given pattern]:pattern to match against filenames' \
+  '--sort-files[sorts the found files lexically]' \
+  '--show-types[print the file types that ack associates with each file]' \
+  '(--files-from -x)--files-from=[read the list of files to search from specified file]:files:_files' \
+  '(-x --files-from)-x[read the list of files to search from standard input]' \
+  '*--ignore-dir'{,ectory}'=[ignore directory]:directory:_directories' \
+  '*--noignore-dir'{,ectory}'=[remove directory from ignored list]:directory:_directories' \
+  '*--ignore-file=[add filter for ignoring files]:filter:->filters' \
+  '(-r -R --recurse -n --no-recurse)'{-r,-R,--recurse}'[recurse subdirectories]' \
+  '(-n --no-recurse -r -R --recurse)'{-n,--no-recurse}"[don't descend into subdirectories]" \
+  '(--nofollow)--follow[follow symlinks]' \
+  "(--follow)--nofollow[don't follow symlinks]" \
+  '(-k --known-types)'{-k,--known-types}'[include only files of types that ack recognizes]' \
+  '*--type=[specify the types of files to include or exclude from a search]:type:->file-types' \
+  '*--type-'{add,set}'=[files with the given extensions are recognized as being of the given type]:type-def:->type-defs' \
+  '*--type-del=[remove all filters associated with specified file type]: :->file-types' \
+  '(--env)--noenv[ignore environment variables and global ackrc files]' '!(--noenv)--env)' \
+  '--ackrc=[specify an ackrc file to use]:files:_files' \
+  '--ignore-ack-defaults[ignore default definitions included with ack]' \
+  "${ign}(- 1 *)--create-ackrc[output an ackrc based on customizations]" \
+  "${ign}(- 1 *)"{-\?,--help}'[display usage information]' \
+  "${ign}(- 1 *)--help-types[display all known types]" \
+  "${ign}(- 1 *)--dump[display information on which options are loaded and which RC files]" \
+  '(--filter --nofilter)--filter[treat standard input as pipe]' \
+  '(--filter --nofilter)--nofilter[treat standard input as tty]' \
+  "${ign}(- 1 *)--man[display the manual page]" \
+  "${ign}(- 1 *)--version[display version and copyright information]" \
+  "${ign}(- 1 *)--bar[consult Admiral Ackbar]" \
+  "${ign}(- 1 *)--thpppt[bill the cat]" \
+  "${ign}(- 1 *)--cathy[chocolate chocolate chocolate]" \
+  {'--','--no'}${_ack_raw_types/ ##/\[}']' \
+  '1: :_guard "^-*" pattern' \
+  '*:file:_files' && ret=0
+
+case $state in
+  colors)
+    compset -P '* '
+    compset -S ' *'
+    _wanted colors expl color compadd \
+      {,on_}{,bright_}{black,red,green,yellow,blue,magenta,cyan,white} \
+      clear reset dark bold under{line,score} blink reverse concealed && ret=0
+  ;;
+  type-defs)
+    if ! compset -P 1 '*:'; then
+      _message -e type-name 'type name'
+      return
+    fi
+  ;& # fall-through
+  filters)
+    if compset -P 1 'ext:'; then
+      _sequence _wanted extensions expl 'extension' compadd - *.*(N:e) && ret=0
+    elif compset -P 1 'is:'; then
+      _description files expl 'file name'
+      _files "$expl[@]" && ret=0
+    elif compset -P 1 '(firstline|)match:'; then
+      _message -e patterns 'pattern'
+    else
+      compset -S ':*' || suf=-S
+      _description filters expl filter
+      compadd "$expl[@]" ${suf:+-S:} ext is && ret=0
+      compadd "$expl[@]" ${suf:+-S:/} match firstlinematch && ret=0
+    fi
+  ;;
+  file-types)
+    local types; types=( {,no}${^_ack_raw_types/ ##/:} )
+    _describe -t file-types 'file type' types && ret=0
+  ;;
+esac
+
+return ret
diff --git a/Completion/Unix/Command/_scons b/Completion/Unix/Command/_scons
new file mode 100644
index 000000000..2c620cc1a
--- /dev/null
+++ b/Completion/Unix/Command/_scons
@@ -0,0 +1,59 @@
+#compdef scons
+
+_arguments -s -S \
+  '(-c --clean --remove)-'{c,-clean,-remove}'[remove specified targets and dependencies]' \
+  '(-C --directory)-'{C,-directory=}'[change to specified directory first]:directory:_directories' \
+  '--cache-debug=[print CacheDir debug info to file]:file:_files' \
+  '(--cache-disable --no-cache)--'{cache-disable,no-cache}"[don't retrieve built targets from cache]" \
+  '(--cache-force --cache-populate)--'{cache-force,cache-populate}'[copy already-built targets into cache]' \
+  "--cache-readonly[don't update CacheDir with built targets]" \
+  '--cache-show[print build actions for files from cache]' \
+  '--config=[set Configure mode]:mode:(auto force cache)' \
+  '(-u --up --search-up -U)-D[search up for SConstruct; build default targets]' \
+  '--debug=[print debugging information]:type:(
+      count duplicate explain findlibs includes memoizer memory objects pdb prepare presub stacktrace time)' \
+  '--diskcheck=[enable specific on-disk checks]:check:(all none match rcs sccs)' \
+  '--duplicate=[set preferred file duplication methods]:file duplication methods:(
+      hard-soft-copy soft-hard-copy hard-copy soft-copy copy)' \
+  '(-f --file --makefile --sconstruct)-'{f,-file=,-makefile=,-sconstruct=}'[specify SConstruct file]:file:_files' \
+  '(-)-'{h,-help}'[display defined usage information]' \
+  '(-)-'{H,-help-options}'[display usage information]' \
+  '(-i -ignore-errors)-'{i,-ignore-errors}'[ignore errors from build actions]' \
+  \*{-I,--include-dir=}'[add directory to search Python modules]:directories:_directories' \
+  '(--implicit-deps-changed --implicit-deps-unchanged)--implicit-cache[cache scanned dependencies]' \
+  '(--implicit-cache --implicit-deps-changed)--implicit-deps-changed[rescan dependencies]' \
+  '(--implicit-cache --implicit-deps-unchanged)--implicit-deps-unchanged[ignore changes to scanned dependencies]' \
+  '--interactive[start interactive mode]' \
+  '(-j --jobs)-'{j,jobs=}'[specify no of jobs to run in parallel]' \
+  '(-k --keep-going)-'{k,-keep-going}'[continue after an error]' \
+  '--max-drift=[set the maximum clock drift]:drift (seconds)' \
+  '--md5-chunksize=[set chunksize for MD5 signature computation]:size (kB)' \
+  '(-n --just-print --dry-run --recon)-'{n,-just-print,-dry-run,-recon}"[print commands but don't run them]" \
+  "--no-site-dir[don't use the usual site_scons directory]" \
+  '--profile=[profile scons]:output file:_files' \
+  '(-q --question)-'{q,question}'[query whether up-to-date]' \
+  '-Q[suppress progress messages]' \
+  '--random[build dependencies in random order]' \
+  '(-s --silent --quiet)-'{s,-silent,-quiet}"[don't print commands]" \
+  '--site-dir=[specify site_scons directory]:directory:_directories' \
+  '--stack-size[set stacksize of threads]:size (kB)' \
+  '--taskmastertrace=[trace node evaluation to file]:file' \
+  '--tree=[print dependency tree]:format:(all derived prune status)' \
+  '(-u --up --search-up -D -U)-'{u,-up,-search-up}'[search up for SConstruct; build current directory]' \
+  '(-u --up --search-up -D)-U[search up for SConstruct; build Default targets]' \
+  '(-)-'{v,-version}'[print version information]' \
+  \*{--warn=,--warning=}'[enable or disable warnings]:type:(
+      all cache-write-error corrupt-sconsign dependency deprecated
+      deprecated-copy deprecated-source-signatures deprecated-target-signatures
+      duplicate-environment fortran-cxx-mix link misleading-keywords
+      missing-sconscript no-md5-module no-metaclass-support no-object-count
+      no-parallel-support python-version reserved-variable stack-size no-all
+      no-cache-write-error no-corrupt-sconsign no-dependency no-deprecated
+      no-deprecated-copy no-deprecated-source-signatures
+      no-deprecated-target-signatures no-duplicate-environment
+      no-fortran-cxx-mix no-link no-misleading-keywords no-missing-sconscript
+      no-no-md5-module no-no-metaclass-support no-no-object-count
+      no-no-parallel-support no-python-version no-reserved-variable
+      no-stack-size)' \
+  \*{-Y,--repository}'[search specified repository for files]:repository:_files' \
+  '*:target:_default' # Doesn't seem to be a simple way to get a list of targets
diff --git a/Completion/Unix/Command/_vpnc b/Completion/Unix/Command/_vpnc
new file mode 100644
index 000000000..9c4f4d41b
--- /dev/null
+++ b/Completion/Unix/Command/_vpnc
@@ -0,0 +1,54 @@
+#compdef vpnc vpnc-connect
+
+local ign
+
+(( $#words > 2 )) && ign='!'
+_arguments \
+  "${ign}(- : *)--version[display version information]" \
+  "${ign}(- : *)--"{,long-}'help[display usage information]' \
+  '--gateway=[specify IP/name of IPSec gateway]: :_hosts' \
+  '--id=[specify group name]: :_groups' \
+  '--username=[specify username]: :_users' \
+  '--domain=[specify domain name for authentication]: :_domains' \
+  '--xauth-inter[enable interactive extended authentication]' \
+  '--vendor=[specify IPSec gateway vendor]:vendor:(cisco netscreen)' \
+  '--natt-mode=[specify NAT-Traversal method to use]:NAT-traversal method [natt]:((
+      natt\:NAT-T\ as\ defined\ in\ RFC3947
+      none\:disable\ use\ of\ any\ NAT-T\ method
+      force-natt\:always\ use\ NAT-T\ encapsulation\ even\ without\ presence\ of\ a\ NAT\ device
+      cisco-udp\:Cisco\ proprietary\ UDP\ encapsulation,\ commonly\ over\ port\ 10000
+  ))' \
+  '--script=[specify command executed using system() to configure the interface, routing and so on]: : _command_names -e' \
+  '--dh=[specify the IKE DH group]:group:(dh1 dh2 dh5)' \
+  '--pfs=[specify Diffie-Hellman group to use for PFS]:group:(nopfs dh1 dh2 dh5 server)' \
+  '--enable-1des[enable weak single DES encryption]' \
+  '--enable-no-encryption[use no encryption for data traffic (key exchange still encrypted)]' \
+  '--application-version=[specify application version to report]:application version' \
+  '--ifname=[specify visible name of the TUN/TAP interface]:interface name' \
+  '--ifmode=[specify mode of TUN/TAP interface]:mode [tun]:(tun tap)' \
+  '--ifmtu=[set MTU for TUN/TAP device]:MTU (0-65535) [0 - automatic]' \
+  "--debug[show verbose debug messages]:debug information:((
+      0\:don\'t\ print\ debug\ information
+      1\:print\ minimal\ debug\ information
+      2\:show\ state\ machine\ and\ packet/payload\ type\ information
+      3\:dump\ everything\ excluding\ authentication\ data
+      99\:dump\ everything\ including\ authentication\ data\ \(e.g.\ passwords\)
+  ))" \
+  "--no-detach[don't detach from the console after login]" \
+  '--pid-file=[store the pid of background process in specified file]:pid file:_files' \
+  '--local-addr=[specify local IP to use for ISAKMP/ESP/...]: :_hosts' \
+  '--local-port=[specify local ISAKMP port number to use]:ISAKMP port number (0-65535) [500]' \
+  '--udp-port=[specify local UDP port number to use]:udp port (0-65535) [10000]' \
+  '--dpd-idle=[send DPD packet after not receiving anything for specified time]:timeout (seconds) [600]' \
+  "--non-inter[don't ask anything, exit on missing options]" \
+  '--auth-mode=[specify authentication mode]:authentication mode [psk]:((
+    psk\:pre-shared\ key
+    cert\:server\ +\ client\ certificate
+    hybrid\:server\ certificate\ +\ xauth
+  ))' \
+  '--ca-file=[specify CA-PEM-File]:CA-PEM file:_files -g "*.pem(-.)"' \
+  '--ca-dir=[specify trusted CA-Directory]:CA directory:_files -/' \
+  '--target-network=[specify target network]:network/netmask' \
+  '--password-helper=[specify password helper executable]: : _command_names -e' \
+  '--print-config[print configuration in form that can be used as vpnc.conf]' \
+  '*:configuration [default]:compadd - /etc/vpnc/*.conf(N:t:r)'
diff --git a/Completion/X/Command/_geany b/Completion/X/Command/_geany
new file mode 100644
index 000000000..c6a9ae113
--- /dev/null
+++ b/Completion/X/Command/_geany
@@ -0,0 +1,30 @@
+#compdef geany
+
+local ign
+
+(( $#words > 2 )) && ign='!'
+_arguments -s -S \
+  "${ign}(- *)"{-h,--help}'[display usage information]' \
+  "${ign}(- *)--help-all[display all options]" \
+  "${ign}(- *)--help-gtk[display GTK+ Options]" \
+  '--column=[set initial column number for the first opened file]:column number' \
+  '(-c --config)'{-c,--config=}'[use an alternate configuration directory]:configuration directory:_directories' \
+  "${ign}(- *)--ft-names[print internal filetype names]" \
+  {-g,--generate-tags}'[generate global tags file]:tags file:_files -g "*.tags(-.)":*:source file:_files' \
+  '(-P --no-preprocessing)'{-P,--no-preprocessing}"[don't preprocess C/C++ files when generating tags]" \
+  '(-i --new-instance --socket-file)'{-i,--new-instance}"[don't open files in a running instance, force opening a new instance]" \
+  '(-i --new-instance)--socket-file=[use specified socket file to communicate with a Geany instance]:socket:_files -g "*(-=)"' \
+  "${ign}(- *)--list-documents[return a list of open documents in a running Geany instance]" \
+  '(-l --line)'{-l,--line=}'[set initial line number for the first opened file]:line number' \
+  '(-m --no-msgwin)'{-m,--no-msgwin}"[don't show message window at startup]" \
+  '(-n --no-ctags)'{-n,--no-ctags}"[don't load completion and call tip data]" \
+  '(-p --no-plugins)'{-p,--no-plugins}"[don't load plugins]" \
+  "${ign}(- *)--print-prefix[print Geany's installation prefix]" \
+  '(-r --read-only)'{-r,--read-only}'[open all given files in read-only mode]' \
+  '(-s --no-session)'{-s,--no-session}"[don't load the previous session's files]" \
+  '(-t --no-terminal --vte-lib)'{-t,--no-terminal}"[don't load terminal support]" \
+  '(-t --no-terminal)--vte-lib=[specify path and filename of VTE library]:libvte.so filename:_files -g "*.so(-.)"' \
+  '(-v --verbose)'{-v,--verbose}'[be verbose]' \
+  "${ign}(- *)"{-V,--version}'[display version information]' \
+  '--display=[specify X display to use]:display:_x_display' \
+  '(-g --generate-tags)*: :_files'
-- 
cgit v1.2.3


From d25c6d59e9c399ffab6d60f087f1ac296884f55c Mon Sep 17 00:00:00 2001
From: Anton Shestakov 
Date: Wed, 22 Aug 2018 22:39:59 +0800
Subject: 43326: _hg: add completion of -S/--subrepos to many commands

---
 ChangeLog                   |  3 +++
 Completion/Unix/Command/_hg | 24 ++++++++++++++----------
 2 files changed, 17 insertions(+), 10 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 3e5c0a171..82d64d776 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-23  Oliver Kiddle  
 
+	* 43326: Anton Shestakov: Completion/Unix/Command/_hg:
+	add completion of -S/--subrepos to many commands
+
 	* github #27: Klas Mellbourn: Completion/X/Command/_code:
 	add --folder-uri to completion for Visual Studio Code
 
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 2b2d3c4ec..99cbd1742 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -405,18 +405,22 @@ _hg_remote_opts=(
   '--insecure[do not verify server certificate (ignoring web.cacerts config)]'
 )
 
+_hg_subrepos_opts=(
+  '(--subrepos -S)'{-S,--subrepos}'[recurse into subrepositories]'
+)
+
 _hg_cmd() {
   _call_program hg hg --config ui.verbose=0 --config defaults."$1"= \
     "$_hg_cmd_globals[@]" "$@" 2> /dev/null
 }
 
 _hg_cmd_add() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
   '*:unknown files:_hg_unknown'
 }
 
 _hg_cmd_addremove() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_dryrun_opts $_hg_subrepos_opts \
   '(--similarity -s)'{-s+,--similarity=}'[guess renamed files by similarity (0<=s<=100)]:similarity' \
   '*:unknown or missing files:_hg_addremove'
 }
@@ -436,7 +440,7 @@ _hg_cmd_annotate() {
 }
 
 _hg_cmd_archive() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
   '--no-decode[do not pass files through decoders]' \
   '(--prefix -p)'{-p+,--prefix=}'[directory prefix for files in archive]:prefix' \
   '(--rev -r)'{-r+,--rev=}'[revision to distribute]:revision:_hg_tags' \
@@ -517,7 +521,7 @@ _hg_cmd_clone() {
 }
 
 _hg_cmd_commit() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
   '(--addremove -A)'{-A,--addremove}'[mark new/missing files as added/removed before committing]' \
   '(--message -m)'{-m+,--message=}'[specify commit message]:text' \
   '(--logfile -l)'{-l+,--logfile=}'[read commit message from specified file]:log file:_files' \
@@ -541,7 +545,7 @@ _hg_cmd_diff() {
   local context state state_descr line ret=1
   typeset -A opt_args
 
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts $_hg_subrepos_opts \
   '*'{-r+,--rev=}'[revision]:revision:_hg_revrange' \
   '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \
   '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \
@@ -630,7 +634,7 @@ _hg_cmd_import() {
 }
 
 _hg_cmd_incoming() {
-  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts $_hg_subrepos_opts \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
@@ -683,7 +687,7 @@ _hg_cmd_merge() {
 }
 
 _hg_cmd_outgoing() {
-  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_remote_opts $_hg_template_opts $_hg_subrepos_opts \
   '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
   '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
   '(--patch -p)'{-p,--patch}'[show patch]' \
@@ -732,7 +736,7 @@ _hg_cmd_push() {
 }
 
 _hg_cmd_remove() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
   '(--after -A)'{-A,--after}'[record delete for missing files]' \
   '(--force -f)'{-f,--force}'[forget added files, delete modified files]' \
   '*:file:_hg_files'
@@ -793,7 +797,7 @@ _hg_cmd_revert() {
 }
 
 _hg_cmd_serve() {
-  _arguments -s -S : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_subrepos_opts \
   '(--accesslog -A)'{-A+,--accesslog=}'[name of access log file to write to]:log file:_files' \
   '(--errorlog -E)'{-E+,--errorlog=}'[name of error log file to write to]:log file:_files' \
   '(--daemon -d)'{-d,--daemon}'[run server in background]' \
@@ -821,7 +825,7 @@ _hg_cmd_showconfig() {
 }
 
 _hg_cmd_status() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_pat_opts $_hg_subrepos_opts \
   '(--all -A)'{-A,--all}'[show status of all files]' \
   '(--modified -m)'{-m,--modified}'[show only modified files]' \
   '(--added -a)'{-a,--added}'[show only added files]' \
-- 
cgit v1.2.3


From 0e3508f476dbed680e7f3458a3ad27dbffa00d6f Mon Sep 17 00:00:00 2001
From: Anton Shestakov 
Date: Wed, 22 Aug 2018 22:40:00 +0800
Subject: 43325: _hg: suggest merge tools for -t/--tool

---
 ChangeLog                   |  3 +++
 Completion/Unix/Command/_hg | 24 ++++++++++++++++++++----
 2 files changed, 23 insertions(+), 4 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 82d64d776..5d7b77703 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2018-08-23  Oliver Kiddle  
 
+	* 43325: Anton Shestakov: Completion/Unix/Command/_hg:
+	suggest merge tools for -t/--tool
+
 	* 43326: Anton Shestakov: Completion/Unix/Command/_hg:
 	add completion of -S/--subrepos to many commands
 
diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index 99cbd1742..4b88ce4ea 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -282,6 +282,18 @@ _hg_config() {
     (( $#items )) && _describe -t config 'config item' items
 }
 
+_hg_internal_merge_tools=(
+  \\:dump \\:fail \\:local \\:merge \\:merge-local \\:merge-other \\:merge3
+  \\:other \\:prompt \\:tagmerge \\:union
+)
+
+_hg_merge_tools() {
+  typeset -a external_tools
+  _describe -t internal_tools 'internal merge tools' _hg_internal_merge_tools
+  external_tools=(${(f)"$(_hg_cmd showconfig merge-tools | cut -d . -f 2)"})
+  (( $#external_tools )) && _describe -t external_tools 'external merge tools' external_tools
+}
+
 _hg_addremove() {
   _alternative 'files:unknown files:_hg_unknown' \
     'files:missing files:_hg_missing'
@@ -387,6 +399,10 @@ _hg_diff_opts=(
   '--nodates[omit dates from diff headers]'
 )
 
+_hg_mergetool_opts=(
+  '(--tool -t)'{-t+,--tool=}'[specify merge tool]:merge tool:_hg_merge_tools'
+)
+
 _hg_dryrun_opts=(
   '(--dry-run -n)'{-n,--dry-run}'[do not perform actions, just print output]')
 
@@ -449,7 +465,7 @@ _hg_cmd_archive() {
 }
 
 _hg_cmd_backout() {
-  _arguments -s -S : $_hg_global_opts $_hg_pat_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts $_hg_pat_opts \
     '--merge[merge with old dirstate parent after backout]' \
     '(--date -d)'{-d+,--date=}'[record the specified date as commit date]:date' \
     '--parent[parent to choose when backing out merge]' \
@@ -679,7 +695,7 @@ _hg_cmd_manifest() {
 }
 
 _hg_cmd_merge() {
-  _arguments -s -S : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
   '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
   '(--rev -r 1)'{-r+,--rev=}'[revision to merge]:revision:_hg_mergerevs' \
   '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
@@ -753,7 +769,7 @@ _hg_cmd_resolve() {
   local context state state_descr line ret=1
   typeset -A opt_args
 
-  _arguments -s -S : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
   '(--all -a)'{-a,--all}'[select all unresolved files]' \
   '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
   '(--list -l --mark -m --unmark -u)'{-l,--list}'[list state of files needing merge]:*:merged files:->resolve_files' \
@@ -871,7 +887,7 @@ _hg_cmd_unbundle() {
 }
 
 _hg_cmd_update() {
-  _arguments -s -S : $_hg_global_opts \
+  _arguments -s -S : $_hg_global_opts $_hg_mergetool_opts \
   '(--clean -C)'{-C,--clean}'[discard uncommitted changes (no backup)]' \
   '(--check -c)'{-c,--check}'[require clean working directory]' \
   '(--date -d)'{-d+,--date=}'[tipmost revision matching date]:date' \
-- 
cgit v1.2.3


From 7bf4f03eb3bef10d324c14c417f8f3b356cd3a42 Mon Sep 17 00:00:00 2001
From: dana 
Date: Thu, 23 Aug 2018 18:14:02 -0500
Subject: unposted: Fix --ascii typo in _man

---
 ChangeLog                    | 4 ++++
 Completion/Unix/Command/_man | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 5d7b77703..7bde76715 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-08-23  dana  
+
+	* unposted: Completion/Unix/Command/_man: Fix --ascii typo
+
 2018-08-23  Oliver Kiddle  
 
 	* 43325: Anton Shestakov: Completion/Unix/Command/_hg:
diff --git a/Completion/Unix/Command/_man b/Completion/Unix/Command/_man
index 7fd92bac5..41ae85a1f 100644
--- a/Completion/Unix/Command/_man
+++ b/Completion/Unix/Command/_man
@@ -85,7 +85,7 @@ _man() {
     )
     [[ $variant == linux* ]] && args+=(
       '(: -)'{-\?,--help}'[display help information]'
-      '(-7 -t -H -T -Z --ascii --html --troff --troff-device --ditroff)'{-7,--asci}'[translate man pages for 7-bit terminal]'
+      '(-7 -t -H -T -Z --ascii --html --troff --troff-device --ditroff)'{-7,--ascii}'[translate man pages for 7-bit terminal]'
       '(-D --default)'{-D,--default}'[reset man to default options]'
       # @todo Could enumerate these
       '(-E --encoding)'{-E+,--encoding=}'[specify output encoding]:encoding'
-- 
cgit v1.2.3


From f7deb4951387a239500853b43464aad820131235 Mon Sep 17 00:00:00 2001
From: Oliver Kiddle 
Date: Fri, 24 Aug 2018 07:55:08 +0200
Subject: 43329: new diff3 completion

---
 ChangeLog                      |  2 ++
 Completion/Unix/Command/_diff3 | 46 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 48 insertions(+)
 create mode 100644 Completion/Unix/Command/_diff3

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index 9f4933c9f..12d67c6d0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
 2018-08-24  Oliver Kiddle  
 
+	* x: Completion/Unix/Command/_diff3: new diff3 completion
+
 	* 43328: Completion/X/Command/_zeal: new completion
 
 2018-08-23  dana  
diff --git a/Completion/Unix/Command/_diff3 b/Completion/Unix/Command/_diff3
new file mode 100644
index 000000000..81e274d05
--- /dev/null
+++ b/Completion/Unix/Command/_diff3
@@ -0,0 +1,46 @@
+#compdef diff3
+
+local -a args ed
+local ign
+
+if _pick_variant gnu=GNU unix; then
+  ed=(
+    '(-m --merge -A --show-all)'{-e,--ed}'[output ed script for incorporating changes]'
+    '(-m --merge -A --show-all)'{-E,--show-overlap}'[like -e, but bracket conflicts]'
+    '(-m --merge -A --show-all)'{-3,--easy-only}'[like -e, but incorporate only nonoverlapping changes]'
+    '(-m --merge -A --show-all)'{-x,--overlap-only}'[like -e, but incorporate only overlapping changes]'
+    '(-m --merge -A --show-all)-X[like -x, but bracket conflicts]'
+  )
+  (( $#words > 2 )) && ign='!'
+  args=(
+    '(-A --show-all ed)'{-A,--show-all}'[output all changes, bracketing conflicts]'
+    "(-m --merge)-i[append 'w' and 'q' commands to ed scripts]"
+    '(-m --merge -i ed)'{-m,--merge}'[output merged file instead of ed script]'
+    '(-a --text)'{-a,--text}'[treat all files as text]'
+    '--strip-trailing-cr[strip trailing carriage return on input]'
+    '(-T --initial-tab)'{-T,--initial-tab}'[make tabs line up by prepending a tab]'
+    '--diff-program=[specify program to compare files]: : _command_names -e'
+    \*{-L+,--label=}'[use specified label instead of file name]:label'
+    "$ign(-)--help[display usage information]"
+    "$ign(-)"{-v,--version}'[display version information]'
+  )
+else
+  args=( -A "-*" )
+  ed=(
+    '-e[output ed script for incorporating changes]'
+    '-E[like -e, but bracket conflicts]'
+    '-x[like -e, but incorporate only overlapping changes]'
+    '-X[like -x, but bracket conflicts]'
+    '-3[like -e, but incorporate only nonoverlapping changes]'
+  )
+  if [[ $OSTYPE != solaris* ]]; then # likely the openbsd diff3 implementation
+    args+=( '-a[treat all files as text]' )
+  fi
+fi
+
+_arguments -s -S $args \
+  '1:updated file:_files' \
+  '2:original file:_files' \
+  '3:updated file:_files' \
+  + '(ed)' $ed
+
-- 
cgit v1.2.3


From 1c5fb91e71271abfc8ed13bf7545de196f1fe764 Mon Sep 17 00:00:00 2001
From: Daniel Shahaf 
Date: Fri, 24 Aug 2018 15:43:29 +0000
Subject: 43331: _diff3: Enhance positional argument descriptions (thanks,
 Oliver).

---
 ChangeLog                      | 5 +++++
 Completion/Unix/Command/_diff3 | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

(limited to 'Completion/Unix/Command')

diff --git a/ChangeLog b/ChangeLog
index a0df4b107..81875ae12 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2018-08-25  Daniel Shahaf  
+
+	* 43331: Completion/Unix/Command/_diff3: Enhance positional
+	argument descriptions (thanks, Oliver).
+
 2018-08-24  Daniel Shahaf  
 
 	* 43313 (log message tweaked):
diff --git a/Completion/Unix/Command/_diff3 b/Completion/Unix/Command/_diff3
index 81e274d05..524507ce0 100644
--- a/Completion/Unix/Command/_diff3
+++ b/Completion/Unix/Command/_diff3
@@ -39,8 +39,8 @@ else
 fi
 
 _arguments -s -S $args \
-  '1:updated file:_files' \
-  '2:original file:_files' \
-  '3:updated file:_files' \
+  '1: : _wanted files expl "first updated file (${${(As.:.)opt_args[-L]}[1]:-mine})" _files' \
+  '2: : _wanted files expl "original file (${${(As.:.)opt_args[-L]}[2]:-old})" _files' \
+  '3: : _wanted files expl "second updated file (${${(As.:.)opt_args[-L]}[3]:-their})" _files' \
   + '(ed)' $ed
 
-- 
cgit v1.2.3