Repository navigation
Add module-info modulename and moduleversion modulefile commands - #725
Merged
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
module-info namereturns the full name of the evaluating modulefile, likeapp/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-infosub-commands:module-info moduleversionreturns the part of the module name after its last/character (1.2.3forapp/1.2.3,12.1forcompiler/gcc/12.1). An empty string is returned if the name holds no/.module-info modulenamereturns 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 namedoes. 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.5directory.Fixes #713