1#compdef sort 2 3local ordering='(-d --dictionary-order -g --general-numeric-sort -M --month-sort -h --human-numeric-sort -n --numeric-sort --sort -V --version-sort --help --version)' 4 5_arguments -s -S \ 6 '(-b --ignore-leading-blanks)'{-b,--ignore-leading-blanks}'[ignore leading blanks]' \ 7 "$ordering"{-d,--dictionary-order}'[consider only blanks and alphanumeric characters]' \ 8 '(-f --ignore-case)'{-f,--ignore-case}'[fold lower case to upper case characters]' \ 9 "$ordering"{-g,--general-numeric-sort}'[compare according to general numeric value]' \ 10 '(-i --ignore-nonprinting)'{-i,--ignore-nonprinting}'[consider only printable characters]' \ 11 "$ordering"{-M,--month-sort}"[compare (unknown) < 'JAN' < ... < 'DEC']" \ 12 "$ordering"{-h,--human-numeric-sort}'[compare human readable numbers (e.g., 2K 1G)]' \ 13 "$ordering"{-n,--numeric-sort}'[compare according to string numerical value]' \ 14 "$ordering"{-R,--random-sort}'[sort by random hash of keys]' \ 15 '--random-source=[get random bytes from file]:file:_files' \ 16 '(-r --reverse)'{-r,--reverse}'[reverse the result of comparisons]' \ 17 "$ordering--sort=[sort according to ordering]:ordering:(general-numeric human-numeric month numeric random version)" \ 18 "$ordering"{-V,--version-sort}'[sort version numbers]' \ 19 '--batch-size=[maximum inputs to merge]:number' \ 20 '(-c --check -C)'{-c,-C}'[check whether input is sorted; do not sort]' \ 21 '(-c --check -C)--check=-[check whether input is sorted; do not sort]::bad line handling:(diagnose-first silent quiet)' \ 22 '--compress-program=[specify program to compress temporary files with]:program:(gzip bzip2 lzop xz)' \ 23 '--debug[annotate the of the line used to sort]' \ 24 '--files0-from=[read input files from file]:file:_files' \ 25 '(-k --key)'{-k+,--key=}'[start a key at POS1, end it as POS2 (origin 1)]:key' \ 26 '(-m --merge)'{-m,--merge}'[merge already sorted files; do not sort]' \ 27 '(-o --output)'{-o+,--output=}'[write result to file instead of standard output]:output file:_files' \ 28 '(-s --stable)'{-s,--stable}'[preserve original order of lines with the same key]' \ 29 '(-S --buffer-size)'{-S+,--buffer-size=}'[specify size for main memory buffer]:size' \ 30 '(-t --field-separator)'{-t+,--field-separator=}'[specify field separator instead of non-blank to blank transition]:separator' \ 31 \*{-T+,--temporary-directory=}'[specify directory for temporary files]:directory:_directories' \ 32 '(-u --unique)'{-u,--unique}'[with -c, check for strict ordering; without -c, output only the first of an equal run]' \ 33 '--parallel=[set number of sorts run concurrently]:number' \ 34 '(-z --zero-terminated)'{-z,--zero-terminated}'[end lines with 0 byte, not newline]' \ 35 '(- *)--help[display help and exit]' \ 36 '(- *)--version[output version information and exit]' \ 37 '*:file:_files' 38