#compdef split autoload -U is-at-least _split() { typeset -A opt_args typeset -a _arguments_options local ret=1 if is-at-least 5.2; then _arguments_options=(-s -S -C) else _arguments_options=(-s -C) fi local context curcontext="$curcontext" state line _arguments "${_arguments_options[@]}" : \ '-b+[put SIZE bytes per output file]:SIZE:_default' \ '--bytes=[put SIZE bytes per output file]:SIZE:_default' \ '-C+[put at most SIZE bytes of lines per output file]:SIZE:_default' \ '--line-bytes=[put at most SIZE bytes of lines per output file]:SIZE:_default' \ '-l+[put NUMBER lines/records per output file]:NUMBER:_default' \ '--lines=[put NUMBER lines/records per output file]:NUMBER:_default' \ '-n+[generate CHUNKS output files; see explanation below]:CHUNKS:_default' \ '--number=[generate CHUNKS output files; see explanation below]:CHUNKS:_default' \ '--additional-suffix=[additional SUFFIX to append to output file names]:SUFFIX:_default' \ '--filter=[write to shell COMMAND; file name is \$FILE (Currently not implemented for Windows)]:COMMAND:_command_names -e' \ '--numeric-suffixes=[same as -d, but allow setting the start value]::FROM:_default' \ '--hex-suffixes=[same as -x, but allow setting the start value]::FROM:_default' \ '-a+[generate suffixes of length N (default 2)]:N:_default' \ '--suffix-length=[generate suffixes of length N (default 2)]:N:_default' \ '*-t+[use SEP instead of newline as the record separator; '\''\\\\0'\'' (zero) specifies the NUL character]:SEP:_default' \ '*--separator=[use SEP instead of newline as the record separator; '\''\\\\0'\'' (zero) specifies the NUL character]:SEP:_default' \ '--io-blksize=[]: :_default' \ '-e[do not generate empty output files with '\''-n'\'']' \ '--elide-empty-files[do not generate empty output files with '\''-n'\'']' \ '-d[use numeric suffixes starting at 0, not alphabetic]' \ '-x[use hex suffixes starting at 0, not alphabetic]' \ '--verbose[print a diagnostic just before each output file is opened]' \ '-h[Print help]' \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ '::input:_files' \ '::prefix:_default' \ && ret=0 } (( $+functions[_split_commands] )) || _split_commands() { local commands; commands=() _describe -t commands 'split commands' commands "$@" } if [ "$funcstack[1]" = "_split" ]; then _split "$@" else compdef _split split fi