Commit Graph

55 Commits

Author SHA1 Message Date
Xavier Delaruelle
bc1373dffc init: add -T/--trace options to completion scripts 2020-06-01 21:02:32 +02:00
Xavier Delaruelle
9d5517d202 init: fix dup apropos/keyword/search in bash comp
apropos, keyword and search sub-commands now accept arguments so they
need to be removed from empty-or-wide-argument-command list
2020-06-01 20:59:50 +02:00
Xavier Delaruelle
80e7033ba2 init: add 'sh-to-mod' sub-cmd to shell comp scripts 2020-06-01 20:59:50 +02:00
Adrien Cotte
ad82a9125f bash_completion: fix ml no space between -modules 2020-04-04 16:54:38 +02:00
Xavier Delaruelle
05451a831f init: define ml completion only if ml command defined 2020-03-14 10:41:03 +01:00
Adrien Cotte
f16c0d8a0f init: add 'ml' command support in bash completion 2020-03-14 10:41:03 +01:00
Xavier Delaruelle
37b46a3778 init: use 'sed -r' if 'sed -E' not supported
`-E` option is a *relatively* recent option of GNU sed (v4.2), yet
mandatory for OS portability (as detailled in b68e44e).

Adapt configure step to detect if sed option `-E` is supported and
fallback to `-r` otherwise.

Fixes #317
2020-02-22 13:04:04 +01:00
Xavier Delaruelle
5aac870aa5 init: fix bash completion script for Bash <4.0
`compopt` Bash builtin has been introduced in Bash 4.0, so using it on
Bash <4.0 prints error messages. To fix this, `comptopt` availability is
checked prior usage. If not available, the no-space-append behavior will
not be obtained which will not be an optimal situation if the
`no-indepth` mode is set for the `avail` sub-command.

Fixes #318
2020-02-22 09:41:54 +01:00
Xavier Delaruelle
58212613ed init: add -j/--json options to completion scripts 2020-01-09 20:59:31 +01:00
Xavier Delaruelle
9f189c7d5e Introduce ml configuration option
Add the ability to control whether or not a ``ml`` command should be
defined at Modules initialization time. `ml` is a handy frontend to the
module command: it reduces the number of characters to type to trigger
module.

Enablement is managed throught a new configuration option named `ml`
(which defines `MODULES_ML` environment variable when set). It may be
enabled by default in `modulecmd.tcl` script with option `--enable-ml`
passed to `./configure` script.
2020-01-09 20:38:50 +01:00
Xavier Delaruelle
d5126ae296 init: fix missing -i/--icase in completion scripts 2019-11-14 20:22:45 +01:00
Xavier Delaruelle
a386dbb67c Introduce home configuration option
Make MODULESHOME environment variable controllable through the `config`
sub-command with `home` configuration option. A `--with-moduleshome`
argument is also added to the ./configure script to set specific default
value for this option at installation time.

Fixes #292
2019-11-14 20:22:45 +01:00
Xavier Delaruelle
07bbbc7a9d Introduce advanced_version_spec configuration option
Add the advanced_version_spec configuration option that will control the
activation of advanced module version specifier syntax.
2019-11-14 20:20:40 +01:00
Xavier Delaruelle
e67088275e Introduce extended_default configuration option
Add the ability to select a module when its version is partially
specified. Enable this behavior through a new configuration option named
`extended_default` (which defines `MODULES_EXTENDED_DEFAULT` environment
variable when set).

When extended_default mechanism is enabled a module version may be
specified by its starting portion, part separated from the rest of the
version string by a `.` or `-` character.

When multiple versions match partial version specified and only one
module should be returned, default version (implicit or explicit) among
matches is returned. In case `implicit_default` is disabled and no
explicit default is found among matches, an error is returned.

Mechanism may be enabled by default in `modulecmd.tcl` script with
option `--enable-extended-default` passed to `./configure` script.
2019-11-11 09:13:50 +01:00
Xavier Delaruelle
35ba37b76a init: add 'icase' option to completion scripts 2019-11-11 09:00:03 +01:00
Xavier Delaruelle
58b8f73dee Workaround for Tcsh history issue with wa_277 conf opt
Introduce the wa_277 configuration option to workaround an issue with Tcsh
history described on ticket #277.

When option is enabled (which sets the MODULES_WA_277 environment variable
to 1), an alternative module alias is defined which fixes the history
mechanism issue. However the alternative definition of the module alias
weakens shell evaluation of the code produced by modulefiles. Characters
with special meaning for Tcsh shell (like { and }) may not be used
anymore in shell alias definition elsewhere the evaluation of the code
produced by modulefiles will return a syntax error.

