summaryrefslogtreecommitdiff
path: root/Completion/Unix/Command/_strip
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Unix/Command/_strip')
-rw-r--r--Completion/Unix/Command/_strip102
1 files changed, 58 insertions, 44 deletions
diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index 3e1a6b698..cc67ae49a 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -1,55 +1,68 @@
#compdef strip
-local curcontext=$curcontext state line ret=1
+local curcontext=$curcontext state line variant ret=1
declare -A opt_args
declare -a args
-if _pick_variant gnu=GNU solaris --version; then
- if [[ -prefix @* ]]; then
- compset -P '@'
+if _pick_variant -r variant gnu=GNU elftoolchain=elftoolchain $OSTYPE --version; then
+ case $variant in
+ gnu|elftoolchain)
+ args=(
+ '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]'
+ '(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames'
+ '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
+ '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
+ '(-O --output-target)'{-O+,--output-target=}'[object code format of output]:bfd name:->bfdnames'
+ '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
+ '*'{-R+,--remove-section=}'[remove given sections]:section name'
+ '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]'
+ '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]'
+ '(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]'
+ '(-x --discard-all)'{-x,--discard-all}'[remove non-global symbols]'
+ '--only-keep-debug[remove everything except debugging information]'
+ '--strip-unneeded[remove symbols not needed for relocation processing]'
+ '(- 1 *)'{-V,--version}'[display version information and exit]'
+ )
+ ;|
+ gnu)
+ if [[ -prefix @* ]]; then
+ compset -P '@'
- local expl
+ local expl
- _description files expl 'command-line-options file'
- _files "$expl[@]"
- return
- fi
- args=(
- '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames'
- '(-)--help[display usage information]'
- '(-)--info[display list of architectures and object formats]'
- '(-I --input-target)'{-I+,--input-target=}'[object code format of input]:bfd name:->bfdnames'
- '(-O --output-target)'{-O+,--output-target=}'[object code format of output]:bfd name:->bfdnames'
- '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-U,--disable-deterministic-archives}'[disable -D behavior]'
- '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-D,--enable-deterministic-archives}'[produce deterministic output when stripping archives (zero file metadata)]'
- '*'{-R+,--remove-section=}'[remove given sections]:section name'
- '--remove-relocations=[remove relocations from specified section]:section'
- '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]'
- '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]'
- '--strip-dwo[remove all DWARF .dwo sections]'
- '--strip-unneeded[remove symbols not needed for relocation processing]'
- '!(--no-merge-notes)'{-M,--merge-notes}
- "--no-merge-notes[don't attempt to remove redundant notes]"
- '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
- '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
- "*--keep-section=[don't strip given section]:section"
- '(*)-o+[output file]:output file:_files'
- '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
- '(-w --wildcard)'{-w,--wildcard}'[permit wildcards in symbol names]'
- '(-x --discard-all)'{-x,--discard-all}'[remove non-global symbols]'
- '(-X --discard-locals)'{-X,--discard-locals}'[remove compiler-generated local symbols]'
- '--keep-file-symbols[retain symbols specifying source file names]'
- '--only-keep-debug[remove everything except debugging information]'
- '(-)'{-V,--version}'[display version information and exit]'
- '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]')
-else
- case $OSTYPE in
+ _description files expl 'command-line-options file'
+ _files "$expl[@]"
+ return
+ fi
+ args+=(
+ '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames'
+ '(-)--help[display usage information]'
+ '(-)--info[display list of architectures and object formats]'
+ '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-U,--disable-deterministic-archives}'[disable -D behavior]'
+ '(-D --enable-deterministic-archives -U --disable-deterministic-archives)'{-D,--enable-deterministic-archives}'[produce deterministic output when stripping archives (zero file metadata)]'
+ '--remove-relocations=[remove relocations from specified section]:section'
+ '--strip-dwo[remove all DWARF .dwo sections]'
+ '!(--no-merge-notes)'{-M,--merge-notes}
+ "--no-merge-notes[don't attempt to remove redundant notes]"
+ "*--keep-section=[don't strip given section]:section"
+ '(*)-o+[output file]:output file:_files'
+ '--keep-section-symbols[retain section symbols]'
+ '--keep-file-symbols[retain symbols specifying source file names]'
+ '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]')
+ ;;
+ elftoolchain)
+ args+=(
+ '(- 1 *)'{-h,--help}'[display usage information]'
+ '(*)'{-o+,--output-file=}'[specify output file]:output file:_files'
+ )
+ ;;
solaris*)
args=(
'-l[strip line information only]'
'-V[display version information on stderr and exit]'
- '-x[do not strip the symbol table]')
- ;;
+ '-x[do not strip the symbol table]'
+ )
+ ;;
darwin*)
local -a arch
arch=( ${(z)${${"$(_call_program architectures
@@ -73,12 +86,13 @@ else
'-no_uuid[remove only LC_UUID load command]'
'-no_split_info[remove LC_SEGMENT_SPLIT_INFO load command]'
'-no_code_signature_warning[not warn when code signature would be invalid in the output]'
- '-arch[specify the architecture]:architecture:( $arch )' )
- ;;
+ '-arch[specify the architecture]:architecture:( $arch )'
+ )
+ ;;
esac
fi
-_arguments \
+_arguments -C \
$args \
'1:executable:_files -g "*(-*)"' \
'*::executable:_files -g "*(-*)"' && ret=0