Skip to content

Add module-info modulename and moduleversion modulefile commands - #725

Merged
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:issue713
Oct 28, 2026
Merged

xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:issue713

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

module-info name returns the full name of the evaluating modulefile, like app/1.2.3, whereas modulefile authors frequently need only its version part, to build an installation path for instance. Getting it required Tcl string manipulation like [file tail [module-info name]], an idiom that newcomers find hard to read and that gets copied around with small variations.

This change adds two module-info sub-commands:

  • module-info moduleversion returns the part of the module name after its last / character (1.2.3 for app/1.2.3, 12.1 for compiler/gcc/12.1). An empty string is returned if the name holds no /.
  • module-info modulename returns the part before this last / character (app, compiler/gcc). The whole name is returned if it holds no /.

Both work on the name resolved for the evaluation, so symbolic versions, aliases and full path modulefiles are handled like module-info name does. Variants are not part of the result.

The man page, the user guide, the Lmod comparison tables, the changes table, the release notes, the Nagelfar syntax databases and a cookbook note are updated accordingly. Fixtures for the new test are placed in a new testsuite/modulefiles.5 directory.

Fixes #713

module-info name returns the full name of the evaluating modulefile,
like app/1.2.3, whereas modulefile authors frequently need only its
version part, to build an installation path for instance. Getting it
required Tcl string manipulation like [file tail [module-info name]],
an idiom that newcomers find hard to read and that gets copied around
with small variations.

module-info moduleversion returns the part of the module name after
its last / character and module-info modulename the part before it.
Both work on the name resolved for the evaluation, so symbolic versions
and aliases are handled like module-info name does. A name holding no
/ character gives an empty version and is returned whole as name part.

Fixes envmodules#713

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit b5b1c40 into envmodules:main Oct 28, 2026
22 checks passed
@xdelaruelle
xdelaruelle deleted the issue713 branch October 28, 2026 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a module-info sub-command returning the version of the evaluating modulefile

1 participant