Fixes #277.
2019-09-16 20:34:51 +02:00
Xavier Delaruelle
0bd67dd218 Reintroduce 'verbose' verbosity level
Reintroduce the ``verbose`` verbosity level and associated ``--verbose``
and ``-v`` command-line switches, which were available on Modules v3.
Verbose mode adds additional informational messages, like a systematic
report of the loading or unloading module evaluations. The ``module``
command could be set verbose by default at ``./configure`` time with
``--with-verbosity`` option. ``MODULES_VERBOSITY`` environment
variable supersedes this setting and it could be set with ``config``
module sub-command through the ``verbosity`` option.
2019-07-23 09:50:42 +02:00
Xavier Delaruelle
9fb7fdecfd Reintroduce 'silent' verbosity level
Reintroduce the ``silent`` verbosity level and associated ``--silent``
and ``-s`` command-line switches, which were available on Modules v3.
Silent mode turns off error, warning and informational messages. The
``module`` command could be set silent by default at ``./configure``
time with ``--with-verbosity`` option. ``MODULES_VERBOSITY`` environment
variable supersedes this setting and it could be set with ``config``
module sub-command through the ``verbosity`` option.
2019-07-23 09:50:42 +02:00
Xavier Delaruelle
7e8006942d Add ability to control message verbosity
Add a ``verbosity`` configuration option to define the default message
verbosity level (between a ``normal`` and a ``debug`` level). This
option could be set at ``./configure`` time with ``--with-verbosity``
option. It could be superseded with the ``MODULES_VERBOSITY``
environment variable, that could be set with ``config`` module
sub-command through the ``verbosity`` option.

Defining a ``debug`` verbosity level at the command-line level is still
achieved by using the ``-D`` or ``--debug`` command-line switches.
2019-07-23 09:50:42 +02:00
Xavier Delaruelle
d09153f317 Add ability to disable shell startup file set
Introduce the ability not to set the shell startup file that ensure
``module`` command is defined once shell has been initialized. Setting
shell startup file currently means defining ``ENV`` and ``BASH_ENV``
environment variable to the Modules bourne shell initialization script.
``./configure`` options ``--enable-set-shell-startup`` and
``--disable-set-shell-startup`` define if shell startup should be set or
not by default. It could be superseded with the
``MODULES_SET_SHELL_STARTUP`` environment variable, that could be set
with ``config`` module sub-command through the ``set_shell_startup``
option.
2019-07-04 20:09:22 +02:00
Xavier Delaruelle
3ba2851767 Add ability to control module search match
Introduce the ability to control the module search match. Search query
string should match module name start or any part of module fully
qualified name. Default search match behavior is set at ``./configure``
time with the ``--with-search-match`` option. It could be superseded
with the ``MODULES_SEARCH_MATCH`` environment variable, that could be
set with ``config`` module sub-command through the ``search_match``
option. Command-line switches ``--starts-with`` (``-S``) and
``--contains`` (``-C``) for ``avail`` module sub-command enable to
supersede defined search match configuration.
2019-07-02 05:39:15 +02:00
Xavier Delaruelle
1a52463b96 install: replaces --enable-extra-siteconfig with --with-locked-configs
Add to the configure script the --with-locked-configs option to ignore
environment variable superseding of Modules configurations defined in
modulecmd.tcl script. Lockable configuration option are extra_siteconfig.
Currently locked options are reported through the locked_configs option
on the config sub-command.

This new configure option replces --enable-extra-siteconfig which was
dedicated to the control over the MODULES_SITECONFIG variable.
2019-06-08 08:04:49 +02:00
Xavier Delaruelle
51c56f66ee Control whether an implicit default should be selected
Add the ability to configure whether an implicit default version should
be defined for modules with no default version explicitly defined. When
enabled, which stays the default behavior, a module version is
automatically selected (latest one) when the generic name of the module
is passed. When implicit default selection is disabled, the name of
modules to evaluate should be fully qualified elsewhere an error is
returned. This option is set at `./configure` time with the
`--enable-implicit-default` and `--disable-implicit-default` options. It
could be superseded with the `MODULES_IMPLICIT_DEFAULT` environment
variable, that could be set with `config` module sub-command throught the
`implicit_default` option.

When implicit_default is disabled:
- module implicit default versions are excluded from 'module avail -d'
  results.
- false is returned when argument passed to the 'is-avail' sub-command
  is a directory without an explicit default set in it.
- and auto_handling is enabled, the requirement load mechanism will fail
  on requirement relying on module implicit default version

Fixes #179.
2019-06-03 08:14:59 +02:00
Xavier Delaruelle
b66a6e25ac Add the ability to configure of unload match order
Add the ability to configure when unloading a module and multiple loaded
modules match request if firstly loaded module should be choosen or
lastly loaded module. Default behavior is set at the `./configure` time
with the `--with-unload-match-order` switch. This default could be
superseded with the `MODULES_UNLOAD_MATCH_ORDER` environment variable,
that could be set with `config` module sub-command throught the
`unload_match_order` option.

