zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <Peter.Stephenson@csr.com>
To: "Zsh Hackers' List" <zsh-workers@zsh.org>
Subject: PATCH: nm completion
Date: Wed, 23 Nov 2011 17:45:19 +0000	[thread overview]
Message-ID: <20111123174519.04b2dabc@pwslap01u.europe.root.pri> (raw)

Not sure why this wasn't done ages ago, and I keep tripping over the
non-completion of .o files in my configuration, and have done for many,
many years.

This is just a stub, but if you're using GNU nm it gets you a pretty
long way.

Index: Completion/Unix/Command/.distfiles
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/.distfiles,v
retrieving revision 1.122
diff -p -u -r1.122 .distfiles
--- Completion/Unix/Command/.distfiles	20 Aug 2011 07:44:41 -0000	1.122
+++ Completion/Unix/Command/.distfiles	23 Nov 2011 17:40:47 -0000
@@ -141,6 +141,7 @@ _mysqldiff
 _ncftp
 _netcat
 _nice
+_nm
 _nmap
 _notmuch
 _npm
Index: Completion/Unix/Command/_nm
===================================================================
RCS file: Completion/Unix/Command/_nm
diff -N Completion/Unix/Command/_nm
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Unix/Command/_nm	23 Nov 2011 17:40:47 -0000
@@ -0,0 +1,29 @@
+#compdef nm
+
+# This is a stub.  It's main reason for existence is to offer
+# object files with nm.  Feel free to extend it.  If you do, remove
+# this comment.
+
+local state context line expl
+local -A opt_args
+local -a args
+integer ret=1
+
+if _pick_variant gnu='Free Soft' unix --version; then
+  args+=(-s --)
+fi
+args+=('*:file:->file')
+
+_arguments "$args[@]" && ret=0
+
+case $state in
+  (file)
+  _alternative \
+    "object-files:object file:_path_files -g '*.o'" \
+    "executable-files:executable file:_path_files -g '*(*)'" \
+    "dynamic-libraries:dynamic library:_path_files -g '*.so'" \
+    "static-libraries:static library:_path_files -g '*.a'" && ret=0
+  ;;
+esac
+
+return ret

-- 
Peter Stephenson <pws@csr.com>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog


                 reply	other threads:[~2011-11-23 18:20 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20111123174519.04b2dabc@pwslap01u.europe.root.pri \
    --to=peter.stephenson@csr.com \
    --cc=zsh-workers@zsh.org \
    /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).