1#compdef strip
2
3local curcontext=$curcontext state line ret=0
4declare -A opt_args
5declare -a args
6
7if _pick_variant gnu=GNU solaris --version; then
8  if [[ -prefix @* ]]; then
9    compset -P '@'
10
11    local expl
12
13    _description files expl 'command-line-options file'
14    _files $expl && ret=0
15    return $ret
16  fi
17  args=(
18    '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames'
19    '--help[display usage information and exit]'
20    '--info[display list of architectures and object formats]'
21    '(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames'
22    '(-O --output-target)'{-I+,--output-target=}'[object code format of output]:bfd name:->bfdnames'
23    '*'{-R+,--remove-section=}'[remove given sections]:section name'
24    '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]'
25    '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]'
26    '--strip-unneeded[remove symbols not needed for relocation processing]'
27    '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
28    '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
29    '(*)-o+[output file]:output file:_files'
30    '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
31    '(-w --wildcard)'{-w,--wildcard}'[permit wilcards in symbol names]'
32    '(-x --discard-all)'{-x,--discard-all}'[remove non-global symbols]'
33    '(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]'
34    '--keep-file-symbols[retain symbols specifying source file names]'
35    '--only-keep-debug[remove everything except debugging information]'
36    '(-V --version)'{-V,--version}'[display version information and exit]'
37    '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]')
38else
39  args=(
40    '-l[strip line information only]'
41    '-V[display version information on stderr and exit]'
42    '-x[do not strip the symbol table]')
43fi
44
45_arguments \
46  $args \
47  '1:executable:_files -g "*(-*)"' \
48  '*::executable:_files -g "*(-*)"' && ret=0
49
50case $state in
51  (bfdnames)
52    local expl
53    declare -a bfdnames
54
55    bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help 2>/dev/null)"}:#strip: supported targets: *}#strip: supported targets: })
56    _describe -t bfdnames 'bfd name' bfdnames && ret=0
57    ;;
58esac
59
60return $ret
61