Commit Graph

4815 Commits

Author SHA1 Message Date
Xavier Delaruelle
4d2bca5b33 doc: desc. stashshow subcmd in NEWS/man/changes 2022-09-29 07:02:38 +02:00
Xavier Delaruelle
3052bcf280 ts: adapt existing testfiles for stashshow sub-command 2022-09-29 07:02:38 +02:00
Xavier Delaruelle
8af7d4568f init: add stashshow subcmd to completion scripts 2022-09-29 07:02:38 +02:00
Xavier Delaruelle
9d539c4479 Add 'stashshow' sub-command
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.
2022-09-28 07:21:30 +02:00
Xavier Delaruelle
f271094ea2 doc: desc. stashshow in stash-environment design doc 2022-09-28 07:21:30 +02:00
Xavier Delaruelle
96a7559850 ts: add stashrm sub-cmd tests 2022-09-28 07:21:30 +02:00
Xavier Delaruelle
07caa4594c Core code for cmdModuleStashrm
Implement 'stashrm' sub-command. Parse stash argument to get
corresponding collection, then call saverm over this collection name.
2022-09-28 07:21:30 +02:00
Xavier Delaruelle
66bd9e23b1 Move collection resolution from stash in dedicated proc
Move collection name resolution from stash name from cmdModuleStashpop
into getCollectionFromStash procedure.
2022-09-28 07:21:30 +02:00
Xavier Delaruelle
11d3972eac doc: desc. stashrm subcmd in NEWS/man/changes 2022-09-28 07:21:30 +02:00
Xavier Delaruelle
73049c1d45 ts: adapt existing testfiles for stashrm sub-command 2022-09-28 07:21:30 +02:00
Xavier Delaruelle
3463d123d0 init: add stashrm subcmd to completion scripts 2022-09-28 07:21:30 +02:00
Xavier Delaruelle
3358134471 Add 'stashrm' sub-command
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.
2022-09-28 07:20:54 +02:00
Xavier Delaruelle
530c91a1e5 doc: desc. stashrm in stash-environment design doc 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
b8d0257157 ts: add stashpop sub-cmd tests 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
fc235534db Core code for cmdModuleStashpop
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.
2022-09-28 07:20:54 +02:00
Xavier Delaruelle
01bcbd5054 Add no_other_target option to findCollections
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.
2022-09-28 07:20:54 +02:00
Xavier Delaruelle
1e4bf541f6 doc: desc. stashpop subcmd in NEWS/man/changes 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
5719546c7e ts: adapt existing testfiles for stashpop sub-command 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
145462a864 ts/doc: add stashpop test/doc on 'module-info command' 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
104f1d9198 doc: desc. stashpop in stash-environment design doc 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
c7ff0fce5f init: add stashpop subcmd to completion scripts 2022-09-28 07:20:54 +02:00
Xavier Delaruelle
d3d918039b Add 'stashpop' sub-command
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.
2022-09-28 07:17:06 +02:00
Xavier Delaruelle
e5d0cb6e96 ts: add stash sub-cmd tests 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
a868cc6d85 ts: move unsatisfied constraint msg to init section 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
e14db4d995 ts: move nothing to save err msg in init section 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
1b672576cd ts: put coll not valid msg in a proc 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
525c7cb629 ts: put coll not found msg in a proc 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
8410525c32 Fix init property unserialization
Update getLoadedModulePropertyList to apply unserialization translation
map also for property not requiring sub-element split, like init.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
a45b8c2e23 Core code for cmdModuleStash
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.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
baa63395d2 Reword findCollections to swap default coll by __init__
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.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
3e9297cb28 Return is_tags_diff from getDiffBetweenCurEnvAndColl
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.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
20a1b369f8 Add unordered_lists_compared arg on getDiffBetweenArray
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.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
b876754e98 Add notset_equals_empty arg to getDiffBetweenArray
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.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
92e915ae93 Create getDiffBetweenCurEnvAndColl from cmdModuleRestore
Create getDiffBetweenCurEnvAndColl procedure from code of
cmdModuleRestore to analyze a collection content and produce differences
compared to current environment.
2022-09-28 06:42:59 +02:00
Xavier Delaruelle
5fca7f1f31 doc: desc. stash subcmd in NEWS/man/changes 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
9654e8fcbb ts: adapt existing testfiles for stash sub-command 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
ec835353b2 ts/doc: add stash test/doc on 'module-info command' 2022-09-28 06:42:59 +02:00
Xavier Delaruelle
705b953a43 init: add stash subcmd to completion scripts 2022-09-20 06:19:33 +02:00
Xavier Delaruelle
4eebc48c30 Add 'stash' sub-command
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.
2022-09-20 06:19:33 +02:00
Xavier Delaruelle
59967b26c3 doc: add stash-environment design doc 2022-09-18 20:41:47 +02:00
Xavier Delaruelle
1019589868 cirrus: test FreeBSD 13.1 instead of eol 13.0 2022-09-18 20:41:17 +02:00
Xavier Delaruelle
870fda7104 ts: do not lint lib/config.guess generated file 2022-09-15 19:44:32 +02:00
Xavier Delaruelle
697a7faf51 ts: temporarily ignore remaining shellcheck reports
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
2022-09-15 19:44:32 +02:00
Xavier Delaruelle
9a53011961 init: only source sh or bash init if BASH var is set
Update profile script for sh-like shells to only source sh or bash
initialization script when BASH environment variable is found set.

Fixes #473
2022-09-15 19:44:21 +02:00
Xavier Delaruelle
09cd7b5361 doc: desc. script/mb in CONTRIBUTING 2022-09-04 09:58:07 +02:00
Xavier Delaruelle
b5c3c30477 doc: desc lint testsuite in CONTRIBUTING 2022-09-03 16:00:54 +02:00
Xavier Delaruelle
a7f45dd9f0 doc: desc. script/mt utility in CONTRIBUTING 2022-09-03 16:00:54 +02:00
Xavier Delaruelle
030bc75976 doc: desc. quick testsuite mode in CONTRIBUTING 2022-09-03 16:00:54 +02:00
Xavier Delaruelle
4bc4b365ef Update autoinit sh code to fix SC2166/SC2086
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.
2022-09-03 16:00:54 +02:00
Lukáš Zaoral
0d6bc10c70 lint(ShellCheck): fix SC2163 warning
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
2022-09-02 09:52:05 +02:00