summary refs log tree commit diff
path: root/Completion/Unix/Command/_tee
blob: 66ef66e19fc844f2d4bbc0cb24b42a2b4e999e48 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#compdef tee gtee

local ret=1
local -a context line state state_descr args
local -A opt_args

args=(
  '(: -)--help[display help information]'
  '(: -)--version[display version information]'
  '(-a --append)'{-a,--append}'[append to files instead of overwriting]'
  '(-i --ignore-interrupts)'{-i,--ignore-interrupts}'[ignore interrupt signals]'
  '(--output-error)-p[warn on errors writing to non-pipes]'
  '(-p)--output-error=[specify write-error behavior]: :->errmodes'
)

# Filter out non-GNU options if applicable
_pick_variant gnu='Free Soft' unix --version ||
args=( ${(@M)args:#(|*\))-[ai]\[*} )

_arguments -s -S : $args '*: :_files' && ret=0

[[ $state == errmodes ]] && {
  args=(
    'exit[exit on errors writing to any output]'
    'exit-nopipe[exit on errors writing to non-pipes]'
    'warn[warn on errors writing to any output]'
    'warn-nopipe[warn on errors writing to non-pipes]'
  )
  _values 'error mode' $args && ret=0
}

return ret