diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Unix/Command/_basename | 27 | ||||
-rw-r--r-- | Completion/Unix/Command/_cat | 26 | ||||
-rw-r--r-- | Completion/Unix/Command/_date | 5 | ||||
-rw-r--r-- | Completion/Unix/Command/_df | 13 | ||||
-rw-r--r-- | Completion/Unix/Command/_fmt | 60 | ||||
-rw-r--r-- | Completion/Unix/Command/_locate | 192 | ||||
-rw-r--r-- | Completion/Unix/Command/_ls | 2 | ||||
-rw-r--r-- | Completion/Unix/Command/_nm | 1 | ||||
-rw-r--r-- | Completion/Unix/Command/_paste | 19 | ||||
-rw-r--r-- | Completion/Unix/Command/_readelf | 3 | ||||
-rw-r--r-- | Completion/Unix/Command/_sed | 3 | ||||
-rw-r--r-- | Completion/Unix/Command/_strip | 7 |
12 files changed, 226 insertions, 132 deletions
diff --git a/Completion/Unix/Command/_basename b/Completion/Unix/Command/_basename new file mode 100644 index 000000000..a826b56b0 --- /dev/null +++ b/Completion/Unix/Command/_basename @@ -0,0 +1,27 @@ +#compdef basename gbasename + +local args variant +_pick_variant -r variant gnu=GNU $OSTYPE --version + +case $variant in + gnu) + args=( -s -S -A "-*" + '(2 -a --multiple)'{-a,--multiple}'[support multiple arguments, handling each]' + '(2 -a --multiple -s --suffix)'{-s+,--suffix=}'[remove a trailing suffix]:suffix' + '(-z --zero)'{-z,--zero}'[separate output with NUL rather than newline]' + '(- *)--version[display version information]' + '(- *)--help[display help information]' + ) + ;; + darwin*|dragonfly*|freebsd*) + args=( -s -S -A "-*" + '(2)-a[support multiple arguments, handling each]' + '(-a 2)-s+[remove a trailing suffix]:suffix' + ) + ;; +esac + +_arguments $args \ + '1:file:_files' \ + '(*)2:suffix' \ + '*:file:_files' diff --git a/Completion/Unix/Command/_cat b/Completion/Unix/Command/_cat index 57b197038..46180f2c8 100644 --- a/Completion/Unix/Command/_cat +++ b/Completion/Unix/Command/_cat @@ -19,8 +19,9 @@ if _pick_variant gnu=GNU unix --version; then '*:files:_files' ) -elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then +elif [[ "$OSTYPE" == (*bsd|dragonfly|darwin)* ]]; then args=( + -A "-*" '(-n)-b[number non-blank output lines]' '(-v)-e[display $ at the end of each line (implies -v)]' '-n[number all output lines]' @@ -28,12 +29,27 @@ elif [[ "$OSTYPE" == (freebsd|dragonfly|darwin)* ]]; then '(-v)-t[display tab as ^I (implies -v)]' '-u[do not buffer output]' '-v[display non-printing chars as ^X or M-a]' - '(-)*:files:_files' + '*:files:_files' ) - [[ $OSTYPE = freebsd* ]] && args+=( + [[ $OSTYPE = (free|net)bsd* ]] && args+=( '-l[set a lock on the stdout file descriptor]' ) - + [[ $OSTYPE = netbsd* ]] && args+=( + '-B+[read with buffer of specified size]:size (bytes)' + '-f[only attempt to display regular files]' + ) +elif [[ $OSTYPE = solaris* ]]; then + args=( + -A "-*" + '(-b)-n[number all output lines]' + '(-n)-b[number non-blank output lines]' + "-u[don't buffer output]" + '-s[be silent about non-existent files]' + '-v[display non-printing chars as ^X or M-a]' + '-e[display $ at the end of each line (requires -v)]' + '-t[display tab as ^I and formfeeds and ^L (requires -v)]' + '*:files:_files' + ) else # POSIX reqires '-u', and most OSes may support '-n' args=( @@ -43,4 +59,4 @@ else ) fi -_arguments -s -S : $args +_arguments -s -S $args diff --git a/Completion/Unix/Command/_date b/Completion/Unix/Command/_date index 731f6963b..a3e933710 100644 --- a/Completion/Unix/Command/_date +++ b/Completion/Unix/Command/_date @@ -8,14 +8,15 @@ opts=( -s -w -C ) if _pick_variant gnu="Free Software Foundation" unix --version; then local d='(-d --date -f --file -r --reference -s --set)' - local f='(-I --iso-8601 -R --rfc-2822 --rfc-3339)' + local f='(-I --iso-8601 -R --rfc-email --rfc-3339)' args=( $d{-d+,--date=}'[output date specified by string]:time string' + '--debug[annotate parsed date and warn about questionable usage]' $d{-f+,--file=}'[output dates specified in file]:file:_files' $d{-r+,--reference=}'[output last modification time of specified file]:file:_files' $d{-s+,--set=}'[set time]:time string' $f{-I-,--iso-8601=-}'[display in ISO 8601 format]::precision:(date hours minutes seconds ns)' - $f{-R,--rfc-2822}'[display in RFC2822 format]' + $f{-R,--rfc-email}'[display in RFC5322 format]' $f'--rfc-3339=-[display in RFC 3339 format]:precision:(date seconds ns)' '(-u --utc --universal)'{-u,--utc,--universal}'[display or set time in UTC]' '(- :)--help[output help and exit]' diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df index a98180a2c..677b8c727 100644 --- a/Completion/Unix/Command/_df +++ b/Completion/Unix/Command/_df @@ -5,12 +5,6 @@ local -A opt_args if _pick_variant gnu=GNU unix --version; then args=( - '(-B --block-size -k)'{-B+,--block-size=}'[specify block size]:size (bytes)' - '(-B --block-size -k)-k[like --block-size=1K]' - '(-P --portability)'{-P,--portability}'[use the POSIX output format]' - '(-h --human-readable -H --si)'{-h,--human-readable}'[print sizes in human readable format]' - '(-h --human-readable -H --si)'{-H,--si}'[human readable fomat, but use powers of 1000 not 1024]' - '(-i --inodes)'{-i,--inodes}'[list inode information instead of block usage]' '--total[produce a grand total]' '(-T --print-type)'{-T,--print-type}'[print file system type]' '(-a --all)'{-a,--all}'[include dummy file systems]' @@ -23,6 +17,13 @@ if _pick_variant gnu=GNU unix --version; then '(- : *)--help[display help and exit]' '(- : *)--version[output version information and exit]' '*:files:_files' + - '(format)' + {-B+,--block-size=}'[specify block size]:size (bytes)' + '-k[like --block-size=1K]' + {-P,--portability}'[use the POSIX output format]' + {-h,--human-readable}'[print sizes in human readable format]' + {-H,--si}'[human readable format, but use powers of 1000 not 1024]' + {-i,--inodes}'[list inode information instead of block usage]' ) elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then args=( diff --git a/Completion/Unix/Command/_fmt b/Completion/Unix/Command/_fmt new file mode 100644 index 000000000..759396637 --- /dev/null +++ b/Completion/Unix/Command/_fmt @@ -0,0 +1,60 @@ +#compdef fmt + +local variant +local -a args +local copt="[preserve indentation of first two lines]" +local wopt="[specify maximum line width]:width [75]" +local sopt="[don't join short lines\: split only]" + +args=( -A "-*" "(1 2)-w+$wopt" '*:file:_files' ) +_pick_variant -r variant gnu=GNU unix --version +case $variant in + gnu) + args=( + '(-c --crown-margin)'{-c,--crown-margin}$copt + '(-w --width)'{-w+,--width=}$wopt + '(-p --prefix)'{-p+,--prefix=}'[only reformat lines with specified prefix]:prefix' + '(-s --split-only)'{-s,--split-only}$sopt + '(-t --tagged-paragraph)'{-t,--tagged-paragraph}'[indentation of first line different from second]' + '(-u --uniform-spacing)'{-u,--uniform-spacing}'[use one space between words, two after sentences]' + '(-g --goal)'{-g,--goal=}'[specify goal width]:goal width [93% of width]' + '(- *)--help[display help information]' + '(- *)--version[display version information]' + '*:file:_files' + ) + ;; + solaris*) + args=( + "-c$copt" + "-s$sopt" + ) + ;; + netbsd*) + args+=( + '-C[center the text]' + '(1 2)-g+[specify goal width]:goal width' + '(1 2)-m+[specify maximum width]:maximum width' + '-r[format all lines]' + ) + ;| + darwin*|dragonfly*|freebsd*|openbsd*) + args+=( + '-c[center the text line by line]' + '-m[sensible formatting of mail header lines]' + '-n[format lines beginning with a . (dot) character]' + "-p[change in indentation doesn't start new paragraph]" + '-s[collapse whitespace inside lines]' + '-d+[specify sentence-ending characters]:sentence ends [.?!]' + '-l+[replace initial spaces with tabs]:tab width [8]' + '-t+[specify tab width of input files]:tab width [8]' + ) + ;& # fall-through + netbsd*) + args+=( ':: :_guard "[0-9]#" goal width' ) + (( ${(M)#words[1,CURRENT-1]:#[0-9]##} )) && args+=( + ':: :_guard "[0-9]#" maximum width' + ) + ;; +esac + +_arguments -s -S $args diff --git a/Completion/Unix/Command/_locate b/Completion/Unix/Command/_locate index 694f506c3..23305f798 100644 --- a/Completion/Unix/Command/_locate +++ b/Completion/Unix/Command/_locate @@ -1,132 +1,96 @@ -#compdef locate mlocate slocate +#compdef locate mlocate slocate glocate -# Decide if we are using mlocate or slocate. -local ltype basename=${words[1]:t} input -# If we can't, use this guess. -local best_guess=mlocate +local variant=$service +local -a args +[[ $service = locate ]] && + _pick_variant -r variant glocate=findutils mlocate=mlocate slocate=secure $OSTYPE -V +args=( '(-)'{-V,--version}'[display version information]' ) -case $basename in - ([ms]locate) - ltype=$basename - ;; - - (locate) - input="$(_call_program locate $words[1] -V 2>&1)" - case $input in - (*mlocate*) - ltype=mlocate - ;; - - (*(#i)secure locate*) - ltype=slocate - ;; - - (*(#i)gnu locate*|*findutils*gnu*) - ltype=gnu - ;; - - (*"illegal option"*) - if [[ $OSTYPE == (freebsd|openbsd|dragonfly|darwin)* ]]; then - ltype=bsd - else - ltype=$best_guess - fi - ;; - - # guess - (*) - ltype=$best_guess - ;; - esac - ;; - - (*) - # too dangerous to run: guess - ltype=$best_guess -esac +case $variant in + [mg]locate) + args+=( + '(-A --all)'{-A,--all}'[only print entries that match all patterns]' + '(-E --non-existing -e --existing)'{-e,--existing}'[restrict display to existing files]' + '(-c --count)'{-c,--count}'[output the number of matching entries]' + '(-i --ignore-case)'{-i,--ignore-case}'[ignore case distinctions in patterns]' + '(-w --wholename -b --basename)'{-w,--wholename}'[match entire file path (default)]' + '(-w --wholename -b --basename)'{-b,--basename}'[match only the basename of files in the database]' + '(-P -H --no-follow -L --follow)'{-P,-H,--nofollow}"[don't follow symbolic links]" + '(-P -H --no-follow -L --follow)'{-L,--follow}'[follow symbolic links to find existing files (default)]' + '(-0 --null)'{-0,--null}'[output separated by NUL characters]' + '(-S --statistics)'{-S,--statistics}'[show database statistics]' + ) + ;| -case $ltype in (mlocate) - # actually, -d can take a colon-separate list # -r/--regexp mean no normal arguments, so shouldn't complete # -m and --mmap are ignored, so don't bother # -s and --stdio likewise - _arguments -s -S : \ - {-b,--basename}'[match only the basename of files in the database]' \ - {-c,--count}'[output the number of matching entries]' \ - {-d,--database=}'[use alternative database]:database:_files' \ - {-e,--existing}'[restrict display to existing files]' \ - {-L,--follow}'[follow symbolic links to find existing files (default)]' \ - {-h,--help}'[show help]' \ - {-i,--ignore-case}'[ignore case distinctions in patterns]' \ - {-l,-n,--limit=}'[limit search results]:file limit: ' \ - {-P,-H,--nofollow}'[don'\''t follow symbolic links]' \ - {-0,--null}'[output separated by NUL characters]' \ - {-S,--statistics}'[show database statistics]' \ - {-q,--quiet}'[don'\''t report errors]' \ - {-r,--regexp=}'[search for given basic regexp]:basic regexp: ' \ - --regex'[patterns are extended regexps]' \ - {-V,--version}'[show version]' \ - {-w,--wholename}'[match entire file path (default)]' \ - '*:pattern: ' + args=( -s -S : $args + \*{-d,--database=}'[use alternative database]:database:_sequence -s \: _files' + '(-)'{-h,--help}'[display help information]' + '(-l -n --limit)'{-l,-n,--limit=}'[limit search results]:file limit' + '(-q --quiet)'{-q,--quiet}"[don't report errors]" + '(:)*'{-r,--regexp=}'[search for given basic regexp]:basic regexp' + '--regex[patterns are extended regexps]' + ) ;; (slocate) # -d can take path # -e can take a comma-separated list of directories. # -f should complete list of file system types like mount - _arguments -s -S : \ - -u'[create slocate database starting at path /]' \ - -U'[create slocate database starting at given path]:directory:_files -/' \ - -c'[parse GNU locate updatedb with -u, -U]' \ - -e'[exclude directories with -u, -U]:directories:_files -/' \ - -f'[exclude file system types from db with -u, -U]:file system:_file_systems' \ - -l'[security level]:level:(0 1)' \ - -q'[quiet mode]' \ - -n'[limit search results]:file limit: ' \ - -i'[case insensitive search]' \ - {-r,--regexp=}'[use basic regular expression]:regexp: ' \ - {-o,--output=}'[specify database to create]:database:_files' \ - {-d,--database=}'[specify database to search]:database:_files' \ - {-h,--help}'[display help]' \ - {-v,--verbose}'[display files when creating database]' \ - {-V,--version}'[display version]' \ - '*:pattern: ' + args=( -s -S : $args + -u'[create slocate database starting at path /]' + -U'[create slocate database starting at given path]:directory:_files -/' + -c'[parse GNU locate updatedb with -u, -U]' + -e'[exclude directories with -u, -U]:directories:_files -/' + -f'[exclude file system types from db with -u, -U]:file system:_file_systems' + -l'[security level]:level:(0 1)' + -q'[quiet mode]' + -n'[limit search results]:file limit ' + -i'[case insensitive search]' + {-r,--regexp=}'[use basic regular expression]:regexp' + {-o,--output=}'[specify database to create]:database:_files' + {-d,--database=}'[specify database to search]:database:_files' + '(-)'{-h,--help}'[display help information]' + {-v,--verbose}'[display files when creating database]' + ) ;; - (gnu) - _arguments -s : \ - {-d,--database=}'[use alternative database]:database:_files' \ - {-e,--existing}'[restrict display to existing files]' \ - {-E,--non-existing}'[allow display of nonexistent files (default)]' \ - {-i,--ignore-case}'[ignore case distinctions in patterns]' \ - {-w,--wholename}'[match entire file path (default)]' \ - {-b,--basename}'[match only the basename of files in the database]' \ - {-l,-n,--limit=}'[limit search results]:file limit: ' \ - {-S,--statistics}'[show database statistics]' \ - {-0,--null}'[output separated by NUL characters]' \ - {-c,--count}'[output the number of matching entries]' \ - {-P,-H,--nofollow}'[don'\''t follow symbolic links]' \ - {-L,--follow}'[follow symbolic links to find existing files (default)]' \ - {-A,-all}'[match all arguments instead of at least one]' \ - {-p,--print}'[include search results with statistics or count]' \ - {-r,--regex=}'[patterns are regular expressions]:basic regexp: ' \ - --regextype='[select type of regular expression]' \ - {-V,--version}'[show version]' \ - --help'[show help]' \ - '*:pattern: ' + (glocate) + args=( -s : $args + \*{-d,--database=}'[use alternative database]:database:_files' + '(-E --non-existing -e --existing)'{-E,--non-existing}'[restrict display to nonexistent files]' + '(-l --limit)'{-l,--limit=}'[limit search results]:file limit: ' + '--max-database-age[specify database age at which warning should be issued]:age (days) [8]' + '(-p --print)'{-p,--print}'[include search results with statistics or count]' + \*{-r,--regex=}'[patterns are regular expressions]:regexp' + --regextype='[select type of regular expression]:regex type [basic]:(findutils-default awk egrep ed emacs gnu-awk grep posix-awk posix-basic posix-egrep posix-extended posix-minimal-basic sed)' + '(-)'--help'[display help information]' + ) ;; - (bsd) - _arguments -s -S -A '-*' \ - '(-S)-0[separate file names by NUL characters]' \ - '(- *)-S[show database statistics and exit]' \ - '(-S)-c[output the number of matching file names]' \ - '(-S)*-d[specify database to search]:database:_files' \ - '(-S)-i[ignore case distinctions in pattern and database]' \ - '(-S)-l[limit output to specified number of file names]:file limit: ' \ - '(-S)-m[use mmap(2) instead of stdio(3) (default)]' \ - '(-S)-s[use stdio(3) instead of mmap(2)]' \ - '*:pattern: ' - ;; + (freebsd|openbsd|dragonfly|darwin)*) + args=( -s -S -A '-*' + '(-S)-c[output the number of matching file names]' + '(-S)-i[ignore case distinctions in pattern and database]' + '(-S)-l[limit output to specified number of file names]:file limit ' + '(- *)-S[show database statistics and exit]' + ) + ;| + openbsd*) + args+=( '(-S)-b[match only the basename of files in the database]' ) + ;| + (freebsd|dragonfly|darwin)*) + args+=( + '(-S)-0[separate file names by NUL characters]' + '(-S)-m[use mmap(2) instead of stdio(3) (default)]' + '(-S)-s[use stdio(3) instead of mmap(2)]' + ) + ;| + (*) args+=( '(-S)*-d[specify database to search]:database:_files' ) ;; + esac + +_arguments $args '*: :_guard "^-*" pattern' diff --git a/Completion/Unix/Command/_ls b/Completion/Unix/Command/_ls index 2ca59423d..ca20107c2 100644 --- a/Completion/Unix/Command/_ls +++ b/Completion/Unix/Command/_ls @@ -131,7 +131,7 @@ else '(--width -w)'{--width=,-w+}'[specify screen width]:screen width' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--escape,-b}'[print octal escapes for control characters]' - '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print raw characters]' + '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--literal,-N}'[print entry names without quoting]' '(--quoting-style -b --escape -N --literal -Q --quote-name)'{--quote-name,-Q}'[quote names]' '(-b --escape -N --literal -Q --quote-name)--quoting-style=:quoting style:(literal shell shell-always c escape clocale locale)' diff --git a/Completion/Unix/Command/_nm b/Completion/Unix/Command/_nm index 73d7508b4..963b43f27 100644 --- a/Completion/Unix/Command/_nm +++ b/Completion/Unix/Command/_nm @@ -58,6 +58,7 @@ if _pick_variant -r variant binutils=GNU elftoolchain=elftoolchain elfutils=elfu '--special-syms[include special symbols in the output]' '--synthetic[display synthetic symbols as well]' "--target=[target object format]:targets:(${${(@M)${(f)$(_call_program targets nm --help)}:#*supported targets:*}##*: })" + '--with-symbol-versions[display version strings after symbol names]' ) ;; esac diff --git a/Completion/Unix/Command/_paste b/Completion/Unix/Command/_paste new file mode 100644 index 000000000..6efe8eacb --- /dev/null +++ b/Completion/Unix/Command/_paste @@ -0,0 +1,19 @@ +#compdef paste + +local -a args +local dopt='[specify delimiter list]:delimiter list [tab]' +local sopt='[paste one file at a time instead of in parallel]' + +if _pick_variant gnu=GNU unix --version; then + args=( + '(-z --zero-terminated)'{-z,--zero-terminated}'[use NUL as line delimiter instead of newline]' + "(-d)--delimiters=$dopt" + "(-s)--serial$sopt" + '(- *)--help[display help information]' + '(- *)--version[display version information]' + ) +else + args=( -A "-?*" ) +fi + +_arguments -s $args "(--delimiters)-d+$dopt" "(--serial)-s$sopt" '*:file:_files' diff --git a/Completion/Unix/Command/_readelf b/Completion/Unix/Command/_readelf index 15d5145c5..46da00cc4 100644 --- a/Completion/Unix/Command/_readelf +++ b/Completion/Unix/Command/_readelf @@ -34,6 +34,7 @@ case $variant in '(-g --section-groups)'{-g,--section-groups}'[show section groups]' '(-t --section-details)'{-t,--section-details}'[show section details]' '(-e --headers)'{-e,--headers}'[show file, program and sections headers]' + '(-s --syms --symbols)'{-s,--syms,--symbols}'[show symbol table]' '(-u --unwind)'{-u,--unwind}'[show unwind info (if present)]' '(-D --use-dynamic)'{-D,--use-dynamic}'[use dynamic section info when showing symbols]' ) @@ -52,6 +53,8 @@ case $variant in '(-e --exception)'{-e,--exception}'[show sections for exception handling]' '(-N --numeric-addresses)'{-N,--numeric-addresses}"[don't find symbol names for addresses in DWARF data]" '(-z --decompress)'{-z,--decompress}'[show compression information; decompress before dumping data]' + '(--symbols)-s[show symbol table]' + '(-s)--symbols=-[show symbol table]::section:(.dynsym .symtab)' ) ;; esac diff --git a/Completion/Unix/Command/_sed b/Completion/Unix/Command/_sed index 259477f93..222798b8a 100644 --- a/Completion/Unix/Command/_sed +++ b/Completion/Unix/Command/_sed @@ -23,8 +23,9 @@ elif _pick_variant gnu=GNU unix --version; then '(-i --in-place)'{-i-,--in-place=-}$inplace '(-l --line-length)'{-l,--line-length=-}'[specify line-wrap length for the l command]' '(-r)--posix[disable GNU extensions]' - '(-r --regexp-extended)'{-r,--regexp-extended}$extended + '(-E -r --regexp-extended)'{-E,-r,--regexp-extended}$extended '(-s --separate)'{-s,--separate}'[consider files separately instead of as a combined stream]' + '--sandbox[block commands that can affect the system (r/w/W/e)]' '(-u --unbuffered)'{-u,--unbuffered}'[disable data buffering]' '(-z --null-data)'{-z,--null-data}'[separate lines by NUL characters]' '(- 1 :)--help[print program usage]' diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip index 726d87c2b..f244b0ace 100644 --- a/Completion/Unix/Command/_strip +++ b/Completion/Unix/Command/_strip @@ -16,11 +16,12 @@ if _pick_variant gnu=GNU solaris --version; then fi args=( '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames' - '--help[display usage information and exit]' - '--info[display list of architectures and object formats]' + '(-)--help[display usage information]' + '(-)--info[display list of architectures and object formats]' '(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames' '(-O --output-target)'{-I+,--output-target=}'[object code format of output]:bfd name:->bfdnames' '*'{-R+,--remove-section=}'[remove given sections]:section name' + '--remove-relocations=[remove relocations from specified section]:section' '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]' '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]' '--strip-unneeded[remove symbols not needed for relocation processing]' @@ -33,7 +34,7 @@ if _pick_variant gnu=GNU solaris --version; then '(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]' '--keep-file-symbols[retain symbols specifying source file names]' '--only-keep-debug[remove everything except debugging information]' - '(-V --version)'{-V,--version}'[display version information and exit]' + '(-)'{-V,--version}'[display version information and exit]' '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]') else args=( |