#compdef stdbuf autoload -U is-at-least _stdbuf() { 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[@]}" : \ '-i+[adjust standard input stream buffering]:MODE:_default' \ '--input=[adjust standard input stream buffering]:MODE:_default' \ '-o+[adjust standard output stream buffering]:MODE:_default' \ '--output=[adjust standard output stream buffering]:MODE:_default' \ '-e+[adjust standard error stream buffering]:MODE:_default' \ '--error=[adjust standard error stream buffering]:MODE:_default' \ '-h[Print help]' \ '--help[Print help]' \ '-V[Print version]' \ '--version[Print version]' \ ':command:_command_names -e' \ && ret=0 } (( $+functions[_stdbuf_commands] )) || _stdbuf_commands() { local commands; commands=() _describe -t commands 'stdbuf commands' commands "$@" } if [ "$funcstack[1]" = "_stdbuf" ]; then _stdbuf "$@" else compdef _stdbuf stdbuf fi