From 2f5bee80e66cba62faeed6be4fb1c00e18400fcf Mon Sep 17 00:00:00 2001 From: Robert McLay Date: Thu, 2 Nov 2023 15:10:23 -0500 Subject: [PATCH] Issue #667: Starting work on allowing extensions to be displayed by ml -t av --- messageDir/en.lua | 93 ++++++++++++++++++++++++----------------------- rt/help/err.txt | 12 +++--- rt/i18n/err.txt | 5 ++- src/Hub.lua | 25 +++++++++++-- src/Options.lua | 7 ++++ 5 files changed, 86 insertions(+), 56 deletions(-) diff --git a/messageDir/en.lua b/messageDir/en.lua index d6772f7a3..e4e278451 100644 --- a/messageDir/en.lua +++ b/messageDir/en.lua @@ -409,52 +409,53 @@ MODULEPATH directory: "%{mpath}" has too many non-modulefiles (%{regularFn}). Pl -------------------------------------------------------------------------- -- module help strings -------------------------------------------------------------------------- - StickyM = "Module is Sticky, requires --force to unload or purge", - LoadedM = "Module is loaded", - ExplM = "Experimental", - TstM = "Testing", - ObsM = "Obsolete", - - help_hlp = "This help message", - style_hlp = "Site controlled avail style: %{styleA} (default: %{default})", - rt_hlp = "Lmod regression testing", - dbg_hlp = "Program tracing written to stderr", - dbg_hlp2 = "Program tracing written to stderr (where dbglvl is a number 1,2,3)", - pin_hlp = "When doing a restore use specified version, do not follow defaults", - avail_hlp = "List default modules only when used with avail", - quiet_hlp = "Do not print out warnings", - exprt_hlp = "Expert mode", - terse_hlp = "Write out in machine readable format for commands: list, avail, spider, savelist", - initL_hlp = "loading Lmod for first time in a user shell", - location_H = "Just print the file location when using show ", - latest_H = "Load latest (ignore default)", - cache_hlp = "Treat the cache file(s) as out-of-date", - novice_H = "Turn off expert and quiet flag", - raw_hlp = "Print modulefile in raw output when used with show", - width_hlp = "Use this as max term width", - v_hlp = "Print version info and quit", - rexp_hlp = "use regular expression match", - gitV_hlp = "Dump git version in a machine readable way and quit", - dumpV_hlp = "Dump version in a machine readable way and quit", - chkSyn_H = "Checking module command syntax: do not load", - config_H = "Report Lmod Configuration", - miniConfig_H = "Report Lmod Configuration differences", - jcnfig_H = "Report Lmod Configuration in json format", - MT_hlp = "Report Module Table State", - timer_hlp = "report run times", - force_hlp = "force removal of a sticky module or save an empty collection", - redirect_H= "Send the output of list, avail, spider to stdout (not stderr)", - nrdirect_H= "Force output of list, avail and spider to stderr", - hidden_H = "Avail and spider will report hidden modules", - spdrT_H = "a timeout for spider", - trace_T = "trace major changes such as loads", - nx_T = "Do not print extensions", - - Where = "\n Where:\n", - Inactive = "\nInactive Modules", - DefaultM = "Default Module", - HiddenM = "Hidden Module", - Extension = "Extension that is provided by another module", + StickyM = "Module is Sticky, requires --force to unload or purge", + LoadedM = "Module is loaded", + ExplM = "Experimental", + TstM = "Testing", + ObsM = "Obsolete", + + MT_hlp = "Report Module Table State", + avail_hlp = "List default modules only when used with avail", + cache_hlp = "Treat the cache file(s) as out-of-date", + chkSyn_H = "Checking module command syntax: do not load", + config_H = "Report Lmod Configuration", + dbg_hlp = "Program tracing written to stderr", + dbg_hlp2 = "Program tracing written to stderr (where dbglvl is a number 1,2,3)", + dumpV_hlp = "Dump version in a machine readable way and quit", + exprt_hlp = "Expert mode", + force_hlp = "force removal of a sticky module or save an empty collection", + gitV_hlp = "Dump git version in a machine readable way and quit", + help_hlp = "This help message", + hidden_H = "Avail and spider will report hidden modules", + initL_hlp = "loading Lmod for first time in a user shell", + jcnfig_H = "Report Lmod Configuration in json format", + latest_H = "Load latest (ignore default)", + location_H = "Just print the file location when using show ", + miniConfig_H = "Report Lmod Configuration differences", + novice_H = "Turn off expert and quiet flag", + nrdirect_H = "Force output of list, avail and spider to stderr", + nx_T = "Do not print extensions", + pin_hlp = "When doing a restore use specified version, do not follow defaults", + quiet_hlp = "Do not print out warnings", + raw_hlp = "Print modulefile in raw output when used with show", + redirect_H = "Send the output of list, avail, spider to stdout (not stderr)", + rexp_hlp = "use regular expression match", + rt_hlp = "Lmod regression testing", + spdrT_H = "a timeout for spider", + style_hlp = "Site controlled avail style: %{styleA} (default: %{default})", + terse_hlp = "Write out in machine readable format for commands: list, avail, spider, savelist", + terseShowExt_H = "report extensions when doing a terse avail", + timer_hlp = "report run times", + trace_T = "trace major changes such as loads", + v_hlp = "Print version info and quit", + width_hlp = "Use this as max term width", + + Where = "\n Where:\n", + Inactive = "\nInactive Modules", + DefaultM = "Default Module", + HiddenM = "Hidden Module", + Extension = "Extension that is provided by another module", avail = [==[If the avail list is too long consider trying: diff --git a/rt/help/err.txt b/rt/help/err.txt index ca54582be..b28f8d458 100644 --- a/rt/help/err.txt +++ b/rt/help/err.txt @@ -2,7 +2,7 @@ step 1 lua ProjectDIR/src/lmod.in.lua shell --regression_testing --version =========================== -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu =========================== step 2 @@ -45,6 +45,7 @@ Options: -T --trace --nx --no_extensions --loc --location Just print the file location when using show + --terse_show_extensions module [options] sub-command [args ...] Help sub-commands: help prints this message @@ -107,7 +108,7 @@ Lmod Web Sites SourceForge: https://lmod.sf.net TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod To report a bug please read https://lmod.readthedocs.io/en/latest/075_bug_reporting.html -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu =========================== step 3 @@ -150,6 +151,7 @@ Options: -T --trace --nx --no_extensions --loc --location Just print the file location when using show + --terse_show_extensions module [options] sub-command [args ...] Help sub-commands: help prints this message @@ -212,7 +214,7 @@ Lmod Web Sites SourceForge: https://lmod.sf.net TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod To report a bug please read https://lmod.readthedocs.io/en/latest/075_bug_reporting.html -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu =========================== step 4 @@ -232,7 +234,7 @@ Version 9 step 5 lua ProjectDIR/src/lmod.in.lua shell --regression_testing --config =========================== -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu Description Value Allow root to use Lmod (LMOD_ALLOW_ROOT_USE) yes @@ -410,7 +412,7 @@ propT = { step 6 lua ProjectDIR/src/lmod.in.lua shell --regression_testing --miniConfig =========================== -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu LMOD_PACKAGE_PATH D nil LMOD_SYSTEM_DEFAULT_MODULES D __unknown__ diff --git a/rt/i18n/err.txt b/rt/i18n/err.txt index 13946a88e..d81590aa9 100644 --- a/rt/i18n/err.txt +++ b/rt/i18n/err.txt @@ -2,7 +2,7 @@ step 1 lua ProjectDIR/src/lmod.in.lua shell --regression_testing --version =========================== -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu =========================== step 2 @@ -87,6 +87,7 @@ Options: -T --trace --nx --no_extensions --loc --location Just print the file location when using show + --terse_show_extensions module [options] sub-command [args ...] Sous-commandes d'aide : help affiche ce message @@ -149,5 +150,5 @@ Sites web de Lmod SourceForge: https://lmod.sf.net TACC Homepage: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod Pour rapporter un bogue, veuillez lire https://lmod.readthedocs.io/en/latest/075_bug_reporting.html -Modules based on Lua: Version 8.7.26 2023-06-07 18:16 -05:00 +Modules based on Lua: Version 8.7.32 2023-08-28 12:42 -05:00 by Robert McLay mclay@tacc.utexas.edu diff --git a/src/Hub.lua b/src/Hub.lua index d6f2d6061..ea5bfbfc6 100644 --- a/src/Hub.lua +++ b/src/Hub.lua @@ -975,7 +975,8 @@ function M.overview(self,argA) end availA = regroup_avail_blocks(availStyle, availA) - self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, aa) + local providedByT = false + self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, providedByT, aa) local label = "" local a = {} @@ -1056,7 +1057,7 @@ function M.overview(self,argA) return a end -function M.terse_avail(self, mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, a) +function M.terse_avail(self, mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, providedByT, a) dbg.start{"Hub:terse_avail()"} local mrc = MRC:singleton() local optionTbl = optionTbl() @@ -1110,6 +1111,14 @@ function M.terse_avail(self, mpathA, availA, alias2modT, searchA, showSN, defaul end end + -- if providedByT is not false then output + + if (providedByT and next(providedByT) ~= nil ) then + end + + + + dbg.fini("Hub:terse_avail") return a end @@ -1180,7 +1189,17 @@ function M.avail(self, argA) if (optionTbl.terse) then -------------------------------------------------- -- Terse output - self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, defaultOnly, defaultT, a) + local spiderT = false + local dbT = false + local mpathMapT = false + local providedByT = false + if (optionTbl.terseShowExtensions) then + local cache = Cache:singleton{buildCache=true} + spiderT,dbT, mpathMapT, providedByT = cache:build() + end + + self:terse_avail(mpathA, availA, alias2modT, searchA, showSN, + defaultOnly, defaultT, providedByT, a) dbg.fini("Hub:avail") return a diff --git a/src/Options.lua b/src/Options.lua index 5c045905d..8c2dc9589 100644 --- a/src/Options.lua +++ b/src/Options.lua @@ -364,6 +364,13 @@ function M.singleton(self, usage) default = 0.0 } + cmdlineParser:add_option{ + name = {"--terse_show_extensions"}, + dest = "terseShowExtensions", + action = "store_true", + help = i18n("terseShowExt"), + } + local optTbl, pargs = cmdlineParser:parse(arg) local optionTbl = optionTbl() optionTbl.pargs = pargs