zsh-workers
 help / color / mirror / code / Atom feed
From: "Nikolai Weibull" <now@bitwi.se>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: [PATCH] Completion/Unix/_strip
Date: Thu, 1 Nov 2007 09:52:18 +0100	[thread overview]
Message-ID: <dbfc82860711010152g2bdb754dv54f8d88118daafb@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 199 bytes --]

This patch expands strip's completion with arguments suited for Solaris and GNU.

Clint: do you have any suggestions on how to submit patches like this
one, based on the Git repository, to the list?

[-- Attachment #2: _strip.patch --]
[-- Type: application/octet-stream, Size: 2699 bytes --]

diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index d7d8aab..06f7243 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -1,6 +1,60 @@
 #compdef strip
 
-local expl
+local curcontext=$curcontext state line ret=0
+declare -A opt_args
+declare -a args
 
-_description files expl executable
-_files "$expl[@]" -g '*(-*)'
+if _pick_variant gnu=GNU solaris --version; then
+  if [[ -prefix @* ]]; then
+    compset -P '@'
+
+    local expl
+
+    _description files expl 'command-line-options file'
+    _files $expl && ret=0
+    return $ret
+  fi
+  args=(
+    '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames'
+    '--help[display usage information and exit]'
+    '--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)'{-I+,--output-target=}'[object code format of output]:bfd name:->bfdnames'
+    '*'{-R+,--remove-section=}'[remove given sections]:section name'
+    '(-s --strip-all)'{-s,--strip-all}'[remove all symbols]'
+    '(-g -S -d --strip-debug)'{-g,-S,-d,--strip-debug}'[remove debugging symbols]'
+    '--strip-unneeded[remove symbols not needed for relocation processing]'
+    '*'{-K+,--keep-symbol=}'[keep given symbol]:symbol name'
+    '*'{-N+,--strip-symbol=}'[strip given symbol]:symbol name'
+    '(*)-o+[output file]:output file:_files'
+    '(-p --preserve-dates)'{-p,--preserve-dates}'[preserve access and modification dates]'
+    '(-w --wildcard)'{-w,--wildcard}'[permit wilcards 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)'{-V,--version}'[display version information and exit]'
+    '(-v --verbose)'{-v,--verbose}'[list all object files modified or members of archives]')
+else
+  args=(
+    '-l[strip line information only]'
+    '-V[display version information on stderr and exit]'
+    '-x[do not strip the symbol table]')
+fi
+
+_arguments \
+  $args \
+  '1:executable:_files -g "*(-*)"' \
+  '*::executable:_files -g "*(-*)"' && ret=0
+
+case $state in
+  (bfdnames)
+    local expl
+    declare -a bfdnames
+
+    bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help 2>/dev/null)"}:#strip: supported targets: *}#strip: supported targets: })
+    _describe -t bfdnames 'bfd name' bfdnames && ret=0
+    ;;
+esac
+
+return $ret

             reply	other threads:[~2007-11-01  8:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-01  8:52 Nikolai Weibull [this message]
2007-11-05 22:21 ` Nikolai Weibull
2007-11-11  2:56 ` Clint Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dbfc82860711010152g2bdb754dv54f8d88118daafb@mail.gmail.com \
    --to=now@bitwi.se \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).