-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modules aliases and symbols bash completion #500
Comments
If I load an alias (gcc in my example), is it possible to see it in In the completion, should I propose |
This minimal patch seems ok for aliases, thx Xavier for the tip:
Gonna try something not too heavy for symbols. |
This patch add bash completion for aliases and symbols:
I gonna open a PR with a more clean code. |
Good. It should also be fixed for other shells with completion script (tcsh, fish, zsh). I would suggest to create several PRs, with one to fix alias. |
Code should be adapted to only rely on shell syntax and The easiest solution is, I think, to introduce a new element in output configuration to report symbolic versions individually (rather along their relative modulefile). Otherwise code should be added for bash, tcsh, fish and zsh. See |
Something like the following patch, introducing the diff --git a/tcl/init.tcl.in b/tcl/init.tcl.in
index 0f16eb4c..032e761d 100644
--- a/tcl/init.tcl.in
+++ b/tcl/init.tcl.in
@@ -70,10 +70,10 @@ array set g_config_defs [list\
auto_handling {MODULES_AUTO_HANDLING @autohandling@ 0 b {0 1}}\
avail_indepth {MODULES_AVAIL_INDEPTH @availindepth@ 0 b {0 1}}\
avail_output {MODULES_AVAIL_OUTPUT {@availoutput@} 0 l {modulepath alias\
- dirwsym sym tag key variant variantifspec} {} {} eltlist}\
+ dirwsym indesym sym tag key variant variantifspec} {} {} eltlist}\
avail_terse_output {MODULES_AVAIL_TERSE_OUTPUT {@availterseoutput@} 0 l\
- {modulepath alias dirwsym sym tag key variant variantifspec} {} {}\
- eltlist}\
+ {modulepath alias dirwsym indesym sym tag key variant variantifspec} {}\
+ {} eltlist}\
cache_buffer_bytes {MODULES_CACHE_BUFFER_BYTES 32768 0 i {4096 1000000} {}\
{} intbe}\
cache_expiry_secs {MODULES_CACHE_EXPIRY_SECS 0 0 i {0 31536000} {} {}\
diff --git a/tcl/report.tcl.in b/tcl/report.tcl.in
index afa0613a..b9dc823c 100644
--- a/tcl/report.tcl.in
+++ b/tcl/report.tcl.in
@@ -1284,7 +1284,11 @@ proc reportModules {search_queries header hsgrkey hstyle show_mtime show_idx\
}
# elements to include in output
- set report_sym [isEltInReport sym]
+ if {[set report_indesym [isEltInReport indesym 0]]} {
+ set report_sym 0
+ } else {
+ set report_sym [isEltInReport sym]
+ }
set report_tag [isEltInReport tag]
set report_alias [isEltInReport alias]
# enable variant report if variantifspec configured and some variant is
@@ -1387,6 +1391,15 @@ proc reportModules {search_queries header hsgrkey hstyle show_mtime show_idx\
$himatchmap] disp dispsgr displen
}
}
+ version {
+ # report symbolic version independently from the module it is
+ # attached to. only done on regular or terse output when 'indesym'
+ # element is in relative output configuration option
+ if {$report_indesym} {
+ lassign [formatListEltToDisplay $elt sy {} {} {} 0 0 {} 0 {}\
+ {} 0 $himatchmap] disp dispsgr displen
+ }
+ }
}
if {$dispsgr ne {}} {
if {$json} {
@@ -1645,10 +1658,15 @@ proc displayElementList {header sgrkey hstyle one_per_line display_idx\
# Report an output key to help understand what the SGR used on this output
# correspond to
proc displayKey {} {
+ # specific key entry for symbolic version if reported independently
+ set typesym [list {symbolic-version}]
+ if {![isEltInReport indesym 0]} {
+ lappend typesym [sgr se (]<SGR>[sgr se )] 18
+ }
+
array set skipsgr [list hi 1 db 1 tr 1 se 1 er 1 wa 1 me 1 in 1 cm 1 va 1]
array set typesgr [list mp modulepath di [list directory <SGR>/ 10] al\
- module-alias sy [list {symbolic-version} [sgr se (]<SGR>[sgr se )] 18]\
- de [list {default-version}]]
+ module-alias sy $typesym de [list {default-version}]]
set display_list {}
set len_list {} I would like to fix this for 5.3.1, which I plan to release by the end of june (or beginning of july). Let me know if you plan to provide pull-request for these fixes in this timeframe. |
Looking more in depth into the |
Describe the bug
There is no bash completion for modules described by
module-alias
andmodule-version
.To Reproduce
Let's take these modules:
Location and content of any modulerc or modulefile involved:
Steps to reproduce the behavior (alias):
Steps to reproduce the behavior (symbols):
Expected behavior
Expected behavior for alias:
Expected behavior for symbols:
Modules version and configuration
The text was updated successfully, but these errors were encountered: