Commit Graph

13 Commits

Author SHA1 Message Date
Xavier Delaruelle
5b4831873e Args after var name are values on {append,prepend,remove}-path
Fix argument parsing for the `append-path`, `prepend-path` and
`remove-path` modulefile commands to consider every arguments found
after the variable name as variable values and not command option even
if argument starts with `-` character.

Fixes #278.
2019-06-28 21:42:58 +02:00
Xavier Delaruelle
84ed76fa4f Raise error when bad option passed to {append,prepend,remove}-path
Raise an error when an invalid option is set on append-path,
prepend-path or remove-path modulefile command.

Fixes #249.
2019-04-25 18:54:27 +02:00
Xavier Delaruelle
f2af9db133 Make remove-path alter ::env() on display/help/test/whatis modes
Like previously done for 'append-path', set the variable passed to
'remove-path' procedure in ::env() array to make accurate value
available for later use during the modulefile evaluation.

As a side effect as remove-path command is now evaluated on help, test,
display and whatis modes, invalid argument on this command will raise
error. Previously arguments were not parsed so no error raised.

Add 50-cmds/069-remove-env test to check this ::env() array change over
all evaluation mode. Adapt 50-cmds/350-allin to check this change
against 'whatis' mode.
2018-04-14 16:19: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
8c4b3b745d Pass multi paths in multi strs on {append,prepend,remove}-path
Enable append-path, prepend-path and remove-path to receive multiple
path value arguments.

Add some non-regression tests for modulefile or sub-command cases.

Update modulefile.4 and module.1 docs.

Closes #141
2017-12-19 06:53:50 +01:00
Xavier Delaruelle
f13fac6235 Pass multiple paths in 1 str on {append,prepend,remove}-path
Detect if path string passed to append-path, prepend-path or remove-path
commands is composed of multiple path entries (separated by specified or
default delimiter string). In this situation add/remove each path
separately to correctly update relative reference counter.

Add some non-regression tests for modulefile or sub-command cases.

Update modulefile.4 doc.

Closes #142
2017-12-17 16:20:52 +01:00
Xavier Delaruelle
09841ad704 Check env var name not empty for *-path commands 2017-12-15 07:24:07 +01:00
Xavier Delaruelle
ccf69b3144 Improve {append,prepend,remove}-path arg check
Detect missing environment variable name or value when calling
append-path, prepend-path or remove-path procedures. Raise error in this
situation.

Introduce a 'parsePathCommandArgs' to check args for the 3 *-path
commands.

Add non-regression tests in 050-cmds and 070-maint suites to check bad
argument situations.

Closes #139
2017-12-15 06:35:18 +01:00
Xavier Delaruelle
242061a2b8 testsuite: add 062-remove-delim tests in 50-cmds suite 2017-05-25 09:06:20 +02:00
Kent Mein
bd4a515a7d Moved things out of the tcl directory.
Kent
2013-01-10 15:48:30 -06:00
Kent Mein
76adb1c7e3 Removed all of the non tcl version stuff. Or most of it anyway.
Kent
2013-01-10 15:44:49 -06:00
rk
e816ab15b5 modules is a shell tool for setting-up the user environment on the
fly, as it were.  It's a powerful mechanism for dynamically changing
environment variables, aliases, X11 resources, etc.
It uses an embedded Tcl intrepretor, with a few extensions.  Therefore,
it has a well defined language syntax.
Version 3.1 is GPL, and includes many improvements over the 3.0beta.
2000-06-28 00:17:34 +00:00