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

Re: Seg fault with zmodload -u



Oliver wrote:
> On the subject of zmodload completion, how would I prevent the 'module
> alias' description from being displayed when there are no module
> aliases - do I have to put the zmodload -A output in an array first and
> then not call the _requested line if the array is empty - or is there a
> better way?

This is easy, anyway. (Remind me to commit this later.)

Index: Completion/Builtins/_zmodload
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Builtins/_zmodload,v
retrieving revision 1.4
diff -u -r1.4 _zmodload
--- Completion/Builtins/_zmodload	2000/08/14 15:46:17	1.4
+++ Completion/Builtins/_zmodload	2000/08/15 15:52:12
@@ -11,8 +11,11 @@
   while _tags; do
     _requested files expl 'module file' \
       _files -W module_path -/g '*.(dll|s[ol])(:r)' && ret=0
-    _requested aliases expl 'module alias' \
-      compadd -- ${${(f)"$(zmodload -A)"}%% *} && ret=0
+    if _requested aliases expl 'module alias'; then
+      local array
+      array=(${${(f)"$(zmodload -A)"}%% *})
+      (( $#array )) && compadd "${expl[@]}" -- $array && ret=0
+    fi
     (( ret )) || break
   done
 fi

-- 
Peter Stephenson <pws@xxxxxxx>
Cambridge Silicon Radio, Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070



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