Skip to content

Commit

Permalink
init: fix completion to report syms and aliases
Browse files Browse the repository at this point in the history
Fix completion scripts (bash, tcsh, fish and zsh) to report symbolic
versions and aliases among available modules.

Fixes #500.
  • Loading branch information
xdelaruelle committed Jun 27, 2023
1 parent 1b0c06a commit 2dfb619
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions .hunspell.en.dic
Original file line number Diff line number Diff line change
Expand Up @@ -1139,3 +1139,4 @@ othervariant
bitwise
modpath
indesym
syms
2 changes: 2 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ Modules 5.3.1 (not yet released)
:mconfig:`avail_output` and :mconfig:`avail_terse_output` configuration
options. When set, symbolic versions are reported as independent elements
rather along the module or directory they are attached to.
* Init: fix completion scripts to report module symbolic versions and aliases
among available modules. (fix issue #500)

.. _Hunspell: https://hunspell.github.io/

Expand Down
2 changes: 1 addition & 1 deletion init/bash_completion.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ _module_avail() {
local cur="${1:-}"
# skip avail call if word currently being completed is an option keyword
if [ -z "$cur" ] || [ "${cur:0:1}" != '-' ]; then
module avail --color=never -s -t -S --no-indepth -o '' "$cur" 2>&1
module avail --color=never -s -t -S --no-indepth -o 'alias:indesym' "$cur" 2>&1
fi
}

Expand Down
2 changes: 1 addition & 1 deletion init/fish_completion
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function __fish_module_use_config --description 'Test if module command should h
return 1
end

complete -c module -n '__fish_module_use_avail' -f -a "(module avail --color=never -s -t -S --no-indepth -o '' (commandline -ct) 2>&1)"
complete -c module -n '__fish_module_use_avail' -f -a "(module avail --color=never -s -t -S --no-indepth -o 'alias:indesym' (commandline -ct) 2>&1)"
complete -c module -n '__fish_module_use_list' -f -a "(module list --color=never -s -t -o '' 2>&1)"
complete -c module -n '__fish_module_use_initlist' -f -a "(module initlist --color=never -s 2>&1 | sed '\
/ loads modules:\$/d;')"
Expand Down
2 changes: 1 addition & 1 deletion init/tcsh_completion.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#

alias _module_avail '\\
@TCLSH@ "@libexecdir@/modulecmd.tcl" tcsh avail --color=never -s -t -S -o "" |& cat'
@TCLSH@ "@libexecdir@/modulecmd.tcl" tcsh avail --color=never -s -t -S -o "alias:indesym" |& cat'

alias _module_loaded '\\
@TCLSH@ "@libexecdir@/modulecmd.tcl" tcsh list --color=never -s -t -o "" |& cat'
Expand Down
2 changes: 1 addition & 1 deletion init/zsh-functions/_module.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ _module_avail() {
local cur="${1:-}";
# skip avail call if word currently being completed is an option keyword
if [ -z "$cur" -o "${cur:0:1}" != '-' ]; then
module avail --color=never -s -t -S --no-indepth -o '' $cur 2>&1
module avail --color=never -s -t -S --no-indepth -o 'alias:indesym' $cur 2>&1
fi
}

Expand Down

0 comments on commit 2dfb619

Please sign in to comment.