Skip to content

Commit 5fd5fd6

Browse files
gsellxdelaruelle
authored andcommitted
doc: add path_entry_reorder configuration option
Signed-off-by: Achim Gsell <achim.gsell@psi.ch>
1 parent 5ef0a94 commit 5fd5fd6

4 files changed

Lines changed: 53 additions & 0 deletions

File tree

.hunspell.en.dic

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,3 +1324,5 @@ structs
13241324
reimplementation
13251325
gid
13261326
cmp
1327+
Achim
1328+
Gsell

INSTALL.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1723,6 +1723,9 @@ installation.
17231723
| | | :envvar:`MODULES_PAGER`, | | |
17241724
| | | :option:`--paginate`, :option:`--no-pager` | | |
17251725
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
1726+
| :mconfig:`path_entry_reorder` | ``0`` | :instopt:`--enable-path-entry-reorder`, | | |
1727+
| | | :envvar:`MODULES_PATH_ENTRY_REORDER` | | |
1728+
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
17261729
| :mconfig:`protected_envvars` | *Unset by default* | :envvar:`MODULES_PROTECTED_ENVVARS` | | |
17271730
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
17281731
| :mconfig:`quarantine_support` | ``0`` | :instopt:`--enable-quarantine-support`, | X | |

doc/source/changes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,6 +1279,8 @@ The following Modules configuration option has been introduced on Modules 5.
12791279
| 5.6 | :mconfig:`spider_output`, :mconfig:`spider_terse_output`, |
12801280
| | :mconfig:`spider_indepth`, :mconfig:`require_via` |
12811281
+------------+-----------------------------------------------------------------+
1282+
| 5.7 | :mconfig:`path_entry_reorder` |
1283+
+------------+-----------------------------------------------------------------+
12821284

12831285
:mconfig:`auto_handling`
12841286

doc/source/module.rst

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,23 @@ Module Sub-Commands
13701370
sub-command when changing this configuration option from its default value.
13711371
See :envvar:`MODULES_PAGER` description for details.
13721372

1373+
.. mconfig:: path_entry_reorder
1374+
1375+
Change order of entry in a path-like environment variable, when
1376+
:mfcmd:`prepend-path`, :mfcmd:`append-path` or :subcmd:`use` target
1377+
a path entry that is already defined in the environment variable.
1378+
1379+
Default value is ``0``. It can be changed at installation time with the
1380+
:instopt:`--enable-path-entry-reorder` option. The
1381+
:envvar:`MODULES_PATH_ENTRY_REORDER` environment variable is defined by
1382+
:subcmd:`config` sub-command when changing this configuration option from
1383+
its default value. See :envvar:`MODULES_PATH_ENTRY_REORDER` description
1384+
for details.
1385+
1386+
.. only:: html
1387+
1388+
.. versionadded:: 5.7
1389+
13731390
.. mconfig:: protected_envvars
13741391

13751392
Prevents any modification of listed environment variables (colon `:`
@@ -5274,6 +5291,35 @@ ENVIRONMENT
52745291
.. versionchanged:: 5.5
52755292
No pager when :file:`modulecmd.tcl` is run for scripting languages
52765293

5294+
.. envvar:: MODULES_PATH_ENTRY_REORDER
5295+
5296+
This environment variable changes the behavior of :mfcmd:`prepend-path`, :mfcmd:`append-path` and :subcmd:`use`.
5297+
5298+
If set to ``1``, and one of these commands targets a path entry that already exists in the environment variable, the entry is moved to the beginning or end (depending on the command), unless duplicates are allowed. This is the default behavior in Lmod.
5299+
If set to ``0``, the environment variable is not modified when the entry already exists.
5300+
5301+
Example:
5302+
5303+
.. parsed-literal::
5304+
5305+
:ps:`$` module config path_entry_reorder 0
5306+
:ps:`$` module append-path PATHVAR /foo
5307+
:ps:`$` module append-path PATHVAR /bar
5308+
:ps:`$` module append-path PATHVAR /foo
5309+
:ps:`$` echo $PATHVAR
5310+
/foo:/bar
5311+
:ps:`$` module config path_entry_reorder 1
5312+
:ps:`$` module append-path PATHVAR /foo
5313+
:ps:`$` echo $PATHVAR
5314+
/bar:/foo
5315+
:ps:`$` module append-path --duplicates PATHVAR /bar
5316+
:ps:`$` echo $PATHVAR
5317+
/bar:/foo:/bar
5318+
5319+
.. only:: html
5320+
5321+
.. versionadded:: 5.7
5322+
52775323
.. envvar:: MODULES_PROTECTED_ENVVARS
52785324

52795325
A colon separated list of environment variable names that should not be

0 commit comments

Comments
 (0)