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

Re: functions/Completion/Linux/_modutils



On Wed, 14 May 2008 18:16:37 +0400
sergio <zsh@xxxxxxxxxxxxx> wrote:
> Bart Schaefer wrote:
> > On May 13,  8:19pm, sergio wrote:
> > }
> > } When i'm not root  modprobe is not in my path, so
> > } in case "all_modules)" "modules" will be empty:
> > 
> > When completing for what?  An example command line would be helpful.
>
> sudo modprobe <TAB> should list all available modules (may be all not
> loaded modules) but it doesn't.

Shouldn't the fix be something like this?

By the way, isn't that "_files" completion three lines below screwy?
Shouldn't it be looking for .ko files (or possibly .o files depending on
the version)?

Index: Completion/Linux/Command/_modutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_modutils,v
retrieving revision 1.6
diff -u -r1.6 _modutils
--- Completion/Linux/Command/_modutils	12 Aug 2007 09:04:52 -0000	1.6
+++ Completion/Linux/Command/_modutils	14 May 2008 15:11:48 -0000
@@ -73,7 +73,7 @@
   ;;
 
   all_modules)
-    modules=( ${${${${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%%.*} )
+    modules=( ${${${${(f)"$(path=($path /sbin); _call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%%.*} )
     _tags files modules
     while _tags; do
       _requested files expl "module file"  _files && ret=0




-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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