zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: nm completion
@ 2011-11-23 17:45 Peter Stephenson
  0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 2011-11-23 17:45 UTC (permalink / raw)
  To: Zsh Hackers' List

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-23 18:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-23 17:45 PATCH: nm completion Peter Stephenson

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).