Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] modprobe: Complete loaded modules if nothing was found
- X-seq: zsh-workers 26437
 
- From: JÃrg Sommer <joerg@xxxxxxxxxxxx>
 
- To: zsh-workers@xxxxxxxxxx
 
- Subject: [PATCH] modprobe: Complete loaded modules if nothing was found
 
- Date: Sun, 25 Jan 2009 21:45:06 +0100
 
- Cc: JÃrg Sommer <joerg@xxxxxxxxxxxx>
 
- Dkim-signature: v=1; a=rsa-sha256; c=simple/simple; d=gnuu.de; s=banki;	t=1232923133; i=@xxxxxxxxxxxx; bh=fceYJpp3zxLiwBTsql57MlUhicgQSrj9K	vU+FwsyhNw=; h=From:To:Cc:Subject:Date:Message-Id; b=tV/i2RDa/GEeL8	R4C3so7d25fbVHRYVDxKWjdHNmZNurJ7YyaC9DytdyNyet4B5sR0SmvJcwiO1i4fL1Y	taO6r5KLFA24sFb8jquT+sBoX1vyLNWz0KZZIpQc+QqwytuZFj0nMY2ZYaIp1ePGAx+	OUXlW8DqmscW70kNptZ0RQw=
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
 
In some cases it is useful when Zsh does complete the module names while
they aren't loadable. A module can't be loaded twice, so Zsh doesn't
suggest modules they are already loaded. But for commands like this it is
helpful:
% rmmod snd_seq_device; modprobe snd_seq_device
---
 Completion/Linux/Command/_modutils |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/Completion/Linux/Command/_modutils b/Completion/Linux/Command/_modutils
index eefb11f..40399ab 100644
--- a/Completion/Linux/Command/_modutils
+++ b/Completion/Linux/Command/_modutils
@@ -87,7 +87,14 @@ case "$state" in
     _tags files modules
     while _tags; do
       _requested files expl "module file"  _files -g '*.ko' && ret=0
-      _requested modules expl module compadd -a modules && ret=0
+      if _requested modules expl module; then
+          if compadd -a modules; then
+              ret=0
+          else
+              [[ $state = loadable_modules ]] && \
+                compadd -a loaded_modules && ret=0
+          fi
+      fi
     done
   ;;
 
-- 
1.6.0.6
Messages sorted by:
Reverse Date,
Date,
Thread,
Author