#compdef cat gcat local ign local -a args if _pick_variant gnu='(GNU|uutils)' unix --version; then (( $#words > 2 )) && ign='!(- : *)' args=( '(-A --show-all)'{-A,--show-all}'[equivalent to -vET]' '(-b --number-nonblank -n --number)'{-b,--number-nonblank}'[number nonempty output lines, overrides -n]' '-e[equivalent to -vE]' '(-E --show-ends)'{-E,--show-ends}'[display $ or ^M$ at end of each line]' '(-n --number)'{-n,--number}'[number all output lines]' '(-s --squeeze-blank)'{-s,--squeeze-blank}'[suppress repeated empty output lines]' '-t[equivalent to -vT]' '(-T --show-tabs)'{-T,--show-tabs}'[display TAB characters as ^I]' '-u[ignored]' '(-v --show-nonprinting)'{-v,--show-nonprinting}'[use ^ and M- notation, except for LFD and TAB]' "$ign--help[display help and exit]" "$ign--version[display version information]" '*: :_files' ) else # POSIX requires just '-u' args=( -A "-?*" '(-n)-b[number non-blank output lines]' '(-v)-e[display $ at the end of each line (implies -v)]' '-v[display non-printing chars as ^X or M-a]' '-n[number all output lines]' "-u[don't buffer output]" '*: :_files' ) case $OSTYPE in (*bsd|dragonfly|darwin)*) args+=( '-s[squeeze multiple blank lines into one]' '(-v)-t[display tab as ^I (implies -v)]' ) ;| (free|net)bsd*) args+=( '-l[set a lock on the stdout file descriptor]' ) ;| aix*|solaris*) args+=( '(-q)-s[be silent about non-existent files]' '-t[display tab as ^I and formfeeds and ^L (requires -v)]' ) ;| aix*) args+=( '(-s)-q[be silent about non-existent files]' '(-r -S)'{-r,-S}'[condense consecutive blank lines to one line]' '-Z[dump encrypted files in encrypted format]' ) ;; netbsd*) args+=( '-B+[read with buffer of specified size]:size (bytes)' '-f[only attempt to display regular files]' ) ;; darwin*) args+=( '-l[set an exclusive advisory lock on standard output]' ) ;; esac fi _arguments -s -S $args