Skip to content

Commit d47e442

Browse files
committed
doc: describe JSON output configuration in MIGRATING
Add a v5.8 section to the migration guide to introduce the JSON output configuration options, the --output support on --json mode, the mtime element and the variant report on avail and spider JSON output. Assisted-by: Claude:claude-fable-5-1 Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
1 parent b656d40 commit d47e442

2 files changed

Lines changed: 61 additions & 0 deletions

File tree

‎.hunspell.en.dic‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,3 +1661,4 @@ otherargv
16611661
parseModuleCommandArgs
16621662
DDTHH
16631663
hhmm
1664+
22T21

‎MIGRATING.rst‎

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,66 @@ Modules. It provides an overview of the new features and changed behaviors
88
that will be encountered when upgrading.
99

1010

11+
v5.8
12+
----
13+
14+
This new version is backward-compatible with previous version 5 release. It
15+
fixes bugs but also introduces new functionalities that are described in this
16+
section. See the :ref:`5.8 release notes<5.8 release notes>` for a complete
17+
list of the changes between Modules v5.7 and v5.8.
18+
19+
Configuring JSON output content
20+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
21+
22+
The content of the JSON output of :subcmd:`avail`, :subcmd:`list` and
23+
:subcmd:`spider` sub-commands can now be configured, like their regular and
24+
terse outputs. The new :mconfig:`avail_json_output`,
25+
:mconfig:`list_json_output` and :mconfig:`spider_json_output` configuration
26+
options define the elements to report in the JSON document. An element
27+
corresponds either to a key of the module JSON objects (``sym``, ``tag``,
28+
``variant``, ``via``), to a kind of entry to include (``alias``,
29+
``provided-alias``, ``dirwsym``, ``hidden``) or to the grouping of modules by
30+
modulepath (``modulepath``). The :option:`--output`/:option:`-o` command line
31+
switch is now accepted on :option:`--json` output mode to change the reported
32+
content for one command execution.
33+
34+
By default, the same JSON document than previous versions is produced. When
35+
an element is not enabled, its key is omitted from the JSON objects. Without
36+
the ``modulepath`` element, the top-level JSON object is directly keyed by
37+
module names.
38+
39+
.. parsed-literal::
40+
41+
:ps:`$` module avail --json foo
42+
{"/path/to/modulefiles": {
43+
"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "symbols": [ "default" ], "tags": [], "pathname": "/path/to/modulefiles/foo/1.0", "via": []}
44+
}}
45+
:ps:`$` module avail --json -o sym foo
46+
{"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "symbols": [ "default" ], "pathname": "/path/to/modulefiles/foo/1.0"}}
47+
48+
The new ``mtime`` element, specific to JSON output mode, reports the
49+
modification time of each modulefile as an ISO 8601 string. It is not part
50+
of the default content as it requires to stat every modulefile when no module
51+
cache file is available.
52+
53+
.. parsed-literal::
54+
55+
:ps:`$` module config avail_json_output +mtime
56+
:ps:`$` module avail --json foo
57+
{"/path/to/modulefiles": {
58+
"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": []}
59+
}}
60+
61+
Variants are also reported on :subcmd:`avail` and :subcmd:`spider` JSON
62+
output when the ``variant`` or ``variantifspec`` element is enabled. The
63+
possible values of each variant are set as a JSON array.
64+
65+
.. parsed-literal::
66+
67+
:ps:`$` module avail --json -o variant foo
68+
{"foo/1.0": { "name": "foo/1.0", "type": "modulefile", "variants": { "arch": [ "x86_64", "arm64" ], "debug": [ "on", "off" ] }, "pathname": "/path/to/modulefiles/foo/1.0"}}
69+
70+
1171
v5.7
1272
----
1373

0 commit comments

Comments
 (0)