Skip to content

Commit 31d9636

Browse files
committed
doc: desc. --user/--group options to module-{hide,forbid,tag}
1 parent 8796190 commit 31d9636

File tree

6 files changed

+69
-4
lines changed

6 files changed

+69
-4
lines changed

.hunspell.en.dic

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,3 +1155,6 @@ isEnvVarDefined
11551155
envVarEquals
11561156
setEnvVarIfUndefined
11571157
LMSTICKYRULE
1158+
Chardon
1159+
Jérémy
1160+
Déchard

NEWS.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,14 @@ Modules 5.4.0 (not yet released)
153153
#503)
154154
* Init: Improve Tcsh shell completion script to complete against existing
155155
files when pattern starts with ``/``, ``.`` or ``~/``. (fix issue #523)
156+
* Add ``--user`` option to :mfcmd:`module-forbid`, :mfcmd:`module-hide` and
157+
:mfcmd:`module-tag` modulefile commands to forbid, hide or tag only if user
158+
is listed in the value of this new option. (fix issue #520 with contribution
159+
from Jérémy Déchard)
160+
* Add ``--group`` option to :mfcmd:`module-forbid`, :mfcmd:`module-hide` and
161+
:mfcmd:`module-tag` modulefile commands to forbid, hide or tag only if one
162+
user's group is listed in the value of this new option. (fix issue #520 with
163+
contribution from Jérémy Déchard)
156164

157165

158166
.. _5.3 release notes:

doc/source/changes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1075,6 +1075,7 @@ The following modulefile Tcl commands appeared on Modules 5.
10751075
* module specification on which stickiness applies is recorded in loaded
10761076
environment to determine if it is still satisfied when updating
10771077
environment.
1078+
* options ``--user`` and ``--group`` are added.
10781079

10791080
:mfcmd:`break`
10801081

doc/source/design/hide-or-forbid-modulefile.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,17 @@ Specification
225225
- ``--hard``: highest hiding level
226226
- ``--not-user``: specify a list of users unaffected by hide mechanism
227227
- ``--not-group``: specify a list of groups whose member are unaffected by hide mechanism
228+
- ``--user``: specify a list of users specifically affected by hide mechanism
229+
- ``--group``: specify a list of groups whose member are specifically affected by hide mechanism
228230
- ``--before``: enables hide mechanism until a given date
229231
- ``--after``: enables hide mechanism after a given date
230232

231233
- ``module-forbid`` accepts options that change its behavior:
232234

233235
- ``--not-user``: specify a list of users unaffected by forbid mechanism
234236
- ``--not-group``: specify a list of groups whose member are unaffected by forbid mechanism
237+
- ``--user``: specify a list of users specifically affected by forbid mechanism
238+
- ``--group``: specify a list of groups whose member are specifically affected by forbid mechanism
235239
- ``--before``: enables forbid mechanism until a given date
236240
- ``--after``: enables forbid mechanism after a given date
237241
- ``--message``: supplements error message obtained when trying to evaluate a forbidden module with given text message
@@ -259,12 +263,16 @@ Specification
259263

260264
- Unless on very specific cases, where a global rc file defines these hidden/forbidden commands for the full path modules
261265

262-
- ``--not-user`` and ``--not-group`` specification is only supported on Unix platform
266+
- ``--user``, ``--group``, ``--not-user`` and ``--not-group`` specification is only supported on Unix platform
263267

264-
- These 2 options raise an error when used on Windows platform
268+
- These options raise an error when used on Windows platform
265269
- In which case relative ``module-hide`` or ``module-forbid`` command is made ineffective as well as remaining content of the modulerc script hosting them
266270
- Error message is clearly seen when trying to load related modules and indicate where to find the erroneous command
267271

272+
- ``--user`` and ``--group`` options prevail over ``--not-user`` and ``--not-group`` options
273+
274+
- When ``--user`` or ``--group`` is set, exclusion list from ``--not-user`` and ``--not-group`` are ignored
275+
268276
- ``--before`` and ``--after`` are also supported by ``module-hide`` to phase-out modules prior to forbid their evaluation
269277

270278
- ``--before`` and ``--after`` accept a date time as value

doc/source/design/module-tags.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,19 @@ Defining
8383

8484
- ``--not-user``: specify a list of users unaffected by specified tagging
8585
- ``--not-group``: specify a list of groups whose member are unaffected by specified tagging
86+
- ``--user``: specify a list of users specifically affected by specified tagging
87+
- ``--group``: specify a list of groups whose member are specifically affected by specified tagging
8688

87-
- ``--not-user`` and ``--not-group`` specification is only supported on Unix platform
89+
- ``--user``, ``--group``, ``--not-user`` and ``--not-group`` specification is only supported on Unix platform
8890

89-
- These 2 options raise an error when used on Windows platform
91+
- These options raise an error when used on Windows platform
9092
- In which case relative ``module-tag`` command is made ineffective as well as remaining content of the modulerc script hosting them
9193
- Error message is clearly seen when trying to load related modules and indicate where to find the erroneous command
9294

