Skip to content

Add --ignore option to sh-to-mod sub-command - #746

Merged
xdelaruelle merged 2 commits into
envmodules:mainfrom
xdelaruelle:issue532
Nov 20, 2026
Merged

xdelaruelle merged 2 commits into
envmodules:mainfrom
xdelaruelle:issue532

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

Add the --ignore option to the sh-to-mod sub-command to withdraw some kinds of environment change made by the evaluated shell script, like the --ignore option of the source-sh modulefile command does. Both now share the same argument parsing and accept the same shell elements (envvar, alias, function, chdir, complete and umask).

  • When set before the sub-command name, --ignore and its value are moved right after this name. When set after the shell argument, they are left in place as they are then arguments for the script.
  • --ignore raises an Unsupported option error on the other sub-commands.
  • Usage message, shell completion scripts, man page, changes document and design note are updated accordingly.

A second commit fixes the ml command when a command line switch is set before the sub-command name. ml withdrew its first argument instead of the argument recognized as the sub-command name, so with ml --tag=foo load bar the switch was lost and the sub-command name was passed as an argument to itself.

Fixes #532

Comment thread init/bash_completion.in Fixed
Comment thread init/bash_completion.in Fixed
Let sh-to-mod withdraw some kinds of environment change made by the
evaluated shell script, like the --ignore option of the source-sh
modulefile command does. Both now share the same argument parsing.

When set before the sub-command name, the option and its value are
moved right after this name. When set after the shell argument, they
are left in place as they are then arguments for the script.

Fixes envmodules#532

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
ml filters out the command line switches to find the sub-command name
among its arguments, but then withdrew the first argument instead of
this name to build the sub-command argument list. With a switch set
before the name, like in "ml --tag=foo load bar", the switch was lost
and the sub-command name was passed as an argument to itself.

Withdraw the argument that has been recognized as the sub-command name
wherever it stands.

Assisted-by: Claude:claude-fable-5-2
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit 0f3becf into envmodules:main Nov 20, 2026
30 of 31 checks passed
@xdelaruelle
xdelaruelle deleted the issue532 branch November 20, 2026 16:33
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 --ignore option to sh-to-mod sub-command

2 participants