Skip to content

Commit

Permalink
Issue #690: Support for LMOD_TERSE_DECORATIONS added
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert McLay committed Sep 10, 2024
1 parent 959642d commit 180b393
Show file tree
Hide file tree
Showing 7 changed files with 123 additions and 80 deletions.
2 changes: 2 additions & 0 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ PREPEND_BLOCK := $(shell echo "@PREPEND_BLOCK@" | tr '[:upper:]' '[:
COLORIZE := $(shell echo "@COLORIZE@" | tr '[:upper:]' '[:lower:]')
SETTARG_CMD := settarg_cmd
MODULEPATH_INIT := @MODULEPATH_INIT@
LMOD_TERSE_DECORATIONS := @TERSE_DECORATIONS@
LMOD_AVAIL_EXTENSIONS := @AVAIL_EXTENSIONS@
LMOD_HIDDEN_ITALIC := @HIDDEN_ITALIC@
LMOD_OVERRIDE_LANG := @LMOD_OVERRIDE_LANG@
Expand Down Expand Up @@ -300,6 +301,7 @@ __installMe:
-e 's|@silence_shell_debugging@|$(SILENCE_SHELL_DEBUGGING)|g' \
-e 's|@dynamic_spider_cache@|$(DYNAMIC_SPIDER_CACHE)|g' \
-e 's|@fast_tcl_interp@|$(FAST_TCL_INTERP)|g' \
-e 's|@terse_decorations@|$(LMOD_TERSE_DECORATIONS)|g' \
-e 's|@settarg_cmd@|$(SETTARG_CMD)|g' \
-e 's|@lmod_config_dir@|$(LMOD_CONFIG_DIR)|g' \
-e 's|@lmod_downstream_conflicts@|$(LMOD_DOWNSTREAM_CONFLICTS)|g' \
Expand Down
1 change: 1 addition & 0 deletions aclocal.m4
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ echo "Use ~/.config/lmod directory only..........................." : $USE_DOT_C
echo "Display Extensions w/ module avail.........................." : $AVAIL_EXTENSIONS
echo "Dynamic Spider Cache support................................" : $DYNAMIC_SPIDER_CACHE
echo "Module Conflicts remembered................................." : $LMOD_DOWNSTREAM_CONFLICTS
echo "Allow terse listing to be decorated........................." : $TERSE_DECORATIONS
echo "Allow for extended default.(ml intel/17 #-> intel/17.0.4)..." : $EXTENDED_DEFAULT #"
Expand Down
14 changes: 14 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,20 @@ AC_ARG_WITH(cachedLoads,
CACHED_LOADS="$withval"
AC_DEFINE_UNQUOTED(CACHED_LOADS, "$withval"))dnl

AC_SUBST(TERSE_DECORATIONS)
AC_ARG_WITH(terseDecorations,
AS_HELP_STRING([--with-terseDecorations=ans],[Allow for terse listing to be decorated. [[yes]]]),
TERSE_DECORATIONS="$withval"
TERSE_DECORATIONS=`echo $TERSE_DECORATIONS | tr '@<:@:upper:@:>@' '@<:@:lower:@:>@'`
VALID_YN $TERSE_DECORATIONS "--with-terseDecorations=ans: ans must be yes or no"
AC_MSG_RESULT([TERSE_DECORATIONS=$with_terseDecorations])
AC_DEFINE_UNQUOTED(TERSE_DECORATIONS, "$with_terseDecorations")dnl
,
withval="yes"
AC_MSG_RESULT([TERSE_DECORATIONS=$withval])
TERSE_DECORATIONS="$withval"
AC_DEFINE_UNQUOTED(TERSE_DECORATIONS, "$withval"))dnl

AC_SUBST(EXTENDED_DEFAULT)
AC_ARG_WITH(extendedDefault,
AS_HELP_STRING([--with-extendedDefault=ans],[Allow for extended default. [[yes]]]),
Expand Down
6 changes: 6 additions & 0 deletions docs/source/090_configuring_lmod.rst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,12 @@ the configuration option which will set the action.
[string, default: <nil>, --with-syshost]. This variable can be used
to help with module tracking. See :ref:`tracking_usage` for details.

**LMOD_TERSE_DECORATIONS**:
[yes/no, default: yes, --with-terseDecorations]. Terse listing from
**module --terse list**, **module --terse avail** and
**module --terse spider** include decorations. Set this variable to
no to prevent this output.

**LMOD_TMOD_FIND_FIRST**:
[yes/no, default: no, --with-tmodFindFirst]. Normally Lmod uses the
FIND BEST rule to search for defaults when searching C/N/V or N/V
Expand Down
146 changes: 74 additions & 72 deletions src/Configuration.lua

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions src/myGlobals.lua
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ cosmic:init{name = "LMOD_CONFIG_DIR",
sedV = "@lmod_config_dir@",
default = "/etc/lmod"}

------------------------------------------------------------------------
-- LMOD_TERSE_DECORATIONS: Allow terse listing to be decorated
------------------------------------------------------------------------
cosmic:init{name = "LMOD_TERSE_DECORATIONS",
sedV = "@terse_decorations@",
default = "yes"}

------------------------------------------------------------------------
-- LMOD_PACKAGE_PATH: Colon separated list of directories to search for
-- SitePackage.lua
Expand Down
27 changes: 19 additions & 8 deletions src/utils.lua
Original file line number Diff line number Diff line change
Expand Up @@ -870,15 +870,26 @@ function decorateModule(name, resultT, forbiddenT)
s_decoyT = {
forbiddenState = "normal"
}
s_decorateT = {
normal = "",
hidden = " <H>",
soft = " <H>",
forbid = " <F>",
nearly = " <NF>",
}
local decorate = cosmic:value("LMOD_TERSE_DECORATIONS")
if (decorate == "yes") then
s_decorateT = {
normal = "",
hidden = " <H>",
soft = " <H>",
forbid = " <F>",
nearly = " <NF>",
}
else
s_decorateT = {
normal = "",
hidden = "",
soft = "",
forbid = "",
nearly = "",
}
end
end

local fT = forbiddenT
if (not forbiddenT or next(forbiddenT) == nil) then
fT = s_decoyT
Expand Down

0 comments on commit 180b393

Please sign in to comment.