Skip to content

Commit 999a8b5

Browse files
committed
doc: desc. source-sh --ignore option
1 parent 1ac6bd2 commit 999a8b5

File tree

4 files changed

+26
-1
lines changed

4 files changed

+26
-1
lines changed

NEWS.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,9 @@ Modules 5.4.0 (not yet released)
148148
:subcmd:`sh-to-mod` sub-command. With this mode, the generated output of the
149149
bash shell script is evaluated to get the environment changes instead of
150150
sourcing this script. (fix issue #519)
151+
* Add ``--ignore`` option to :mfcmd:`source-sh` modulefile command to define
152+
shell elements changed by shell script that should be ignored. (fix issue
153+
#503)
151154

152155

153156
.. _5.3 release notes:

doc/source/changes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,8 @@ The following modulefile Tcl commands appeared on Modules 5.
10501050

10511051
Shell mode ``bash-eval`` is introduced on Modules version ``5.4``.
10521052

1053+
``--ignore`` option is introduced on Modules version ``5.4``.
1054+
10531055
:mfcmd:`unsetenv`
10541056

10551057
Starting with version ``5.1``:

doc/source/design/source-shell-script-in-modulefile.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@ Specification
215215

216216
- Instead of sourcing a bash shell script, execution output of this script is evaluated
217217

218+
- ``--ignore`` option is added in version 5.4
219+
220+
- This option accepts a list of shell element separated by ``:`` character among:
221+
222+
- ``envvar``
223+
- ``alias``
224+
- ``function``
225+
- ``chdir``
226+
- ``complete``
227+
228+
- Shell elements changed by sourced script and listed on ``--ignore`` option are ignored (no modulefile command relative to these changes are produced)
229+
218230
- **FUTURE**: this feature may be extended to translate environment changes made by tools like Spack, Lmod or pkg-config. It may provide this way bridges between different realms.
219231

220232
.. vim:set tabstop=2 shiftwidth=2 expandtab autoindent:

doc/source/modulefile.rst

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ the *modulefile* is being loaded.
11771177
.. versionchanged:: 5.1
11781178
Option ``--set-if-undef`` added
11791179

1180-
.. mfcmd:: source-sh shell script [arg...]
1180+
.. mfcmd:: source-sh [--ignore eltlist] shell script [arg...]
11811181

11821182
Evaluate with *shell* the designated *script* with defined *arguments* to
11831183
find out the environment changes it does. Those changes obtained by comparing
@@ -1204,6 +1204,11 @@ the *modulefile* is being loaded.
12041204
is not sourced but the output resulting from its execution is evaluated to
12051205
determine the environment changes it does.
12061206

1207+
The ``--ignore`` option accepts a list of shell elements whose changes made
1208+
by *script* should be ignored. *eltlist* corresponds to the concatenation of
1209+
multiple shell element separated by colon character. Accepted shell elements
1210+
are: ``envvar``, ``alias``, ``function``, ``chdir`` and ``complete``.
1211+
12071212
.. only:: html
12081213

12091214
.. versionadded:: 4.6
@@ -1218,6 +1223,9 @@ the *modulefile* is being loaded.
12181223
.. versionchanged:: 5.4
12191224
Support for ``bash-eval`` shell mode added
12201225

1226+
.. versionchanged:: 5.4
1227+
Option ``--ignore`` added
1228+
12211229
.. mfcmd:: system string
12221230

12231231
Run *string* command through shell. On Unix, command is passed to the

0 commit comments

Comments
 (0)