95+
- ``--user`` and ``--group`` options prevail over ``--not-user`` and ``--not-group`` options
96+
97+
- When ``--user`` or ``--group`` is set, exclusion list from ``--not-user`` and ``--not-group`` are ignored
98+
9399
- ``module-tag`` is intended to be used in modulerc files
94100

95101
- to be easily fetched during ``avail`` sub-command processing

doc/source/modulefile.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -470,6 +470,8 @@ the *modulefile* is being loaded.
470470
* ``--before datetime``
471471
* ``--not-user {user...}``
472472
* ``--not-group {group...}``
473+
* ``--user {user...}``
474+
* ``--group {group...}``
473475
* ``--message {text message}``
474476
* ``--nearly-message {text message}``
475477

@@ -487,6 +489,14 @@ the *modulefile* is being loaded.
487489
specified. When both options are set, forbidding is not applied if a match is
488490
found for ``--not-user`` or ``--not-group``.
489491

492+
If ``--user`` option is set, forbidding is applied only if the username of
493+
the user currently running :file:`modulecmd.tcl` is part of the list of
494+
username specified. Following the same approach, if ``--group`` option is
495+
set, forbidding is applied only if current user is member of one the group
496+
specified. When both options are set, forbidding is applied if a match is
497+
found for ``--user`` or ``--group``. These two options prevail over
498+
``--not-user`` and ``--not-group`` options.
499+
490500
Error message returned when trying to evaluate a forbidden module can be
491501
supplemented with the *text message* set through ``--message`` option.
492502

@@ -521,6 +531,9 @@ the *modulefile* is being loaded.
521531
.. versionchanged:: 5.4
522532
Full path file name may be used to designate *modulefile*
523533

534+
.. versionchanged:: 5.4
535+
Options ``--user`` and ``--group`` added
536+
524537
.. mfcmd:: module-hide [options] modulefile...
525538

526539
Hide *modulefile* to exclude it from available module search or module
@@ -535,6 +548,8 @@ the *modulefile* is being loaded.
535548
* ``--before datetime``
536549
* ``--not-user {user...}``
537550
* ``--not-group {group...}``
551+
* ``--user {user...}``
552+
* ``--group {group...}``
538553

539554
When ``--soft`` option is set, *modulefile* is also set hidden, but hiding is
540555
disabled when search or selection query's root name matches module's root
@@ -569,6 +584,14 @@ the *modulefile* is being loaded.
569584
When both options are set, hiding is not applied if a match is found for
570585
``--not-user`` or ``--not-group``.
571586

587+
If ``--user`` option is set, hiding is applied only if the username of the
588+
user currently running :file:`modulecmd.tcl` is part of the list of username
589+
specified. Following the same approach, if ``--group`` option is set, hiding
590+
is applied only if current user is member of one the group specified. When
591+
both options are set, hiding is applied if a match is found for ``--user`` or
592+
``--group``. These two options prevail over ``--not-user`` and
593+
``--not-group`` options.
594+
572595
If the :option:`--all` option is set on :subcmd:`avail`, :subcmd:`aliases`,
573596
:subcmd:`whatis` or :subcmd:`search` sub-commands, hiding is disabled thus
574597
hidden modulefiles are included in module search. Hard-hidden modules (i.e.,
@@ -611,6 +634,9 @@ the *modulefile* is being loaded.
611634
.. versionchanged:: 5.4
612635
Full path file name may be used to designate *modulefile*
613636

637+
.. versionchanged:: 5.4
638+
Options ``--user`` and ``--group`` added
639+
614640
.. mfcmd:: module-info option [info-args]
615641

616642
Provide information about the :file:`modulecmd.tcl` program's state. Some of
@@ -786,6 +812,8 @@ the *modulefile* is being loaded.
786812

787813
* ``--not-user {user...}``
788814
* ``--not-group {group...}``
815+
* ``--user {user...}``
816+
* ``--group {group...}``
789817

790818
If ``--not-user`` option is set, the tag is not applied if the username of
791819
the user currently running :file:`modulecmd.tcl` is part of the list of
@@ -794,6 +822,14 @@ the *modulefile* is being loaded.
794822
specified. When both options are set, the tag is not applied if a match is
795823
found for ``--not-user`` or ``--not-group``.
796824

825+
If ``--user`` option is set, the tag is applied only if the username of the
826+
user currently running :file:`modulecmd.tcl` is part of the list of username
827+
specified. Following the same approach, if ``--group`` option is set, the tag
828+
is applied only if current user is member of one the group specified. When
829+
both options are set, the tag is applied if a match is found for ``--user``
830+
or ``--group``. These two options prevail over ``--not-user`` and
831+
``--not-group`` options.
832+
797833
The parameter *modulefile* may also be a symbolic modulefile name or a
798834
modulefile alias. It may also leverage a specific syntax to finely select
799835
module version (see `Advanced module version specifiers`_ section below).
@@ -822,6 +858,9 @@ the *modulefile* is being loaded.
822858
.. versionchanged:: 5.4
823859
Full path file name may be used to designate *modulefile*
824860

861+
.. versionchanged:: 5.4
862+
Options ``--user`` and ``--group`` added
863+
825864
.. mfcmd:: module-version modulefile version-name...
826865

827866
Assigns the symbolic *version-name* to the *modulefile*. This command

0 commit comments

Comments
 (0)