Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: nm completion



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@xxxxxxx>            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



Messages sorted by: Reverse Date, Date, Thread, Author