From 2569ef79d5b94aabbcfb1dc6d5622e5f110503a2 Mon Sep 17 00:00:00 2001 From: simonLeary42 <71396965+simonLeary42@users.noreply.github.com> Date: Mon, 25 Nov 2024 12:57:53 -0500 Subject: [PATCH 1/3] update output format, document comment functionality --- docs/source/140_deprecating_modules.rst | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/source/140_deprecating_modules.rst b/docs/source/140_deprecating_modules.rst index db9cdfe99..9a72450a0 100644 --- a/docs/source/140_deprecating_modules.rst +++ b/docs/source/140_deprecating_modules.rst @@ -15,9 +15,13 @@ For example:: $ module load abc/1.2.3 + ----------------------------------------------------------------- + There are messages associated with the following module(s) : + ----------------------------------------------------------------- abc/1.2.3: This module is deprecated and will be removed from the system on June 19. Please load abc/2.3.4 instead. + ----------------------------------------------------------------- Note that this message is just text and in no way controls user access @@ -64,6 +68,8 @@ full path to a modulefile. If it doesn't then it is a moduleName/version string. Also, you can have several modulefiles use the same message by separating them with *|* +You can add comments with the `#` character. + You can use Lua regular expression to also match one or modules for both the full path to a module or the module fullname. Lua regular expressions are much less powerful (see @@ -87,7 +93,7 @@ names that have a '-' in their name requires % quoting. The message can be as many lines as you like. The message ends with a blank line. Below is an example:: - + # removed because ... gcc/2.95: This module is deprecated and will be removed from the system on Jan 1. 1999. Please switch to a newer compiler. From f3df6cf85b13265cf53a71b84c78d11494512664 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Mon, 25 Nov 2024 12:59:39 -0500 Subject: [PATCH 2/3] trim leading spaces --- src/utils.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.lua b/src/utils.lua index 0c314ea97..7a61a1a97 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -388,7 +388,8 @@ function readAdmin() for v in whole:split("\n") do repeat - v = v:gsub("%s+$","") + v = v:gsub("%s+$","") -- trim trailing spaces + v = v:gsub("^%s+", "") -- trim leading spaces if (v:sub(1,1) == "#") then -- ignore this comment line From 20771d00c6adfee0976c4b9c17db6489b965d968 Mon Sep 17 00:00:00 2001 From: Simon Leary Date: Mon, 25 Nov 2024 13:05:33 -0500 Subject: [PATCH 3/3] trim leading whitespace only for comment --- src/utils.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils.lua b/src/utils.lua index 7a61a1a97..b4e4848be 100644 --- a/src/utils.lua +++ b/src/utils.lua @@ -388,10 +388,9 @@ function readAdmin() for v in whole:split("\n") do repeat - v = v:gsub("%s+$","") -- trim trailing spaces - v = v:gsub("^%s+", "") -- trim leading spaces + v = v:gsub("%s+$","") - if (v:sub(1,1) == "#") then + if (v:gsub("^%s+", ""):sub(1,1) == "#") then -- ignore this comment line break