mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-07-03 20:30:51 +02:00
modulecmd: sub-cmd avail: group argument added
It's now possible to list available modules in certain groups only.
This commit is contained in:
@@ -917,18 +917,15 @@ subcommand_avail() {
|
||||
}
|
||||
local pattern=()
|
||||
local output_function='human_readable_output'
|
||||
local opt_all_groups='no'
|
||||
local opt_use_releases="${UsedReleases}"
|
||||
local -A opt_groups=()
|
||||
local val=''
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-H | --help )
|
||||
-H | --help | -\? )
|
||||
print_help "${subcommand}"
|
||||
;;
|
||||
-a | --all )
|
||||
opt_all_groups='yes'
|
||||
opt_use_releases="${PMODULES_DEFINED_RELEASES}"
|
||||
;;
|
||||
--all-releases )
|
||||
-a | --all | --all-releases )
|
||||
opt_use_releases="${PMODULES_DEFINED_RELEASES}"
|
||||
;;
|
||||
-h | --human )
|
||||
@@ -943,6 +940,15 @@ subcommand_avail() {
|
||||
-m | --machine )
|
||||
output_function='machine_output'
|
||||
;;
|
||||
-g | --group | --group=* )
|
||||
if [[ $1 == --group=* ]]; then
|
||||
val="${1/--group=}"
|
||||
else
|
||||
val="$2"
|
||||
shift
|
||||
fi
|
||||
opt_groups[${val}]=1
|
||||
;;
|
||||
-- | '' )
|
||||
;;
|
||||
* )
|
||||
@@ -960,6 +966,11 @@ subcommand_avail() {
|
||||
local string
|
||||
for string in "${pattern[@]}"; do
|
||||
for dir in "${modulepath[@]}"; do
|
||||
local group="${dir/${PMODULES_ROOT}\/}"
|
||||
group="${group%%/*}"
|
||||
if (( ${#opt_groups[@]} > 0 )) && [[ ! -v opt_groups[${group}] ]]; then
|
||||
continue
|
||||
fi
|
||||
get_available_modules \
|
||||
mods \
|
||||
"${string}" \
|
||||
|
||||
Reference in New Issue
Block a user