zsh-workers
 help / color / mirror / code / Atom feed
From: Max Voit <max.voit+mlzs@with-eyes.net>
To: zsh-workers@zsh.org
Subject: issue with completion of "module" command when using lmod
Date: Thu, 8 Jul 2021 19:47:41 +0200	[thread overview]
Message-ID: <20210708194741.47caae8b@choowai> (raw)

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
 }


             reply	other threads:[~2021-07-08 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-08 17:47 Max Voit [this message]
2021-07-09  0:03 ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210708194741.47caae8b@choowai \
    --to=max.voit+mlzs@with-eyes.net \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).