Skip to content

Add output configuration for JSON output mode - #733

Open
xdelaruelle wants to merge 4 commits into
envmodules:mainfrom
xdelaruelle:issue615
Open

xdelaruelle wants to merge 4 commits into
envmodules:mainfrom
xdelaruelle:issue615

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

Introduce avail_json_output, list_json_output and spider_json_output configuration options to define the content of the JSON output of avail, list and spider sub-commands. Elements in these options select the keys reported in each module JSON object. The -o/--output command line switch is now accepted on --json mode to supersede them, with support of the + and - prefixes. Default value of these options can be set at installation time with the --with-avail-json-output, --with-list-json-output and --with-spider-json-output configure options.

Default values reproduce the JSON document produced so far, so existing JSON consumers are not affected unless configuration is changed. When an element is not enabled, its key is omitted from JSON objects. When modulepath element is removed, the top-level JSON object is directly keyed by module names.

A new mtime element, specific to JSON mode, reports the modification time of modulefiles as an ISO 8601 string (null if it cannot be fetched). It is not enabled by default as it requires to stat every modulefile when no module cache file is available.

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

The first commit extends the output configuration design notes to describe these choices, the second one introduces the JSON output configuration and the last one adds the mtime element.

Fixes #615

Extend the output configuration design to the --json mode of avail,
list and spider sub-commands, as a preparatory step to let users select
what is reported in JSON documents.

Introduce avail_json_output, list_json_output and spider_json_output
configuration options, which can be superseded through environment
variable or the -o/--output option. Their default value reproduces the
JSON document currently produced, so existing consumers are not
affected unless configuration is changed.

Define a new mtime element, specific to JSON mode, to report the
modification time of modulefiles. It is not enabled by default as it
requires to stat every modulefile when no module cache file is
available.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Introduce avail_json_output, list_json_output and spider_json_output
configuration options to define the content of the JSON output of
avail, list and spider sub-commands. Elements in these options select
the keys reported in each module JSON object. The -o/--output command
line switch is now accepted on --json mode to supersede them, with
support of the + and - prefixes. Default value of these options can be
set at installation time with the --with-avail-json-output,
--with-list-json-output and --with-spider-json-output configure options.

Default values reproduce the JSON document produced so far, so existing
JSON consumers are not affected unless configuration is changed. When
an element is not enabled, its key is omitted from JSON objects. When
modulepath element is removed, the top-level JSON object is directly
keyed by module names.

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

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
Add the mtime element, specific to JSON output mode, to the
avail_json_output, list_json_output and spider_json_output
configuration options. When enabled, an mtime key is set on each
modulefile JSON object with the modification time of the modulefile as
an ISO 8601 string (null if it cannot be fetched).

This element is not enabled by default as it requires to stat every
modulefile when no module cache file is available.

Fixes envmodules#615

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
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>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add date-stamp to json output

1 participant