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

Minor tweak for _module completion



Hi,

the attached patch hides backup files (ending with ~, often created unknowingly with emacs by many users) while completing for "module".

(I presume it was ok to use "grep -E" instead of two grep commands, ie, "grep -E" should be supported where zsh can be used? If not, please feel free to modify if needed.)

Thanks!




      
--- zsh/Completion/Unix/Command/_module.orig
+++ zsh/Completion/Unix/Command/_module
@@ -85,7 +85,7 @@
 {
   if [[ -n $MODULEPATH ]] && [[ ${+_available_modules} -eq 0 ]]
   then
-    _available_modules=($(find ${(e)=MODULEPATH//:/ } -xtype f -print 2>/dev/null | grep -v \.version | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g'))
+    _available_modules=($(find ${(e)=MODULEPATH//:/ } -xtype f -print 2>/dev/null | grep -E -v '(\.version|\~$)' | sed -e 's,\('${${(e)=MODULEPATH//:/\/\\\|}%\\\|}'\),,g' -e 's,^/*,,g'))
   fi
 }
 


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