This change allows to restore behavior of Modules compatibility version
where first matching module in loaded module list were unloaded in such
situation.

By default, lastly loaded module is set for unload (like it was
before this change) to limit impact on the loaded module list when
dependencies are woven between these loaded modules.

Even if this change enables to change the default behavior, it is highly
recommanded to keep it as soon your modulefiles express dependencies
between each other.

Fixes #198.
2019-05-26 07:33:07 +02:00
Xavier Delaruelle
8f8b74398a Add ability to disallow MODULES_SITECONFIG
Add to the configure script the `--enable-extra-siteconfig` and
`--disable-extra-siteconfig` options to allow or forbid the definition
of a site-specific configuration script controlled with the
`MODULES_SITECONFIG` environment variable.

These options control the default value of the `g_extrasiteconfig`
variable in `modulecmd.tcl`. If this variable is true (by default),
MODULES_SITECONFIG is looked at the siteconfig sourcing time. Thus the
primary siteconfig.tcl can set the variable to false to ensure the
extra siteconfig is disabled whatever the option passed at ./configure
time.
2019-05-20 20:36:56 +02:00
Xavier Delaruelle
5826bb20e8 Report and set 'extra_siteconfig' on 'config' sub-command
Report and be able to set the 'extra_siteconfig' configuration, linked
to the MODULES_SITECONFIG environment variable, on the 'config'
sub-command.
2019-05-19 10:46:35 +02:00
Xavier Delaruelle
d3527425fd Report and set 'rcfile' on 'config' sub-command
Report and be able to set the 'rcfile' configuration, linked to the
MODULERCFILE environment variable, on the 'config' sub-command.
2019-05-15 20:50:30 +02:00
Xavier Delaruelle
43b2760353 init: add 'config' sub-cmd to shell comp scripts 2019-05-15 20:50:29 +02:00
Xavier Delaruelle
afa789fe62 Leverage --force cmd-line switch on 'clear' sub-cmd
Leverage --force command-line switch on 'clear' sub-command to skip
confirmation dialog.

Fixes #268.
2019-05-08 10:59:34 +02:00
Xavier Delaruelle
ddbdef78ad Re-introduce 'clear' sub-command
With same behavior than on compatibility version. The list of the
environmet variables that are cleared by this sub-command has been
updated to match the recent development (MODULES_LMPREREQ, ...)

Fixes #203.
2019-05-03 14:01:34 +02:00
Xavier Delaruelle
1c1e4aa21a init: add --color opt to bash/fish/tcsh/zsh comp scripts
Add both the --color and --color= forms of the colorize output
command-line switch to the shell completion scripts.
2019-05-03 14:01:22 +02:00
Xavier Delaruelle
54c4698e56 init: run module in --color=never mode in shell comp scripts
Ensure color mode is disabled when calling module command in the bash,
fish, tcsh and zsh completion scripts.
2019-05-03 14:01:22 +02:00
Xavier Delaruelle
1317ca8e12 init: bash completes avail mods in no in depth mode
Take advantage of the no in depth mode of the module avail command to
only get available choices for the current query file depth level.
2019-05-03 14:00:29 +02:00
Xavier Delaruelle
849d4ef318 init: add support for --indepth/--no-indepth avail opts 2019-05-03 14:00:29 +02:00
Xavier Delaruelle
ca19609ff8 init: fix unload/switch cmd completion on bash 2018-10-25 09:53:41 +02:00
Xavier Delaruelle
8defb257f0 init: fix saved coll listing in bash/zsh/tcsh/fish completions
When no collection is currently found.
2018-10-20 15:51:13 +02:00
Xavier Delaruelle
9c5dd88edd Support 'remove' as an alias on 'unload' command
As compatibility version does

Fixes #200
2018-10-15 07:21:27 +02:00
Xavier Delaruelle
b0c7bf891d Support 'del' as an alias on 'unload' command
Like compatibility version does.

Fixes #200
2018-10-15 07:21:09 +02:00
Xavier Delaruelle
a199915dc7 By-pass conflict/prereq issue with -f/--force cmd-line switches
Add -f/--force command-line switches to by-pass dependency consistency
in case of
* load of a module conflicting with another loaded module
* load of a module where its declared requirements cannot be loaded
* unload of a module required by other loaded module

These options are only useful for the load, unload and switch module
sub-commands.

When a dependency is actually by-passed, still produce a warning message
to help user learn that something has effectively been forced. Warning
messages will be improved later-on to let user better understand what
happens

