Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .hunspell.en.dic
Original file line number Diff line number Diff line change
Expand Up @@ -1659,3 +1659,6 @@ misoptval
nextargisval
otherargv
parseModuleCommandArgs
DDTHH
hhmm
22T21
65 changes: 65 additions & 0 deletions INSTALL.rst
Original file line number Diff line number Diff line change
Expand Up @@ -990,6 +990,24 @@ instance :instopt:`--without-modulepath<--with-modulepath>`):

.. versionadded:: 5.4

.. instopt:: --with-avail-json-output=LIST

Specify the content to report on avail sub-command JSON output in addition
to the available module names. Elements accepted in LIST are:
``modulepath``, ``alias``, ``provided-alias``, ``dirwsym``, ``sym``,
``tag``, ``hidden``, ``variant``, ``variantifspec``, ``via`` and ``mtime``
(elements in LIST are separated by ``:``). The order of the elements in LIST
does not matter.
(default=\ ``modulepath:alias:dirwsym:sym:tag:via``)

This installation option defines the default value of the
:mconfig:`avail_json_output` configuration option which could be changed
after installation with the :subcmd:`config` sub-command.

.. only:: html or latex

.. versionadded:: 5.8

.. instopt:: --with-avail-output=LIST

Specify the content to report on avail sub-command regular output in addition
Expand Down Expand Up @@ -1257,6 +1275,23 @@ instance :instopt:`--without-modulepath<--with-modulepath>`):
.. versionchanged:: 5.6
Default ``nearly-forbidden`` tag color changed

.. instopt:: --with-list-json-output=LIST

Specify the content to report on list sub-command JSON output in addition
to the loaded module names. Elements accepted in LIST are:
``variant``, ``alias``, ``sym``, ``tag``, ``hidden``, ``via`` and ``mtime``
(elements in LIST are separated by ``:``). The order of the elements in LIST
does not matter.
(default=\ ``variant:sym:tag:via``)

This installation option defines the default value of the
:mconfig:`list_json_output` configuration option which could be changed
after installation with the :subcmd:`config` sub-command.

.. only:: html or latex

.. versionadded:: 5.8

.. instopt:: --with-list-output=LIST

Specify the content to report on list sub-command regular output in addition
Expand Down Expand Up @@ -1504,6 +1539,24 @@ instance :instopt:`--without-modulepath<--with-modulepath>`):

.. versionadded:: 4.3

.. instopt:: --with-spider-json-output=LIST

Specify the content to report on spider sub-command JSON output in addition
to the available module names. Elements accepted in LIST are:
``modulepath``, ``alias``, ``provided-alias``, ``dirwsym``, ``sym``,
``tag``, ``hidden``, ``variant``, ``variantifspec``, ``via`` and ``mtime``
(elements in LIST are separated by ``:``). The order of the elements in LIST
does not matter.
(default=\ ``modulepath:alias:dirwsym:sym:tag:via``)

This installation option defines the default value of the
:mconfig:`spider_json_output` configuration option which could be changed
after installation with the :subcmd:`config` sub-command.

.. only:: html or latex

.. versionadded:: 5.8

.. instopt:: --with-spider-output=LIST

Specify the content to report on spider sub-command regular output in
Expand Down Expand Up @@ -1760,6 +1813,10 @@ installation.
| | | :envvar:`MODULES_AVAIL_INDEPTH`, | | |
| | | :option:`--indepth`, :option:`--no-indepth` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`avail_json_output` | modulepath:alias:dirwsym:sym:tag:via | :instopt:`--with-avail-json-output`, | | |
| | | :envvar:`MODULES_AVAIL_JSON_OUTPUT`, | | |
| | | :option:`--output` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`avail_output` | modulepath:alias:dirwsym:sym:tag:\ | :instopt:`--with-avail-output`, | | |
| | variantifspec:key | :envvar:`MODULES_AVAIL_OUTPUT`, | | |
| | | :option:`--output` | | |
Expand Down Expand Up @@ -1837,6 +1894,10 @@ installation.
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`linked_envvars` | *Empty by default* | :envvar:`MODULES_LINKED_ENVVARS` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`list_json_output` | variant:sym:tag:via | :instopt:`--with-list-json-output`, | | |
| | | :envvar:`MODULES_LIST_JSON_OUTPUT`, | | |
| | | :option:`--output` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`list_output` | ``header:idx:variant:sym:tag:key`` | :instopt:`--with-list-output`, | | |
| | | :envvar:`MODULES_LIST_OUTPUT`, | | |
| | | :option:`--output` | | |
Expand Down Expand Up @@ -1923,6 +1984,10 @@ installation.
| | | :envvar:`MODULES_SPIDER_INDEPTH`, | | |
| | | :option:`--indepth`, :option:`--no-indepth` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`spider_json_output` | modulepath:alias:dirwsym:sym:tag:via | :instopt:`--with-spider-json-output`, | | |
| | | :envvar:`MODULES_SPIDER_JSON_OUTPUT`, | | |
| | | :option:`--output` | | |
+-----------------------------------+----------------------------------------------+----------------------------------------------+--------------+-----------+
| :mconfig:`spider_output` | modulepath:alias:dirwsym:sym:tag:\ | :instopt:`--with-spider-output`, | | |
| | variantifspec:via:key | :envvar:`MODULES_SPIDER_OUTPUT`, | | |
| | | :option:`--output` | | |
Expand Down
60 changes: 60 additions & 0 deletions MIGRATING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,66 @@ Modules. It provides an overview of the new features and changed behaviors
that will be encountered when upgrading.


