zsh-workers
 help / color / mirror / code / Atom feed
* issue with completion of "module" command when using lmod
@ 2021-07-08 17:47 Max Voit
  2021-07-09  0:03 ` Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Max Voit @ 2021-07-08 17:47 UTC (permalink / raw)
  To: zsh-workers

Dear zsh-workers,

when using lmod for "module", Modulefiles have a ".lua" extension. With
the current completion as defined in "_module", this file extension is not
cut off and thus erroneously appears when one tries to load a module:

  module load compiler/GCC/10<TAB>
results in
  module load compiler/GCC/10.2.0.lua
instead of
  module load compiler/GCC/10.2.0

(and "module load compiler/GCC/10.2.0.lua" fails in
  Lmod has detected the following error:  The following module(s) are
  unknown: "compiler/GCC/10.2.0.lua")

The patch below fixes this issue by cutting of the lua-extension.

Best regards,
Max

--- snip ---

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


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

* Re: issue with completion of "module" command when using lmod
  2021-07-08 17:47 issue with completion of "module" command when using lmod Max Voit
@ 2021-07-09  0:03 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2021-07-09  0:03 UTC (permalink / raw)
  To: Max Voit, zsh-workers

Applied by Oliver, thanks :-)

Max Voit wrote on Thu, 08 Jul 2021 17:47 +00:00:
> Dear zsh-workers,
> 
> when using lmod for "module", Modulefiles have a ".lua" extension. With
> the current completion as defined in "_module", this file extension is not
> cut off and thus erroneously appears when one tries to load a module:


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

end of thread, other threads:[~2021-07-09  0:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 17:47 issue with completion of "module" command when using lmod Max Voit
2021-07-09  0:03 ` Daniel Shahaf

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