Introduce stashshow sub-command to display stash collection file.
This sub-command cannot be called from a modulefile evaluation context.
Add sub-command empty skeleton: cmdModuleStashshow.
Sub-command accepts no option. It may take an optional argument: the
index of the stash collection to display or the name of the stash
collection. If no argument is provided, stash collection 0 is assumed.
Introduce stashrm sub-command to delete stash collection file.
This sub-command cannot be called from a modulefile evaluation context.
Add sub-command empty skeleton: cmdModuleStashrm.
Sub-command accepts no option. It may take an optional argument: the
index of the stash collection to delete or the name of the stash
collection. If no argument is provided, stash collection 0 is assumed.
Implement 'stashpop' sub-command. First parse stash argument to
determine corresponding stash collection name or raise an error if stash
value is invalid. Then restore stash collection. Afterward delete stash
collection.
Add no_other_target option to findCollections procedure to filter when
glob searching the result from other target. Especially useful when
collections for specific targets exist but no target is currently set in
user environment.
This no_other_target is disabled by default. savelist sub-command
currently returns other targets when no target is set. But the option
will be enabled for stashpop, to ensure that the popped collection is
from the current target or from the *no target* if none set.
Introduce stashpop sub-command to restore a stash collection then delete
it.
This sub-command cannot be called from a modulefile evaluation context.
Add sub-command empty skeleton: cmdModuleStashpop.
Sub-command accepts no option. It may take an optional argument: the
index of the stash collection to restore or the name of the stash
collection. If no argument is provided, stash collection 0 is assumed.
Implement stash sub-command. First check that a difference exists
between current environment and initial one. If so, save current
environment in a collection, then reset to initial environment.
Update findCollections procedure to add swap_by_init argument, disabled
by default. When enabled if specified collection is not found, change it
to __init__.
Helps to remove duplicate code from cmdModuleSaveshow and
cmdModuleRestore.
Update getDiffBetweenCurEnvAndColl to also return is_tags_diff
information. is_tags_diff indicates if loaded modules that matches
modules in collection have different tags set.
Update getDiffBetweenArray procedure to add unordered_lists_compared
argument (disabled by default). When enabled, array elements are
considered unordered list, so value comparison is adapted to check
differences between two lists.
Update getDiffBetweenArray procedure to add notset_equals_empty argument
(disabled by default). When enabled not-set element in array is
equivalent to element set to an empty value.
Create getDiffBetweenCurEnvAndColl procedure from code of
cmdModuleRestore to analyze a collection content and produce differences
compared to current environment.
Introduce stash sub-command to save current environment and restore
initial one.
This sub-command cannot be called from a modulefile evaluation context.
Add sub-command empty skeleton: cmdModuleStash.
Sub-command accepts no argument nor option.
Make 'mt lint' pass with remaining shellcheck reports on sh, bash and
ksh scripts. Waiting for another contribution to fix the remaining
warnings and notices.
Related: #470
Apply on auto-generated autoinit code for sh-kind shells the same
changes than initialization scripts to fix the SC2166 and SC2086 issues
reported by ShellCheck linter.
Autoinit generated code is thus kept in line with initialization script
code.
According to ShellCheck's documentation:
export takes a variable name, but ShellCheck has noticed that you give it
an expanded variable instead. Remove $/${} for that, or use ${var?} to quiet.
Related: https://www.shellcheck.net/wiki/SC2163
Related: #470