mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-07-05 21:30:49 +02:00
Merge branch '415-modulecmd-reverse-sort-output-of-avail-and-search-only-if-pattern-is-the-empty-string' into 'master'
Resolve "modulecmd: reverse sort output of avail and search only if pattern is the empty string" Closes #415 See merge request Pmodules/src!447
This commit is contained in:
@@ -1241,9 +1241,9 @@ get_available_modules() {
|
||||
fpattern=".*/${pattern}[^/]*/*[^/]+"
|
||||
fi
|
||||
local -- opt_regex='-regex'
|
||||
if [[ "${mode}" != 'load' ]]; then
|
||||
opt_regex='-iregex'
|
||||
fi
|
||||
[[ "${mode}" != 'load' ]] && opt_regex='-iregex'
|
||||
local -- opt_sort='-r'
|
||||
[[ -z ${pattern} ]] && opt_sort=''
|
||||
|
||||
local -- dir=''
|
||||
# loop over all entries in given module path
|
||||
@@ -1330,7 +1330,7 @@ get_available_modules() {
|
||||
-regextype posix-basic \) \
|
||||
\( -type f -o -type l \) \
|
||||
-printf "%P\n" \
|
||||
| ${sort} -r --version-sort)
|
||||
| ${sort} ${opt_sort} --version-sort)
|
||||
done
|
||||
} # get_available_modules()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user