Skip to content

Commit f4f4f78

Browse files
committed
doc: clarify module subcmd allowed in modulefile
Clarify the module sub-commands that are allowed to be used within a modulefile. Fixes #423
1 parent 383179c commit f4f4f78

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

doc/source/modulefile.rst

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,23 @@ the *modulefile* is being loaded.
237237

238238
.. mfcmd:: module [sub-command] [sub-command-options] [sub-command-args]
239239

240-
Contains the same *sub-commands* as described in the :ref:`module(1)`
241-
man page in the :ref:`Module Sub-Commands` section. This command permits a
242-
*modulefile* to :subcmd:`load` or :subcmd:`unload` other *modulefiles*. No
243-
checks are made to ensure that the *modulefile* does not try to load itself.
244-
Often it is useful to have a single *modulefile* that performs a number of
245-
``module load`` commands. For example, if every user on the system
246-
requires a basic set of applications loaded, then a core *modulefile*
247-
would contain the necessary ``module load`` commands.
240+
Contains the same *sub-commands* as described in the :ref:`module(1)` man
241+
page in the :ref:`Module Sub-Commands` section. Exception made for the
242+
following sub-commands that can only be used outside of a modulefile context:
243+
:subcmd:`path`, :subcmd:`paths`, :subcmd:`autoinit`, :subcmd:`help`,
244+
:subcmd:`clear`, :subcmd:`sh-to-mod`, :subcmd:`edit`, :subcmd:`config`,
245+
:subcmd:`refresh` and :subcmd:`source`. Also the following sub-commands
246+
cannot be used but have a modulefile command counterpart:
247+
:subcmd:`prepend-path`, :subcmd:`append-path`, :subcmd:`remove-path`,
248+
:subcmd:`is-loaded`, :subcmd:`is-saved`, :subcmd:`is-used`,
249+
:subcmd:`is-avail` and :subcmd:`info-loaded`.
250+
251+
This command permits a *modulefile* to :subcmd:`load` or :subcmd:`unload`
252+
other *modulefiles*. No checks are made to ensure that the *modulefile* does
253+
not try to load itself. Often it is useful to have a single *modulefile* that
254+
performs a number of ``module load`` commands. For example, if every user on
255+
the system requires a basic set of applications loaded, then a core
256+
*modulefile* would contain the necessary ``module load`` commands.
248257

249258
The ``--not-req`` option may be set for the ``load``, ``unload`` and
250259
``switch`` sub-commands to inhibit the definition of an implicit prereq or
@@ -260,6 +269,11 @@ the *modulefile* is being loaded.
260269
.. versionchanged:: 4.7
261270
Sub-command option ``--no-req`` added
262271

272+
.. versionchanged:: 5.0
273+
:subcmd:`source` sub-command is not allowed anymore and ``source`` Tcl
274+
command should be used instead
275+
276+
263277
.. mfcmd:: module-alias name modulefile
264278

265279
Assigns the *modulefile* to the alias *name*. This command should be

0 commit comments

Comments
 (0)