Skip to content

Commit 8a7729c

Browse files
committed
documentation of path_entry_reorder updated
1 parent 8af7c95 commit 8a7729c

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

doc/source/module.rst

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1376,14 +1376,7 @@ Module Sub-Commands
13761376
:mfcmd:`prepend-path`, :mfcmd:`append-path` or :subcmd:`use` target
13771377
a path entry that is already defined in the environment variable.
13781378

1379-
The default behavior of :mfcmd:`prepend-path`, :mfcmd:`append-path` and
1380-
:subcmd:`use` is not to update the value if a path-like environment
1381-
variable, if they target a path entry that is already defined in the
1382-
environment variable. If this config option is set to 1, an existing
1383-
path entry is moved to the beginning respective end unless duplicates
1384-
are allowed. This is the default behavior of Lmod.
1385-
1386-
Default value is 0. It can be changed at installation time with
1379+
Default value is 0. It can be changed at installation time with the
13871380
:instopt:`--with-path-entry-reorder` option. The
13881381
:envvar:`MODULES_PATH_ENTRY_REORDER` environment variable is defined by
13891382
:subcmd:`config` sub-command when changing this configuration option from
@@ -5293,12 +5286,28 @@ ENVIRONMENT
52935286

52945287
.. envvar:: MODULES_PATH_ENTRY_REORDER
52955288

5296-
The default behavior of :mfcmd:`prepend-path`, :mfcmd:`append-path` and
5297-
:subcmd:`use` is not to update the value if a path-like environment
5298-
variable, if they target a path entry that is already defined in the
5299-
environment variable. If this config option is set to 1, an existing
5300-
path entry is moved to the beginning respective end unless duplicates
5301-
are allowed. This is the default behavior of Lmod.
5289+
This environment variable changes the behavior of :mfcmd:`prepend-path`, :mfcmd:`append-path` and :subcmd:`use`.
5290+
5291+
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.
5292+
If set to 0, the environment variable is not modified when the entry already exists.
5293+
5294+
Example:
5295+
5296+
.. parsed-literal::
5297+
5298+
:ps:`$` module config path_entry_reorder 0
5299+
:ps:`$` module append-path PATHVAR /foo
5300+
:ps:`$` module append-path PATHVAR /bar
5301+
:ps:`$` module append-path PATHVAR /foo
5302+
:ps:`$` echo $PATHVAR
5303+
/foo:/bar
5304+
:ps:`$` module config path_entry_reorder 1
5305+
:ps:`$` module append-path PATHVAR /foo
5306+
:ps:`$` echo $PATHVAR
5307+
/bar:/foo
5308+
:ps:`$` module append-path --duplicates PATHVAR /bar
5309+
:ps:`$` echo $PATHVAR
5310+
/bar:/foo:/bar
53025311
53035312
.. only:: html
53045313

0 commit comments

Comments
 (0)