Skip to content

Commit df30810

Browse files
committed
doc: desc. module-warn in man/changes
Signed-off-by: Xavier Delaruelle <[email protected]>
1 parent b8e95bb commit df30810

File tree

3 files changed

+64
-5
lines changed

3 files changed

+64
-5
lines changed

doc/source/changes.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,8 @@ The following modulefile Tcl commands appeared on Modules 5.
10781078
| 5.5 | :mfcmd:`hide-modulefile`, :mfcmd:`hide-version`, |
10791079
| | :mfcmd:`lsb-release` |
10801080
+------------+-----------------------------------------------------------------+
1081-
| 5.6 | :mfcmd:`depends-on-any`, :mfcmd:`module-help` |
1081+
| 5.6 | :mfcmd:`depends-on-any`, :mfcmd:`module-help`, |
1082+
| | :mfcmd:`module-warn` |
10821083
+------------+-----------------------------------------------------------------+
10831084

10841085
:mfcmd:`system`, :mfcmd:`is-used`

doc/source/module.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3213,6 +3213,8 @@ or consequence of a module action. The inherited tags are:
32133213
* ``nearly-forbidden``: module will soon be *forbidden*, which has been set
32143214
through the use of the :mfcmd:`module-forbid` command. Thus this module
32153215
will soon not be able to load anymore.
3216+
* ``warning``: a warning message for the use of the module is set through the
3217+
use of the :mfcmd:`module-warn` command.
32163218

32173219
Tags may also be associated to modules by using the :mfcmd:`module-tag`
32183220
modulefile command. Among tags that could be set this way, some have a special
@@ -3280,6 +3282,9 @@ Module tags cannot be used in search query to designate a modulefile.
32803282
.. versionchanged:: 5.6
32813283
Support for :subcmd:`spider` sub-command added
32823284

3285+
.. versionchanged:: 5.6
3286+
Tag ``warning`` added
3287+
32833288
.. _Sticky modules:
32843289

32853290
Sticky modules

doc/source/modulefile.rst

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ the *modulefile* is being loaded.
978978
Tags inherited from other modulefile commands or module states cannot be set
979979
with :mfcmd:`module-tag`. Otherwise an error is returned. Those special tags
980980
are: ``auto-loaded``, ``forbidden``, ``hidden``, ``hidden-loaded``,
981-
``loaded`` and ``nearly-forbidden``.
981+
``loaded``, ``nearly-forbidden`` and ``warning``.
982982

983983
When *tag* equals ``sticky`` or ``super-sticky``, designated *modulefile* is
984984
defined :ref:`Sticky modules`.
@@ -1037,6 +1037,59 @@ the *modulefile* is being loaded.
10371037

10381038
.. versionadded:: 4.1
10391039

1040+
.. mfcmd:: module-warn [options] --message {text message} modulefile...
1041+
1042+
Print warning message when evaluating *modulefile*. This command could be
1043+
placed in one of the :file:`modulecmd.tcl` rc files or within *modulefiles*.
1044+
Warning is emitted when *modulefile* is evaluated in ``load``, ``display``,
1045+
``test``, ``help``.
1046+
1047+
:mfcmd:`module-warn` command accepts the following options:
1048+
1049+
* ``--after datetime``
1050+
* ``--before datetime``
1051+
* ``--not-user {user...}``
1052+
* ``--not-group {group...}``
1053+
* ``--user {user...}``
1054+
* ``--group {group...}``
1055+
1056+
If ``--after`` option is set, warning is only effective after specified date
1057+
time. Following the same principle, if ``--before`` option is set, warning is
1058+
only effective before specified date time. Accepted date time format is
1059+
``YYYY-MM-DD[THH:MM]``. If no time (``HH:MM``) is specified, ``00:00`` is
1060+
assumed. ``--after`` and ``--before`` options are not supported on Tcl
1061+
versions prior to 8.5.
1062+
1063+
If ``--not-user`` option is set, warning is not applied if the username of
1064+
the user currently running :file:`modulecmd.tcl` is part of the list of
1065+
username specified. Following the same approach, if ``--not-group`` option is
1066+
set, warning is not applied if current user is member of one of the groups
1067+
specified. When both options are set, warning is not applied if a match is
1068+
found for ``--not-user`` or ``--not-group``.
1069+
1070+
If ``--user`` option is set, warning is applied only if the username of the
1071+
user currently running :file:`modulecmd.tcl` is part of the list of username
1072+
specified. Following the same approach, if ``--group`` option is set, warning
1073+
is applied only if current user is member of one of the groups specified.
1074+
When both options are set, warning is applied if a match is found for
1075+
``--user`` or ``--group``. If the same user name is set on both ``--user``
1076+
and ``--not-user`` options, ``--user`` prevails over ``--not-user``. If the
1077+
same group name is set on both ``--group`` and ``--not-group``, ``--group``
1078+
prevails over ``--not-group``.
1079+
1080+
Modules in warning included in the result of :subcmd:`avail`, :subcmd:`list`
1081+
or :subcmd:`spider` sub-commands are reported with a ``warning`` tag applied
1082+
to them. See :ref:`Module tags` section in :ref:`module(1)`.
1083+
1084+
The parameter *modulefile* may leverage a specific syntax to finely select
1085+
module version (see `Advanced module version specifiers`_ section below). It
1086+
may also be a full path file name to precisely designate one module in a
1087+
specific modulepath.
1088+
1089+
.. only:: html
1090+
1091+
.. versionadded:: 5.6
1092+
10401093
.. mfcmd:: module-whatis string
10411094

10421095
Defines a string which is displayed in case of the invocation of the
@@ -1640,9 +1693,9 @@ for each interpretation context.
16401693
| | :mfcmd:`module-forbid`, :mfcmd:`module-hide`, |
16411694
| | :mfcmd:`module-info`, :mfcmd:`module-tag`, |
16421695
| | :mfcmd:`module-version`, :mfcmd:`module-virtual`, |
1643-
| | :mfcmd:`modulepath-label`, :mfcmd:`system`, |
1644-
| | :mfcmd:`uname`, :mfcmd:`versioncmp` and standard |
1645-
| | Tcl commands |
1696+
| | :mfcmd:`module-warn`, :mfcmd:`modulepath-label`, |
1697+
| | :mfcmd:`system`, :mfcmd:`uname`, |
1698+
| | :mfcmd:`versioncmp` and standard Tcl commands |
16461699
+---------------------------+-----------------------------------------------------+
16471700

16481701
.. note:: Global and user run-command files are interpreted like modulefiles

0 commit comments

Comments
 (0)