v5.8
----

This new version is backward-compatible with previous version 5 release. It
fixes bugs but also introduces new functionalities that are described in this
section. See the :ref:`5.8 release notes<5.8 release notes>` for a complete
list of the changes between Modules v5.7 and v5.8.

Configuring JSON output content
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The content of the JSON output of :subcmd:`avail`, :subcmd:`list` and
:subcmd:`spider` sub-commands can now be configured, like their regular and
terse outputs. The new :mconfig:`avail_json_output`,
:mconfig:`list_json_output` and :mconfig:`spider_json_output` configuration
options define the elements to report in the JSON document. An element
corresponds either to a key of the module JSON objects (``sym``, ``tag``,
``variant``, ``via``), to a kind of entry to include (``alias``,
``provided-alias``, ``dirwsym``, ``hidden``) or to the grouping of modules by
modulepath (``modulepath``). The :option:`--output`/:option:`-o` command line
switch is now accepted on :option:`--json` output mode to change the reported
content for one command execution.

By default, the same JSON document than previous versions is produced. When
an element is not enabled, its key is omitted from the JSON objects. Without
the ``modulepath`` element, the top-level JSON object is directly keyed by
module names.

.. parsed-literal::

:ps:`$` module avail --json foo
{"/path/to/modulefiles": {
"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "symbols": [ "default" ], "tags": [], "pathname": "/path/to/modulefiles/foo/1.0", "via": []}
}}
:ps:`$` module avail --json -o sym foo
{"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "symbols": [ "default" ], "pathname": "/path/to/modulefiles/foo/1.0"}}

The new ``mtime`` element, specific to JSON output mode, reports the
modification time of each modulefile as an ISO 8601 string. It is not part
of the default content as it requires to stat every modulefile when no module
cache file is available.

.. parsed-literal::

:ps:`$` module config avail_json_output +mtime
:ps:`$` module avail --json foo
{"/path/to/modulefiles": {
"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "symbols": [ "default" ], "tags": [], "pathname": "/path/to/modulefiles/foo/1.0", "mtime": "2026-09-22T21:03:28+0200", "via": []}
}}

Variants are also reported on :subcmd:`avail` and :subcmd:`spider` JSON
output when the ``variant`` or ``variantifspec`` element is enabled. The
possible values of each variant are set as a JSON array.

.. parsed-literal::

:ps:`$` module avail --json -o variant foo
{"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "variants": { "arch": [ "x86_64", "arm64" ], "debug": [ "on", "off" ] }, "pathname": "/path/to/modulefiles/foo/1.0"}}


v5.7
----

Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,9 @@ sed -e 's|@prefix@|$(prefix)|g' \
-e 's|@listterseoutput@|$(listterseoutput)|g' \
-e 's|@spideroutput@|$(spideroutput)|g' \
-e 's|@spiderterseoutput@|$(spiderterseoutput)|g' \
-e 's|@availjsonoutput@|$(availjsonoutput)|g' \
-e 's|@listjsonoutput@|$(listjsonoutput)|g' \
-e 's|@spiderjsonoutput@|$(spiderjsonoutput)|g' \
-e 's|@variantshortcut@|$(variantshortcut)|g' \
-e 's|@editor@|$(editor)|g' \
-e 's|@autohandling@|$(setautohandling)|g' \
Expand Down
3 changes: 3 additions & 0 deletions Makefile.inc.in
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ listoutput := @listoutput@
listterseoutput := @listterseoutput@
spideroutput := @spideroutput@
spiderterseoutput := @spiderterseoutput@
availjsonoutput := @availjsonoutput@
listjsonoutput := @listjsonoutput@
spiderjsonoutput := @spiderjsonoutput@

# variant configuration
variantshortcut := @variantshortcut@
Expand Down
13 changes: 13 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,19 @@ Modules 5.8.0 (not yet released)
concurrently, each group of files being run in a private copy of the
testsuite directory. Coverage mode (``COVERAGE=y``) is supported, the
coverage logs of each group of files are merged at the end of the run.
* Add :mconfig:`avail_json_output`, :mconfig:`list_json_output` and
:mconfig:`spider_json_output` configuration options to define the content
of the JSON output of :subcmd:`avail`, :subcmd:`list` and :subcmd:`spider`
sub-commands. Default value of these options can be set at installation
time with :instopt:`--with-avail-json-output`,
:instopt:`--with-list-json-output` and :instopt:`--with-spider-json-output`
options and superseded with the :envvar:`MODULES_AVAIL_JSON_OUTPUT`,
:envvar:`MODULES_LIST_JSON_OUTPUT` and :envvar:`MODULES_SPIDER_JSON_OUTPUT`
environment variables or the :option:`--output` command line switch, which
is now accepted on :option:`--json` output mode.
* Add *mtime* element to the JSON output configuration of :subcmd:`avail`,
:subcmd:`list` and :subcmd:`spider` sub-commands to report the modification
time of modulefiles. (fix issue #615)


.. _5.7 release notes:
Expand Down
38 changes: 37 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ darkbgcolors lightbgcolors termbg lockedconfigs icase unloadmatchorder \
searchmatch modulepath loadedmodules quarantinevars wa277 pathentryreorder advversspec ml \
windowssupport nearlyforbiddendays implicitrequirement tagabbrev \
tagcolorname mcookieversioncheck availoutput availterseoutput listoutput \
listterseoutput editor variantshortcut bashcompletiondir fishcompletiondir \
listterseoutput availjsonoutput listjsonoutput spiderjsonoutput editor \
variantshortcut bashcompletiondir fishcompletiondir \
zshcompletiondir tcllinter tcllinteropts nagelfardatadir nagelfaraddons \
stickypurge uniquenameloaded abortonerror sourcecache logger loggeropts \
loggedevents conflictunload spideroutput spiderterseoutput spiderindepth \
Expand Down Expand Up @@ -152,6 +153,9 @@ listoutput='header:idx:variant:sym:tag:key'
listterseoutput='header'
spideroutput='modulepath:alias:dirwsym:sym:tag:variantifspec:via:key'
spiderterseoutput=$availterseoutput
availjsonoutput='modulepath:alias:dirwsym:sym:tag:via'
listjsonoutput='variant:sym:tag:via'
spiderjsonoutput=$availjsonoutput
editor='vi'
variantshortcut=
bashcompletiondir=
Expand Down Expand Up @@ -364,6 +368,14 @@ Optional Packages:
\`reload', \`switch', \`switch_unload', \`try-load'
and \`unload' (elements in LIST are separated by
\`:') [$abortonerror]
--with-avail-json-output=LIST
specify content to report on avail sub-command
JSON output. elements accepted in LIST are:
\`modulepath', \`alias', \`provided-alias',
\`dirwsym', \`sym', \`tag', \`hidden', \`variant',
\`variantifspec', \`via' and \`mtime' (elements in
LIST are separated by \`:')
[$availjsonoutput]
--with-avail-output=LIST
specify content to report on avail sub-command
regular output. elements accepted in LIST are:
Expand Down Expand Up @@ -423,6 +435,13 @@ Optional Packages:
color is defined to \`light'. Expect the same syntax
than described for \`--with-dark-background-colors'
[$lightbgcolors]
--with-list-json-output=LIST
specify content to report on list sub-command
JSON output. elements accepted in LIST are:
\`variant', \`alias', \`sym', \`tag', \`hidden',
\`via' and \`mtime' (elements in LIST are separated
by \`:')
[$listjsonoutput]
--with-list-output=LIST
specify content to report on list sub-command
regular output. elements accepted in LIST are:
Expand Down Expand Up @@ -489,6 +508,14 @@ Optional Packages:
match the beginning of module name (\`starts_with')
or any part of module name (\`contains')
[$searchmatch]
--with-spider-json-output=LIST
specify content to report on spider sub-command
JSON output. elements accepted in LIST are:
\`modulepath', \`alias', \`provided-alias',
\`dirwsym', \`sym', \`tag', \`hidden', \`variant',
\`variantifspec', \`via' and \`mtime' (elements in
LIST are separated by \`:')
[$spiderjsonoutput]
--with-spider-output=LIST
specify content to report on spider sub-command
regular output. elements accepted in LIST are:
Expand Down Expand Up @@ -972,6 +999,15 @@ for arg in "$@"; do
--with-spider-terse-output=*|--without-spider-terse-output)
allowedval=" modulepath alias provided-alias dirwsym indesym sym tag key hidden variant variantifspec " ;
check_and_get_package_value_list "spiderterseoutput" "$arg" "$allowedval" "" ;;
--with-avail-json-output=*|--without-avail-json-output)
allowedval=" modulepath alias provided-alias dirwsym sym tag hidden variant variantifspec via mtime " ;
check_and_get_package_value_list "availjsonoutput" "$arg" "$allowedval" "" ;;
--with-list-json-output=*|--without-list-json-output)
allowedval=" variant alias sym tag hidden via mtime " ;
check_and_get_package_value_list "listjsonoutput" "$arg" "$allowedval" "" ;;
--with-spider-json-output=*|--without-spider-json-output)
allowedval=" modulepath alias provided-alias dirwsym sym tag hidden variant variantifspec via mtime " ;
check_and_get_package_value_list "spiderjsonoutput" "$arg" "$allowedval" "" ;;
--with-variant-shortcut=*|--without-variant-shortcut)
variantshortcut=$(get_package_value "$arg" "") ;;
--with-editor=*|--without-editor)
Expand Down
18 changes: 18 additions & 0 deletions doc/source/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -887,6 +887,10 @@ The following command line switches appeared on Modules 5.

Starting Modules 5.6, :subcmd:`spider` sub-command is supported.

Starting Modules 5.8, this command line switch is accepted on JSON output
mode and the *mtime* element is added to report the modification time of
modulefiles in JSON output.

:option:`--force`

Starting Modules 5.4, this command line switch by-passes *abort on error*
Expand Down Expand Up @@ -914,6 +918,13 @@ The following command line switches appeared on Modules 5.

Starting Modules 5.6, :subcmd:`spider` sub-command is supported.

:option:`--json`

Starting Modules 5.8, content of :subcmd:`avail`, :subcmd:`list` and
:subcmd:`spider` JSON output is defined by the :mconfig:`avail_json_output`,
:mconfig:`list_json_output` and :mconfig:`spider_json_output` configuration
options and the :option:`--output` command line switch is accepted.

:option:`--terse`

Starting Modules 5.8, :subcmd:`search` and :subcmd:`whatis` sub-commands are
Expand Down Expand Up @@ -1133,6 +1144,10 @@ The following environment variables appeared on Modules 5.
| | :envvar:`MODULES_MODULEPATH_IGNORE`, |
| | :envvar:`MODULES_IGNORE_CACHE_SUBCMDS` |
+------------+-----------------------------------------------------------------+
| 5.8 | :envvar:`MODULES_AVAIL_JSON_OUTPUT`, |
| | :envvar:`MODULES_LIST_JSON_OUTPUT`, |
| | :envvar:`MODULES_SPIDER_JSON_OUTPUT` |
+------------+-----------------------------------------------------------------+

Modules Specific Tcl Commands
"""""""""""""""""""""""""""""
Expand Down Expand Up @@ -1355,6 +1370,9 @@ The following Modules configuration option has been introduced on Modules 5.
| | :mconfig:`domainname`, :mconfig:`modulepath_ignore`, |
| | :mconfig:`ignore_cache_subcmds` |
+------------+-----------------------------------------------------------------+
| 5.8 | :mconfig:`avail_json_output`, :mconfig:`list_json_output`, |
| | :mconfig:`spider_json_output` |
+------------+-----------------------------------------------------------------+

:mconfig:`auto_handling`

Expand Down
Loading
Loading