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

[PATCH] _modutils update for kernel 2.6



Mandrake ships compressed modules for 2.6, currently they are completed to 
module.ko that modprobe does not like. Patch simply strips off everything 
after first dot (I do not think any module is using dot in names or vene if 
this is allowed).

Also it adds trivial insmod support for module-init-tools enough for 2.6 (I am 
testing kernel module and being lazy ... :) I set styles as

if [[ "$(modprobe -V 2> /dev/null)" == module-init-tools* ]]; then
        zstyle ':completion:*:*:insmod:*' file-patterns '*.ko:modules 
*(-/):directories' '*:all-files'
else
        zstyle ':completion:*:*:insmod:*' file-patterns '*.o:modules 
*(-/):directories' '*:all-files'
fi

may be it makes sense to put in _modutils as default.

regards

-andrey
Index: Completion/Linux/Command/_modutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_modutils,v
retrieving revision 1.4
diff -u -p -r1.4 _modutils
--- Completion/Linux/Command/_modutils	13 Feb 2004 18:42:25 -0000	1.4
+++ Completion/Linux/Command/_modutils	10 Dec 2004 10:52:38 -0000
@@ -1,4 +1,4 @@
-#compdef lsmod modinfo modprobe rmmod
+#compdef lsmod modinfo modprobe rmmod insmod
 
 local curcontext="$curcontext" expl state line modules ign args ret=1
 
@@ -51,6 +51,12 @@ case "$service" in
       '(-v --verbose)'{-v,--verbose}'[be verbose]' \
       '*:loaded module:->loaded_modules' && ret=0
   ;;
+
+  insmod)
+    _arguments \
+      '1:module file:_files' \
+      '*:module parameters:' && ret=0
+  ;;
 esac 
 
 case "$state" in
@@ -67,7 +73,7 @@ case "$state" in
   ;;
 
   all_modules)
-    modules=( ${${${${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%.*} )
+    modules=( ${${${${(f)"$(_call_program modules ${(M)words[1]##*/}modprobe -l 2>/dev/null)"}:#}##*/}%%.*} )
     _wanted modules expl module compadd -a modules && return
   ;;
 


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