Update shell completion scripts.
2018-07-22 08:22:16 +02:00
Xavier Delaruelle
a8017d8f0c init: add pager opts in shell completion scripts 2018-07-22 08:22:16 +02:00
Xavier Delaruelle
d272b4abc8 Add --auto/--no-auto command-line switches
Add the ability to control from the command-line whether the auto_hanling
mode should be enabled or disabled.

Command-line option override auto_handling enablement value set with
MODULES_AUTO_HANDLING environment variable or set at configure time.

Update tests and shell completion scripts.
2018-07-22 08:22:16 +02:00
Xavier Delaruelle
b68e44ef7c init: enable ERE on sed with '-E' argument rather '-r'
When enabling Extended Regular Expression (ERE) on sed command, use the
'-E' argument (rather '-r') for compatibility with OS X's and BSDs' sed.

'sed -E' is used in bash and zsh completion scripts. ERE are required to
interpret alternation character '|'.

Fixes #178
2018-07-13 09:22:52 +02:00
Xavier Delaruelle
3fcc9b46e7 Add --index opt to remove-path
Remove path entry in environment variable by passing an index rather a
string. String at specified index in content list is removed if coherent
with relative reference counter.
2017-12-21 05:43:13 +01:00
Xavier Delaruelle
b2105b8834 Introduce --duplicates opt to {append,prepend}-path
Let the possibility to append or prepend path element entry to a
variable even if this entry is already registered into the variable
which introduces duplicates element within the variable value.

Entries are added with eventual duplication by the use of the
--duplicate option on append-path and prepend-path commands. These
additions increment the reference counter as usual.

Removal of duplicated path entry depends on the reference counter value.
Entries are not removed unless reference counter value is lesser than
the number of duplicated entries.
2017-12-19 21:34:52 +01:00
Xavier Delaruelle
a481df0ecb Introduce 'info-loaded' as module sub-command
Like for 'is-loaded', register 'module-info loaded' modulefile Tcl
command as a module sub-command to make it reachable from the command
line. Sub-command is named 'info-loaded' for sake of efficiency (not
'module-info-loaded').

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'info-loaded' command argument error in 071-args tests of 00-init
suite. Test 'module info-loaded' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 156-info-loaded tests in
70-maint suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.

Closes #3
2017-12-01 08:07:39 +01:00
Xavier Delaruelle
a4929a13b9 Introduce 'is-avail' as module sub-command
Like for 'append-path', register 'is-avail' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-avail' command argument error in 071-args tests of 00-init
suite. Test 'module is-avail' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 155-is-avail tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-28 20:56:45 +01:00
Xavier Delaruelle
0cff43a864 Introduce 'is-used' as module sub-command
Like for 'append-path', register 'is-used' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-used' command argument error in 071-args tests of 00-init
suite. Test 'module is-used' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 154-is-used tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-28 07:26:56 +01:00
Xavier Delaruelle
1b468822ed Introduce 'is-saved' as module sub-command
Like for 'append-path', register 'is-saved' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-saved' command argument error in 071-args tests of 00-init
suite. Test 'module is-saved' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 154-is-saved tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-28 07:26:39 +01:00
Xavier Delaruelle
100d9223b1 Introduce 'is-loaded' as module sub-command
Like for 'append-path', register 'is-loaded' modulefile Tcl command as a
module sub-command to make it reachable from the command line.

Improve 'cmdModuleResurface' procedure to set a global 'g_return_false'
flag when 'is-loaded' command returns 0. If 'g_return_false' flag is set
shell code rendering will end with a false value returned.

Add the new command to the existing shell completion scripts (bash, tcsh
fish, zsh).

Document new command in the module.1 man page.

Check 'is-loaded' command argument error in 071-args tests of 00-init
suite. Test 'module is-loaded' cannot be called from a modulefile with
151-module-onlytop in 50-cmds suite. Add 153-is-loaded tests in 70-maint
suite to validate new sub-command.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.

Closes #116
2017-11-26 16:01:57 +01:00
Xavier Delaruelle
62334ed0f7 Improve new {append,prepend,remove}-path commands
Refactor code to call from the module command line modulefile-specific
commands. These commands can only be called from the command line, not
when calling 'module' procedure from a modulefile, to avoid any
ambiguity.

When parsing command line arguments, check context to know if '-d' means
'--default' (avail command) or '--delim' (*-path commands).

Add the new commands to the existing shell completion scripts (bash,
tcsh, fish, zsh).

Document new commands in the module.1 man page.

Acknowledgment: this development has been made and funded within the
framework of the PRACE Fifth Implementation Phase (PRACE-5IP) project
(http://www.prace-ri.eu/). PRACE-5IP receives funding from the EU's
Horizon 2020 research and innovation programme (2014-2020) under grant
agreement no. 730913.
2017-11-26 10:40:29 +01:00