zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] modprobe: Complete loaded modules if nothing was found
@ 2009-01-11 23:44 Jörg Sommer
  0 siblings, 0 replies; 3+ messages in thread
From: Jörg Sommer @ 2009-01-11 23:44 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

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


^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] modprobe: Complete loaded modules if nothing was found
@ 2009-01-25 20:45 Jörg Sommer
  2009-01-26  3:29 ` Andrey Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Jörg Sommer @ 2009-01-25 20:45 UTC (permalink / raw)
  To: zsh-workers; +Cc: Jörg Sommer

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-01-26  3:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-11 23:44 [PATCH] modprobe: Complete loaded modules if nothing was found Jörg Sommer
2009-01-25 20:45 Jörg Sommer
2009-01-26  3:29 ` Andrey Borzenkov

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