Output configuration¶
Configuration¶
Introduce options to define the content of the output:
avail_output: elements to report onavailsub-command regular modeavail_terse_output: elements to report onavailsub-command terse modelist_output: elements to report onlistsub-command regular modelist_terse_output: elements to report onlistsub-command terse mode
Specification¶
Output configuration is available
Output configuration is not available (but could be added later on)
Output configuration defines the content of the output not its format
These configurations are set by default with the elements reported by default
avail_output:modulepath:alias:dirwsym:sym:tag:keyavail_terse_output:modulepath:alias:dirwsym:sym:taglist_output:header:idx:sym:tag:keylist_terse_output:header
The above default value could be superseded:
with an environment variable, that can be set through the use of the
configsub-commandMODULES_AVAIL_OUTPUTto supersedeavail_outputdefault valueMODULES_AVAIL_TERSE_OUTPUTto supersedeavail_terse_outputdefault valueMODULES_LIST_OUTPUTto supersedelist_outputdefault valueMODULES_LIST_TERSE_OUTPUTto supersedelist_terse_outputdefault value
with the
-o/--outputcommand-line option- which applies to the current output mode defined
-o/--outputalso supersedes environment variable definition
Accepted elements in value lists are:
- For
availoptions: modulepath, alias, dirwsym, sym, tag, key - For
listoptions: header, idx, sym, tag, key
- For
If the
-o/--outputoptions are wronly specifiedAn error is raised and evaluation terminates
It may happen in the following situations
- No value set after the option
- Option set on unsupported module sub-command
- Element set in option value unsupported by module sub-command
- Elements set in option value not separated by colon character (
:) - Option set on unsupported output format (
--longor--json) - The above situations apply whether command is called from the terminal or within a modulefile
For all these new configuration options
- accepted value is a list of strings separated by colon character (
:) - order of elements in the list does not matter
- an empty string is a valid value (means only the modulefile name has to be reported)
- accepted value is a list of strings separated by colon character (
If the
MODULES_AVAIL_OUTPUT/MODULES_AVAIL_TERSE_OUTPUT/MODULES_LIST_OUTPUT/MODULES_LIST_TERSE_OUTPUTenv vars are wrongly specifiedTheir value is ignored
So the default value takes precedence, unless a
-o/--outputoption is specifiedValue in environment variable is wronly specified for instance in the following situations
- Element set in option value unsupported by module sub-command
- Elements set in option value not separated by colon character (
:)
avail_outputsupersedesavail_report_dir_symandavail_report_mfile_symconfigurationsEnabled
avail_report_dir_symcorresponds to addingdirsymvalue toavail_outputEnabled
avail_report_mfile_symcorresponds to addingsymvalue toavail_outputBoth
avail_report_dir_symandavail_report_mfile_symcould be removed safely as:- it was not possible to define them at configure time
- or change default value with an environment variable
Some output content cannot be controlled at the moment with the output options:
- Hidden modules is exclusively controlled by
--alloption to get these modules unveiled - Indepth/no-indepth output is exclusively controlled by
--no-indepth/--indepthand related configuration option
- Hidden modules is exclusively controlled by
When modulepath element is removed from an
avail-related option- all the modulefiles returned from all searched modulepaths are merged and sorted as a single set
- a module appearing in several modulepaths is only reported once
- tags or symbols applying to a lower priority module with same name are still reported
Output key¶
An output key is added to print a legend explaining the output
- Meaning of
()or<>is explained - Default version is colored specifically
- Every tag shortened to a defined abbreviation
- Every tag colored specifically
- Legend entries only concern elements that can be found in reported output
- Legend entries are not reported on JSON output mode
- Meaning of
Output key is enabled by default on
availandlistsub-command output- Key is reported at the end of the output
- No key section is reported if no element need to be described (no color, no symbol, no tag, etc)