mirror of
https://github.com/Pmodules/Pmodules.git
synced 2026-06-24 16:47:58 +02:00
Merge branch '433-make-sure-that-local-variables-are-defined-as-local' into 'master'
Resolve "make sure that local variables are defined as local" Closes #433 See merge request Pmodules/src!465
This commit is contained in:
+25
-23
@@ -338,6 +338,7 @@ pbuild::prep() {
|
||||
)
|
||||
# return if neither a URL nor a file name given
|
||||
[[ -n "${fname}" ]] || return 0
|
||||
local -- dir=''
|
||||
for dir in "${dirs[@]}"; do
|
||||
if [[ -r "${dir}/${fname}" ]]; then
|
||||
ref_dir="${dir}"
|
||||
@@ -396,7 +397,7 @@ pbuild::prep() {
|
||||
local -ri idx="$2"
|
||||
local -r fname="${SOURCE_NAMES[i]}"
|
||||
if [[ -v SHASUMS[${fname}] ]]; then
|
||||
local hash_sum=''
|
||||
local -- hash_sum=''
|
||||
hash_sum=$(sha256sum "${src_dir}/${fname}" | awk '{print $1}')
|
||||
test "${hash_sum}" == "${SHASUMS[${fname}]}" || \
|
||||
std::die 42 \
|
||||
@@ -428,7 +429,7 @@ pbuild::prep() {
|
||||
}
|
||||
|
||||
patch_sources() {
|
||||
local _i=0
|
||||
local -i _i=0
|
||||
for ((_i = 0; _i < ${#PATCH_FILES[@]}; _i++)); do
|
||||
local -i strip=
|
||||
apply_patch \
|
||||
@@ -440,8 +441,7 @@ pbuild::prep() {
|
||||
|
||||
(( ${#SOURCE_URLS[@]} == 0 )) && return 0
|
||||
mkdir -p "${PMODULES_DISTFILESDIR}"
|
||||
local i=0
|
||||
|
||||
local -i i=0
|
||||
for ((i = 0; i < ${#SOURCE_URLS[@]}; i++)); do
|
||||
local -- src_dir=''
|
||||
local -i ec=0
|
||||
@@ -634,7 +634,7 @@ pbuild::post_compile() {
|
||||
:
|
||||
}
|
||||
pbuild::compile() {
|
||||
local v_save="$V"
|
||||
local -- v_save="$V"
|
||||
unset V
|
||||
(( JOBS == 0 )) && JOBS=$(_get_num_cores)
|
||||
${make} -j${JOBS} || \
|
||||
@@ -824,14 +824,14 @@ _build_module() {
|
||||
#
|
||||
build_dependency() {
|
||||
find_build_script(){
|
||||
local p=$1
|
||||
local script=''
|
||||
local -- p="$1"
|
||||
local -- script=''
|
||||
script=$(${find} "${BUILDBLOCK_DIR}/../.." \
|
||||
-path "*/$p/build")
|
||||
std::get_abspath "${script}"
|
||||
}
|
||||
|
||||
local -r m=$1
|
||||
local -r m="$1"
|
||||
std::debug "${m}: module not available"
|
||||
[[ ${dry_run} == yes ]] && \
|
||||
std::die 1 \
|
||||
@@ -862,7 +862,7 @@ _build_module() {
|
||||
shift
|
||||
done
|
||||
|
||||
local buildscript=''
|
||||
local -- buildscript=''
|
||||
buildscript=$(find_build_script "${m%/*}")
|
||||
[[ -x "${buildscript}" ]] || \
|
||||
std::die 1 \
|
||||
@@ -873,7 +873,7 @@ _build_module() {
|
||||
fi
|
||||
}
|
||||
|
||||
local m=''
|
||||
local -- m=''
|
||||
for m in "${with_modules[@]}"; do
|
||||
|
||||
# module name prefixes in dependency declarations:
|
||||
@@ -904,7 +904,7 @@ _build_module() {
|
||||
# from 'module avail' and the full version should be set
|
||||
# in the variants file, we look for the first exact
|
||||
# match.
|
||||
local release_of_dependency=''
|
||||
local -- release_of_dependency=''
|
||||
if ! pbuild::module_is_avail "$m" release_of_dependency; then
|
||||
build_dependency "$m"
|
||||
pbuild::module_is_avail "$m" release_of_dependency || \
|
||||
@@ -1131,7 +1131,7 @@ _build_module() {
|
||||
#
|
||||
find_modulefile() {
|
||||
local -n _modulefile="$1"
|
||||
local fname=''
|
||||
local -- fname=''
|
||||
for fname in "${VERSIONS[@]/#/modulefile-}" 'modulefile'; do
|
||||
if [[ -r "${BUILDBLOCK_DIR}/${fname}" ]]; then
|
||||
_modulefile="${BUILDBLOCK_DIR}/${fname}"
|
||||
@@ -1141,7 +1141,7 @@ _build_module() {
|
||||
[[ -n "${_modulefile}" ]]
|
||||
}
|
||||
[[ "${is_subpkg}" == 'yes' ]] && return 0
|
||||
local src=''
|
||||
local -- src=''
|
||||
if [[ -n "${ModuleConfig['modulefile']}" ]]; then
|
||||
src="${ModuleConfig['modulefile']}"
|
||||
elif ! find_modulefile src; then
|
||||
@@ -1169,8 +1169,8 @@ _build_module() {
|
||||
"%s " \
|
||||
"${module_name}/${module_version}:" \
|
||||
"writing run-time dependencies to ${fname} ..."
|
||||
local dep
|
||||
echo -n "" > "${fname}"
|
||||
local -- dep=''
|
||||
for dep in "$@"; do
|
||||
[[ -z $dep ]] && continue
|
||||
if [[ ! $dep == */* ]]; then
|
||||
@@ -1238,6 +1238,7 @@ _build_module() {
|
||||
echo "relstage: ${module_release}" > "${yaml_config_file}"
|
||||
if (( ${#Systems[@]} > 0 )); then
|
||||
echo -n "systems: [${Systems[0]}" >> "${yaml_config_file}"
|
||||
local -- system=''
|
||||
for system in "${Systems[@]:1}"; do
|
||||
echo -n ", ${system}" >> "${yaml_config_file}"
|
||||
done
|
||||
@@ -1295,13 +1296,13 @@ _build_module() {
|
||||
# was specified.
|
||||
#
|
||||
[[ "${is_subpkg}" == 'yes' ]] && return 0
|
||||
local ol=''
|
||||
local -- ol=''
|
||||
for ol in "${Overlays[@]}"; do
|
||||
[[ "${ol}" == "${ol_name}" ]] && continue
|
||||
[[ "${ol}" == 'base' ]] && continue
|
||||
local modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local dir="${modulefile_dir/${ol_modulefiles_root}/${modulefiles_root}}"
|
||||
local fname="${dir}/${module_version}"
|
||||
local -- modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local -- dir="${modulefile_dir/${ol_modulefiles_root}/${modulefiles_root}}"
|
||||
local -- fname="${dir}/${module_version}"
|
||||
if [[ -e "${fname}" ]]; then
|
||||
std::info "%s "\
|
||||
"${module_name}/${module_version}:" \
|
||||
@@ -1363,8 +1364,8 @@ _build_module() {
|
||||
# build module ${module_name}/${module_version}
|
||||
bm::compile_and_install() {
|
||||
build_target() {
|
||||
local dir="$1" # src or build directory, depends on target
|
||||
local target="$2" # prep, configure, compile or install
|
||||
local -- dir="$1" # src or build directory, depends on target
|
||||
local -- target="$2" # prep, configure, compile or install
|
||||
|
||||
if [[ -e "${BUILD_DIR}/.${target}" ]] && \
|
||||
[[ ${force_rebuild} == 'no' ]]; then
|
||||
@@ -1386,6 +1387,7 @@ _build_module() {
|
||||
"%s " \
|
||||
"${module_name}/${module_version}:" \
|
||||
"${target_info[${target}]} ..."
|
||||
local -- t=''
|
||||
for t in ${ModuleConfig[target_funcs:${target}]}; do
|
||||
# We cd into the dir before calling the function -
|
||||
# just to be sure we are in the right directory.
|
||||
@@ -1437,7 +1439,7 @@ _build_module() {
|
||||
"removing modulefile '${modulefile_name}' ..."
|
||||
[[ "${dry_run}" == 'no' ]] && ${rm} -vf "${modulefile_name}"
|
||||
fi
|
||||
local release_file="${modulefile_dir}/.release-${module_version}"
|
||||
local -- release_file="${modulefile_dir}/.release-${module_version}"
|
||||
if [[ -e "${release_file}" ]]; then
|
||||
std::info \
|
||||
"%s " \
|
||||
@@ -1565,8 +1567,8 @@ _build_module() {
|
||||
|
||||
# module name including path in hierarchy and version
|
||||
# (ex: 'gcc/6.1.0/openmpi/1.10.2' for openmpi compiled with gcc 6.1.0)
|
||||
local modulefile_dir=''
|
||||
local modulefile_name=''
|
||||
local -- modulefile_dir=''
|
||||
local -- modulefile_name=''
|
||||
|
||||
# the group must have been defined - otherwise we cannot continue
|
||||
[[ -n ${GROUP} ]] || \
|
||||
|
||||
@@ -55,8 +55,8 @@ compute_group_depth () {
|
||||
${mkdir} -p "${dir}" || \
|
||||
std::die 1 "Cannot create directory -- ${dir}"
|
||||
fi
|
||||
local group=${dir%/*}
|
||||
local group=${group##*/}
|
||||
local -- group=${dir%/*}
|
||||
local -- group=${group##*/}
|
||||
result=$(${find} "${dir}" -depth \( -type f -o -type l \) \
|
||||
-printf "%d" -quit 2>/dev/null)
|
||||
(( result-=2 )) || :
|
||||
@@ -74,10 +74,10 @@ scan_groups () {
|
||||
local -i depth=0
|
||||
for ol in "$@"; do
|
||||
[[ "${OverlayInfo[${ol}:layout]}" == 'Pmodules' ]] || continue
|
||||
local modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local dir=''
|
||||
local -- modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local -- dir=''
|
||||
for dir in "${modulefiles_root}"/*/"${__MODULEFILES_DIR__}"; do
|
||||
local group="${dir%/*}"
|
||||
local -- group="${dir%/*}"
|
||||
group="${group##*/}"
|
||||
if [[ ! -v GroupDepths[${group}] ]]; then
|
||||
compute_group_depth depth "${dir}"
|
||||
@@ -405,7 +405,7 @@ pm::read_config(){
|
||||
if [[ -z "${OverlayInfo[${ol_name}:modulefiles_root]}" ]]; then
|
||||
OverlayInfo[${ol_name}:modulefiles_root]=${OverlayInfo[${ol_name}:install_root]}
|
||||
fi
|
||||
local modulefiles_root=${OverlayInfo[${ol_name}:modulefiles_root]}
|
||||
local -- modulefiles_root=${OverlayInfo[${ol_name}:modulefiles_root]}
|
||||
Dir2OverlayMap[${modulefiles_root}]="${ol_name}"
|
||||
}
|
||||
|
||||
|
||||
+26
-25
@@ -90,7 +90,7 @@ std::version_compare () {
|
||||
IFS='.' read -r -a ver2 <<<"$2"
|
||||
|
||||
# fill empty fields in ver1 with zeros
|
||||
local i
|
||||
local -i i=0
|
||||
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++)); do
|
||||
ver1[i]=0
|
||||
done
|
||||
@@ -115,11 +115,11 @@ std::version_lt() {
|
||||
>=1: otherwise
|
||||
"
|
||||
if (( $# == 1 )); then
|
||||
local vers1="${V_PKG}"
|
||||
local vers2="$1"
|
||||
local -- vers1="${V_PKG}"
|
||||
local -- vers2="$1"
|
||||
else
|
||||
local vers1="$1"
|
||||
local vers2="$2"
|
||||
local -- vers1="$1"
|
||||
local -- vers2="$2"
|
||||
fi
|
||||
std::version_compare "${vers1}" "${vers2}"
|
||||
(( $? == 2 ))
|
||||
@@ -133,11 +133,11 @@ std::version_le() {
|
||||
>=1: otherwise
|
||||
"
|
||||
if (( $# == 1 )); then
|
||||
local vers1="${V_PKG}"
|
||||
local vers2="$1"
|
||||
local -- vers1="${V_PKG}"
|
||||
local -- vers2="$1"
|
||||
else
|
||||
local vers1="$1"
|
||||
local vers2="$2"
|
||||
local -- vers1="$1"
|
||||
local -- vers2="$2"
|
||||
fi
|
||||
std::version_compare "${vers1}" "${vers2}"
|
||||
local -i exit_code=$?
|
||||
@@ -152,11 +152,11 @@ std::version_gt() {
|
||||
>=1: otherwise
|
||||
"
|
||||
if (( $# == 1 )); then
|
||||
local vers1="${V_PKG}"
|
||||
local vers2="$1"
|
||||
local -- vers1="${V_PKG}"
|
||||
local -- vers2="$1"
|
||||
else
|
||||
local vers1="$1"
|
||||
local vers2="$2"
|
||||
local -- vers1="$1"
|
||||
local -- vers2="$2"
|
||||
fi
|
||||
std::version_compare "${vers1}" "${vers2}"
|
||||
(( $? == 1 ))
|
||||
@@ -173,11 +173,11 @@ std::version_ge() {
|
||||
"
|
||||
# - returns 0 if version numbers are equal
|
||||
if (( $# == 1 )); then
|
||||
local vers1="${V_PKG}"
|
||||
local vers2="$1"
|
||||
local -- vers1="${V_PKG}"
|
||||
local -- vers2="$1"
|
||||
else
|
||||
local vers1="$1"
|
||||
local vers2="$2"
|
||||
local -- vers1="$1"
|
||||
local -- vers2="$2"
|
||||
fi
|
||||
std::version_compare "${vers1}" "${vers2}"
|
||||
(( $? == 1 ))
|
||||
@@ -193,11 +193,11 @@ std::version_eq() {
|
||||
>=1 otherwise
|
||||
"
|
||||
if (( $# == 1 )); then
|
||||
local vers1="${V_PKG}"
|
||||
local vers2="$1"
|
||||
local -- vers1="${V_PKG}"
|
||||
local -- vers2="$1"
|
||||
else
|
||||
local vers1="$1"
|
||||
local vers2="$2"
|
||||
local -- vers1="$1"
|
||||
local -- vers2="$2"
|
||||
fi
|
||||
std::version_compare "${vers1}" "${vers2}"
|
||||
}
|
||||
@@ -260,7 +260,7 @@ fi
|
||||
#
|
||||
std::get_YN_answer() {
|
||||
local -r prompt="$1"
|
||||
local ans
|
||||
local -- ans
|
||||
read -r -p "${prompt}" ans
|
||||
case ${ans} in
|
||||
y|Y )
|
||||
@@ -341,10 +341,11 @@ std::remove_path() {
|
||||
|
||||
local -a _path=()
|
||||
IFS=':' read -r -a _path <<<"${path}"
|
||||
local dir=''
|
||||
local -- dir=''
|
||||
for dir in "${remove_dirs[@]}"; do
|
||||
# loop over all entries in path and mark
|
||||
# the to be deleted directories.
|
||||
local -i i=0
|
||||
for ((i=0; i<${#_path[@]}; i++)); do
|
||||
[[ "${_path[i]}" == "${dir}" ]] && _path[i]=''
|
||||
done
|
||||
@@ -359,8 +360,8 @@ std::remove_path() {
|
||||
|
||||
std.get_os_release_linux() {
|
||||
#local lsb_release=$(which lsb_release)
|
||||
local ID=''
|
||||
local VERSION_ID=''
|
||||
local -- ID=''
|
||||
local -- VERSION_ID=''
|
||||
|
||||
if [[ -n $(which lsb_release 2>/dev/null) ]]; then
|
||||
ID=$(lsb_release -is)
|
||||
|
||||
+17
-17
@@ -401,10 +401,10 @@ build_modules(){
|
||||
|
||||
|
||||
parse_version() {
|
||||
local v="$1"
|
||||
local -- v="$1"
|
||||
V="$1"
|
||||
|
||||
local tmp=''
|
||||
local -- tmp=''
|
||||
SUFFIX=''
|
||||
|
||||
if [[ "$v" =~ "_" ]]; then
|
||||
@@ -861,7 +861,7 @@ build_modules_yaml_v1(){
|
||||
# loop over semicolon separated list of keys
|
||||
for k in ${key//;/ }; do
|
||||
# brace expansion of key
|
||||
local list=()
|
||||
local -a list=()
|
||||
list=( $(${bash} -c "echo $k") )
|
||||
if [[ ${list[@]} =~ ${version} ]]; then
|
||||
result+=("${key}")
|
||||
@@ -913,8 +913,8 @@ build_modules_yaml_v1(){
|
||||
local -n with_modules="$3" # [out] list of required modules
|
||||
|
||||
local -a modules=()
|
||||
local key
|
||||
local keys=()
|
||||
local -- key
|
||||
local -a keys=()
|
||||
yml::get_keys keys yaml_input ".${group,,}"
|
||||
for key in "${keys[@]}"; do
|
||||
local -- version
|
||||
@@ -944,7 +944,7 @@ build_modules_yaml_v1(){
|
||||
is_subset(){
|
||||
local -n subset="$1"
|
||||
shift 1
|
||||
local el=''
|
||||
local -- el=''
|
||||
for el in "${subset[@]}"; do
|
||||
is_in_array "${el}" "$@" || return 1
|
||||
done
|
||||
@@ -981,7 +981,7 @@ build_modules_yaml_v1(){
|
||||
'Compiler' with_compiler
|
||||
debug "${with_compiler[@]}"
|
||||
|
||||
local compiler=''
|
||||
local -- compiler=''
|
||||
for compiler in "${with_compiler[@]}"; do
|
||||
# build if opt_with_modules is empty or compiler is in this array
|
||||
(( ${#opt_with_modules[@]} != 0 )) \
|
||||
@@ -1273,7 +1273,7 @@ build_modules_yaml_v1(){
|
||||
}
|
||||
|
||||
# build this variant?
|
||||
local build_variant="${opt_variant:-${config['default_variant']}}"
|
||||
local -- build_variant="${opt_variant:-${config['default_variant']}}"
|
||||
if [[ ":${config['variant']}:" != *:${build_variant}:* ]]; then
|
||||
debug "don't build this variant: ${config['variant']} != *:${build_variant}:*"
|
||||
return 0
|
||||
@@ -1290,7 +1290,7 @@ build_modules_yaml_v1(){
|
||||
local -n module_config="$3"
|
||||
|
||||
debug "build variant ${module_name}/${module_version}"
|
||||
local ol_name="${module_config['overlay']}"
|
||||
local -- ol_name="${module_config['overlay']}"
|
||||
[[ -v OverlayInfo[${ol_name}:install_root] ]] || \
|
||||
std::die 2 "%s" \
|
||||
"Overlay doesn't exist - ${ol_name}"
|
||||
@@ -1333,7 +1333,7 @@ build_modules_yaml_v1(){
|
||||
[MPI]=build_modules_mpi
|
||||
[HDF5]=build_modules_hdf5
|
||||
)
|
||||
local func=build_modules_other
|
||||
local -- func=build_modules_other
|
||||
if [[ -v build_functions[${module_config['group']}] ]]; then
|
||||
func=${build_functions[${module_config['group']}]}
|
||||
fi
|
||||
@@ -1353,8 +1353,8 @@ build_modules_yaml_v1(){
|
||||
# loop over comma separated list of keys
|
||||
for k in ${key//;/ }; do
|
||||
# do curly brackets expansion {}
|
||||
local l
|
||||
local list=()
|
||||
local -- l
|
||||
local -a list=()
|
||||
list=( $(${bash} -c "echo $k" ) )
|
||||
for l in "${list[@]}"; do
|
||||
if [[ $l =~ ${version} ]]; then
|
||||
@@ -1373,7 +1373,7 @@ build_modules_yaml_v1(){
|
||||
'.'
|
||||
|
||||
local -A mod_config=()
|
||||
local key=''
|
||||
local -- key=''
|
||||
for key in "${!Yaml_default_config[@]}"; do
|
||||
mod_config[${key}]="${Yaml_default_config[${key}]}"
|
||||
done
|
||||
@@ -1386,7 +1386,7 @@ build_modules_yaml_v1(){
|
||||
mod_config \
|
||||
;;
|
||||
'shasums' )
|
||||
local yaml_shasums=''
|
||||
local -- yaml_shasums=''
|
||||
yaml_shasums=$(${yq} ".${key}" <<<"${yaml_module_config}" 2>/dev/null)
|
||||
while read -r key value; do
|
||||
[[ -z ${key} ]] && continue
|
||||
@@ -1429,7 +1429,7 @@ build_modules_yaml_v1(){
|
||||
local -- version_key=''
|
||||
local -i num_variants=0
|
||||
for version_key in "${version_keys[@]}"; do
|
||||
local node=".versions.\"${version_key}\""
|
||||
local -- node=".versions.\"${version_key}\""
|
||||
yml::get_keys \
|
||||
found_keys \
|
||||
yaml_module_config \
|
||||
@@ -1460,9 +1460,9 @@ build_modules_yaml_v1(){
|
||||
esac
|
||||
done
|
||||
|
||||
local versions=()
|
||||
local -a versions=()
|
||||
expand_version_key versions "${version_key}" "${version}"
|
||||
local version=''
|
||||
local -- version=''
|
||||
for version in "${versions[@]}"; do
|
||||
debug "version: $version"
|
||||
P="${name}"
|
||||
|
||||
+104
-97
@@ -155,7 +155,7 @@ save_env() {
|
||||
esac
|
||||
}
|
||||
|
||||
local vars=()
|
||||
local -a vars=()
|
||||
vars+=( 'Version' )
|
||||
vars+=( 'UsedReleaseStages' 'UsedGroups' )
|
||||
vars+=( 'DefaultGroups' 'DefaultReleaseStages' )
|
||||
@@ -169,7 +169,7 @@ save_env() {
|
||||
vars+=( 'ModulePathAppend' )
|
||||
vars+=( 'ModulePathPrepend' )
|
||||
vars+=( 'MaskedGroups' )
|
||||
local s=''
|
||||
local -- s=''
|
||||
s=$(typeset -p "${vars[@]}")
|
||||
declare -gx PMODULES_ENV=$( encode_base64 "$s" )
|
||||
}
|
||||
@@ -548,7 +548,7 @@ find_overlay () {
|
||||
path="${path%/"${__MODULEFILES_DIR__}"*}"
|
||||
local -- ol=''
|
||||
for ol in "${UsedOverlays[@]}"; do
|
||||
local modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local -- modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
if [[ "${path}" == ${modulefiles_root}/* ]]; then
|
||||
ref_ol="${ol}"
|
||||
if [[ "${OverlayInfo[${ref_ol}:layout]}" == 'Pmodules' ]]; then
|
||||
@@ -801,7 +801,7 @@ subcommand_load() {
|
||||
if [[ ! ":${UsedReleaseStages}:" == *:${relstage}:* ]]; then
|
||||
output+="module use ${relstage}; "
|
||||
fi
|
||||
local group=${line[2]}
|
||||
local -- group=${line[2]}
|
||||
#echo "group=${group}" 1>&2
|
||||
[[ "${group}" != 'none' ]] || continue
|
||||
if [[ ! ":${UsedGroups}:" == *:${group}:* ]] && \
|
||||
@@ -835,9 +835,9 @@ subcommand_load() {
|
||||
}
|
||||
|
||||
#......................................................................
|
||||
local args=()
|
||||
local opts=()
|
||||
local overlay
|
||||
local -a args=()
|
||||
local -a opts=()
|
||||
local -- overlay
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-\? | -H | --help )
|
||||
@@ -873,7 +873,7 @@ subcommand_load() {
|
||||
_LMFILES_=''
|
||||
fi
|
||||
|
||||
local m=''
|
||||
local -- m=''
|
||||
for m in "${args[@]}"; do
|
||||
if [[ "$m" == *:* ]]; then
|
||||
local -a toks=()
|
||||
@@ -911,7 +911,7 @@ subcommand_load() {
|
||||
fi # handle extended module names
|
||||
|
||||
find_modulefile current_modulefile relstage moduledir modulecmd "${m}" || {
|
||||
local hints=''
|
||||
local -- hints=''
|
||||
get_load_hints hints
|
||||
if [[ -z "${hints}" ]]; then
|
||||
die_module_nexist "${m}"
|
||||
@@ -942,7 +942,7 @@ subcommand_load() {
|
||||
[[ ":${LOADEDMODULES}:" == *:${m}:* ]] && continue
|
||||
|
||||
# show info file
|
||||
local prefix=''
|
||||
local -- prefix=''
|
||||
get_module_prefix prefix "${current_modulefile}"
|
||||
[[ -n ${prefix} && -r "${prefix}/.info" ]] && cat "${prefix}/.info" 1>&2
|
||||
|
||||
@@ -959,7 +959,7 @@ subcommand_load() {
|
||||
|
||||
# load module
|
||||
modulecmd="${interp[${current_modulefile}]}"
|
||||
local output=''
|
||||
local -- output=''
|
||||
output=$("${modulecmd}" 'bash' "${opts[@]}" 'load' \
|
||||
"${current_modulefile}" 2> "${TmpFile}")
|
||||
|
||||
@@ -974,10 +974,10 @@ subcommand_load() {
|
||||
# Handle errors from Lmod.
|
||||
# :FIXME:
|
||||
# In some cases the error message is unclear.
|
||||
local error=''
|
||||
local -- error=''
|
||||
error=$( < "${TmpFile}")
|
||||
if [[ "${error}" == *:ERROR:* ]]; then
|
||||
local s=${error%%$'\n'*}
|
||||
local -- s=${error%%$'\n'*}
|
||||
[[ "$s" =~ ' conflicts ' ]] && \
|
||||
die_module_conflict "${m}"
|
||||
die_module_cmd_failed "${m}"
|
||||
@@ -1033,7 +1033,7 @@ subcommand_unload() {
|
||||
be another module. For the time being the modules requiring
|
||||
this module will be unloaded too.
|
||||
'
|
||||
local args=()
|
||||
local -a args=()
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
-\? | -H | --help )
|
||||
@@ -1063,7 +1063,7 @@ subcommand_unload() {
|
||||
# fail. Instead of comparing the name of the module to unload
|
||||
# with 'Pmodules', we save the value and set it at the end of
|
||||
# the loop again, if it has been unset.
|
||||
local saved_home="${PMODULES_HOME}"
|
||||
local -- saved_home="${PMODULES_HOME}"
|
||||
|
||||
if [[ ! -v _LMFILES_ ]]; then
|
||||
declare -x _LMFILES_=''
|
||||
@@ -1071,8 +1071,8 @@ subcommand_unload() {
|
||||
fi
|
||||
|
||||
IFS=':' read -r -a _lmfiles_ <<< "${_LMFILES_}"
|
||||
local arg
|
||||
local lmfile
|
||||
local -- arg
|
||||
local -- lmfile
|
||||
for arg in "${args[@]}"; do
|
||||
# is the module loaded?
|
||||
for lmfile in "${_lmfiles_[@]}" '_zzzz_'; do
|
||||
@@ -1086,7 +1086,7 @@ subcommand_unload() {
|
||||
# yes, module has been loaded
|
||||
is_modulefile modulecmd "${lmfile}" || die_module_not_a_modulefile "${arg}"
|
||||
|
||||
local output=''
|
||||
local -- output=''
|
||||
output=$("${modulecmd}" 'bash' 'unload' "${arg}")
|
||||
if [[ -n "${output}" ]]; then
|
||||
eval "$(echo "${output}"|${sed} -e 's/;unalias [^;]*//g')"
|
||||
@@ -1146,7 +1146,7 @@ subcommand_swap() {
|
||||
local -r __doc__='
|
||||
Swap two modules.
|
||||
'
|
||||
local args=()
|
||||
local -a args=()
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
-\? | -H | --help )
|
||||
@@ -1216,7 +1216,7 @@ subcommand_show() {
|
||||
(( ${#args[@]} == 0 )) && \
|
||||
die_args_missing
|
||||
|
||||
local arg
|
||||
local -- arg
|
||||
for arg in "${args[@]}"; do
|
||||
local -- modulefile=''
|
||||
local -- relstage=''
|
||||
@@ -1310,7 +1310,7 @@ get_available_modules() {
|
||||
fi
|
||||
[[ -n ${OverlayExcludes} \
|
||||
&& "${long_module_name}" =~ ${OverlayExcludes} ]] && continue
|
||||
local add='no'
|
||||
local -- add='no'
|
||||
if [[ -n "${ol_name}" && "${ol_name,,}" != 'none' ]]; then
|
||||
# module is in an overlay
|
||||
#
|
||||
@@ -1510,8 +1510,8 @@ subcommand_avail() {
|
||||
cur_dir="${mods[i+2]}"
|
||||
fi
|
||||
|
||||
local mod=${mods[i]%.lua}
|
||||
local relstage=${mods[i+1]}
|
||||
local -- mod=${mods[i]%.lua}
|
||||
local -- relstage=${mods[i+1]}
|
||||
case ${relstage} in
|
||||
stable )
|
||||
out=''
|
||||
@@ -1547,8 +1547,8 @@ subcommand_avail() {
|
||||
cur_group="${mods[i+5]}"
|
||||
cur_dir="${mods[i+2]}"
|
||||
fi
|
||||
local mod=${mods[i]%.lua}
|
||||
local relstage=${mods[i+1]}
|
||||
local -- mod=${mods[i]%.lua}
|
||||
local -- relstage=${mods[i+1]}
|
||||
case ${relstage} in
|
||||
stable )
|
||||
out=''
|
||||
@@ -1566,7 +1566,7 @@ subcommand_avail() {
|
||||
human_readable_output() {
|
||||
local -- cur_group=''
|
||||
local -- cur_dir=''
|
||||
local mod=''
|
||||
local -- mod=''
|
||||
local -i colsize=16
|
||||
local -i column=$cols # force a line-break
|
||||
for ((i=0; i<${#mods[@]}; i+=6)); do
|
||||
@@ -1581,7 +1581,7 @@ subcommand_avail() {
|
||||
cur_dir="${mods[i+2]}"
|
||||
fi
|
||||
if [[ ${Verbosity_lvl} == 'verbose' ]]; then
|
||||
local relstage=${mods[i+1]}
|
||||
local -- relstage=${mods[i+1]}
|
||||
case ${relstage} in
|
||||
stable )
|
||||
mod="${mods[i]%.lua}"
|
||||
@@ -1612,11 +1612,11 @@ subcommand_avail() {
|
||||
}
|
||||
|
||||
#......................................................................
|
||||
local pattern=()
|
||||
local output_function='human_readable_output'
|
||||
local opt_use_relstages="${UsedReleaseStages}"
|
||||
local -a pattern=()
|
||||
local --output_function='human_readable_output'
|
||||
local -- opt_use_relstages="${UsedReleaseStages}"
|
||||
local -A opt_groups=()
|
||||
local val=''
|
||||
local -- val=''
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-\? | -H | --help )
|
||||
@@ -1689,6 +1689,7 @@ subcommand_avail() {
|
||||
done
|
||||
local -a path=()
|
||||
IFS=':' read -r -a path <<<"${modulepath%:}"
|
||||
local -- string=''
|
||||
for string in "${pattern[@]}"; do
|
||||
get_available_modules \
|
||||
'search' \
|
||||
@@ -1796,7 +1797,7 @@ subcommand_use() {
|
||||
local -r __doc__='Implementation of the sub-command use.'
|
||||
local -a modulepath=()
|
||||
IFS=':' read -r -a modulepath <<<"${MODULEPATH}"
|
||||
local add2path_func='std::append_path'
|
||||
local -- add2path_func='std::append_path'
|
||||
|
||||
#......................................................................
|
||||
group_is_used() {
|
||||
@@ -1806,13 +1807,13 @@ subcommand_use() {
|
||||
#......................................................................
|
||||
print_info() {
|
||||
print_ol_info(){
|
||||
local used="$1" # print used or unused overlays
|
||||
local ol=''
|
||||
local -- used="$1" # print used or unused overlays
|
||||
local -- ol=''
|
||||
for ol in "${Overlays[@]}"; do
|
||||
[[ ${OverlayInfo[${ol}:used]} == "${used}" ]] || continue
|
||||
local install_root="${OverlayInfo[${ol}:install_root]}"
|
||||
local modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local txt="\t${ol}"
|
||||
local -- install_root="${OverlayInfo[${ol}:install_root]}"
|
||||
local -- modulefiles_root="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local -- txt="\t${ol}"
|
||||
if [[ ${install_root} == "${modulefiles_root}" ]]; then
|
||||
txt+="\n\t\t${install_root}"
|
||||
else
|
||||
@@ -1831,15 +1832,15 @@ subcommand_use() {
|
||||
done
|
||||
}
|
||||
|
||||
local f
|
||||
local r
|
||||
local -- f
|
||||
local -- r
|
||||
std::info "Used groups:"
|
||||
for f in ${UsedGroups//:/ }; do
|
||||
std::info "\t${f}"
|
||||
done
|
||||
std::info ''
|
||||
std::info "Unused groups:"
|
||||
local _group
|
||||
local -- _group
|
||||
for _group in "${!GroupDepths[@]}"; do
|
||||
local -i depth=${GroupDepths[${_group}]}
|
||||
if ! group_is_used "${_group}" && (( depth == 0 )); then
|
||||
@@ -1868,7 +1869,7 @@ subcommand_use() {
|
||||
std::info "Additonal directories in MODULEPATH:"
|
||||
local -i i=0
|
||||
local -i n=0
|
||||
local group
|
||||
local -- group
|
||||
for (( i=0; i<${#modulepath[@]}; i++)); do
|
||||
if ! find_overlay ol group "${modulepath[i]}"; then
|
||||
std::info "\t${modulepath[i]}"
|
||||
@@ -1897,7 +1898,7 @@ subcommand_use() {
|
||||
}
|
||||
#..............................................................
|
||||
use_overlay() {
|
||||
local ol_name="$1"
|
||||
local -- ol_name="$1"
|
||||
|
||||
[[ -n "${LOADEDMODULES}" ]] && \
|
||||
[[ "${LOADEDMODULES}" != Pmodules/+([.0-9rc]) ]] && \
|
||||
@@ -1906,6 +1907,7 @@ subcommand_use() {
|
||||
[[ ${OverlayInfo[${ol_name}:used]} == 'yes' ]] && return 0
|
||||
|
||||
local -a conflicts=( "${OverlayInfo[${ol_name}:conflicts]//:/ }" )
|
||||
local -- ol=''
|
||||
for ol in "${UsedOverlays[@]}"; do
|
||||
for conflict in "${conflicts[@]}"; do
|
||||
[[ "${ol}" == ${conflict} ]] && \
|
||||
@@ -1940,11 +1942,11 @@ subcommand_use() {
|
||||
MaskedGroups[${group}]="${ol_name}:${MaskedGroups[${group}]}"
|
||||
done
|
||||
fi
|
||||
local -- group=''
|
||||
if [[ -n "${OverlayInfo[${ol_name}:groups]}" ]]; then
|
||||
local -- grp_changes=':'
|
||||
local -a groups=()
|
||||
IFS=':' read -r -a groups <<< "${OverlayInfo[${ol_name}:groups]}"
|
||||
local -- group=''
|
||||
for group in "${groups[@]}"; do
|
||||
if [[ "${group:0:1}" == '~' ]]; then
|
||||
if [[ ":${UsedGroups}:" == *:${group:1}:* ]]; then
|
||||
@@ -1962,7 +1964,7 @@ subcommand_use() {
|
||||
fi
|
||||
scan_groups "${ol_name}"
|
||||
for group in ${UsedGroups//:/ }; do
|
||||
local dir="${OverlayInfo[${ol_name}:modulefiles_root]}/"
|
||||
local -- dir="${OverlayInfo[${ol_name}:modulefiles_root]}/"
|
||||
dir+="${group}/${__MODULEFILES_DIR__}"
|
||||
if [[ -d "${dir}" ]]; then
|
||||
std::prepend_path MODULEPATH "${dir}"
|
||||
@@ -1997,7 +1999,7 @@ subcommand_use() {
|
||||
local -i n="${#UsedOverlays[@]}"
|
||||
for ((i=n-1; i>=0; i--)); do
|
||||
ol_name="${UsedOverlays[i]}"
|
||||
local dir="${OverlayInfo[${ol_name}:modulefiles_root]}/${grp}/${__MODULEFILES_DIR__}"
|
||||
local -- dir="${OverlayInfo[${ol_name}:modulefiles_root]}/${grp}/${__MODULEFILES_DIR__}"
|
||||
[[ -d "${dir}" ]] || continue
|
||||
std::prepend_path MODULEPATH "${dir}"
|
||||
[[ "${OverlayInfo[${ol_name}:type]}" == "${ol_replacing}" ]] && break
|
||||
@@ -2025,7 +2027,7 @@ subcommand_use() {
|
||||
return ${rc}
|
||||
fi
|
||||
if [[ -d ${arg} ]]; then
|
||||
local dir=''
|
||||
local -- dir=''
|
||||
dir=$(std::get_abspath "${arg}")
|
||||
if [[ "${opt_append}" == 'yes' ]]; then
|
||||
std::append_path MODULEPATH "${dir}" || rc=$?
|
||||
@@ -2069,6 +2071,7 @@ subcommand_use() {
|
||||
print_info
|
||||
return
|
||||
fi
|
||||
local -- arg=''
|
||||
for arg in "${args[@]}"; do
|
||||
use "${arg}"
|
||||
done
|
||||
@@ -2109,7 +2112,7 @@ subcommand_unuse() {
|
||||
|
||||
#..............................................................
|
||||
unuse_overlay() {
|
||||
local ol_name="$1"
|
||||
local -- ol_name="$1"
|
||||
|
||||
if [[ -n "${LOADEDMODULES}" ]] && \
|
||||
[[ "${LOADEDMODULES}" != Pmodules/+([.0-9rc]) ]]; then
|
||||
@@ -2202,7 +2205,7 @@ subcommand_unuse() {
|
||||
unset_ol_modulepaths "${ol_name}"
|
||||
|
||||
# remove root of overlay
|
||||
local dir
|
||||
local -- dir=''
|
||||
for dir in "${modulepath[@]}"; do
|
||||
[[ "${dir}" == "${OverlayInfo[${ol_name}:modulefiles_root]}" ]] && \
|
||||
std::remove_path MODULEPATH "${dir}"
|
||||
@@ -2218,21 +2221,21 @@ subcommand_unuse() {
|
||||
die_grp_invalid "${grp}"
|
||||
|
||||
if [[ -v PMODULES_LOADED_${grp^^} ]]; then
|
||||
local var="PMODULES_LOADED_${grp^^}"
|
||||
local -- var="PMODULES_LOADED_${grp^^}"
|
||||
[[ -n "${!var}" ]] && \
|
||||
die_grp_cannot_be_removed "${grp}"
|
||||
fi
|
||||
std::remove_path UsedGroups "${grp}"
|
||||
local overlay
|
||||
local -- overlay=''
|
||||
for overlay in "${UsedOverlays[@]}"; do
|
||||
local dir="${OverlayInfo[${overlay}:modulefiles_root]}"
|
||||
local -- dir="${OverlayInfo[${overlay}:modulefiles_root]}"
|
||||
dir+="/${grp}/${__MODULEFILES_DIR__}"
|
||||
std::remove_path MODULEPATH "${dir}"
|
||||
done
|
||||
}
|
||||
|
||||
#..............................................................
|
||||
local arg=$1
|
||||
local -- arg="$1"
|
||||
|
||||
if is_release_stage "${arg}"; then
|
||||
unuse_relstage "${arg}"
|
||||
@@ -2243,7 +2246,7 @@ subcommand_unuse() {
|
||||
return 0
|
||||
fi
|
||||
if [[ -d ${arg} ]]; then
|
||||
local dir=''
|
||||
local -- dir=''
|
||||
dir=$(std::get_abspath "${arg}")
|
||||
std::remove_path MODULEPATH "${dir}"
|
||||
std::remove_path ModulePathAppend "${dir}"
|
||||
@@ -2276,6 +2279,7 @@ subcommand_unuse() {
|
||||
shift
|
||||
done
|
||||
(( ${#args[@]} == 0 )) && die_args_missing
|
||||
local -- arg=''
|
||||
for arg in "${args[@]}"; do
|
||||
unuse "${args[@]}"
|
||||
done
|
||||
@@ -2324,7 +2328,7 @@ pmodules_setup() {
|
||||
local -r mode="${1:-check}"
|
||||
init_used_groups() {
|
||||
declare -gx UsedGroups=''
|
||||
local group
|
||||
local -- group
|
||||
for group in ${DefaultGroups//:/ }; do
|
||||
std::append_path UsedGroups "${group}"
|
||||
done
|
||||
@@ -2347,11 +2351,11 @@ pmodules_setup() {
|
||||
|
||||
init_modulepath() {
|
||||
declare -gx MODULEPATH=''
|
||||
local group
|
||||
local ol
|
||||
local -- group
|
||||
local -- ol
|
||||
for ol in "${UsedOverlays[@]}"; do
|
||||
for group in ${UsedGroups//:/ }; do
|
||||
local dir="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
local -- dir="${OverlayInfo[${ol}:modulefiles_root]}"
|
||||
dir+="/${group}/${__MODULEFILES_DIR__}"
|
||||
if [[ -d "${dir}" ]]; then
|
||||
std::prepend_path MODULEPATH "${dir}"
|
||||
@@ -2466,6 +2470,7 @@ subcommand_purge() {
|
||||
|
||||
# unload all modules (except Pmodules itself)
|
||||
IFS=':' read -r -a modules <<< "${LOADEDMODULES}"
|
||||
local -i i=0
|
||||
for (( i=${#modules[@]}-1; i>=0; i-- )); do
|
||||
[[ ${modules[$i]} == Pmodules/* ]] && continue
|
||||
subcommand_unload "${modules[$i]}"
|
||||
@@ -2531,7 +2536,7 @@ subcommand_list() {
|
||||
# get list of loaded modules with stripped MODULEPATH
|
||||
IFS=':' read -r -a modules \
|
||||
< <( ${sed} "s;${MODULEPATH//:/\/\\\|}/;;g" <<< "${_LMFILES_}" )
|
||||
local -- strs=()
|
||||
local -a strs=()
|
||||
local -i n=1 # enumeration of loaded modules
|
||||
local -i colsize=0
|
||||
local -- s=''
|
||||
@@ -2570,7 +2575,7 @@ subcommand_list() {
|
||||
printf "Currently Loaded Modules:\n" 1>&2
|
||||
local -i fmt_field_width=0
|
||||
local -i length=0
|
||||
local module
|
||||
local -- module
|
||||
for module in "${modules[@]}"; do
|
||||
length=${#module}
|
||||
(( length > fmt_field_width )) && fmt_field_width=length
|
||||
@@ -2591,8 +2596,8 @@ subcommand_list() {
|
||||
printf -- "\n\n" 1>&2
|
||||
}
|
||||
|
||||
local args=()
|
||||
local output_function='human_readable_output'
|
||||
local -a args=()
|
||||
local -- output_function='human_readable_output'
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
-\? | -H | --help )
|
||||
@@ -2752,14 +2757,14 @@ subcommand_search() {
|
||||
local -i cols=80
|
||||
[[ -t 1 && -t 2 ]] && cols=$(${tput} cols) # get number of columns of terminal
|
||||
local -i max_len_modulename=0
|
||||
local opt_print_header='yes'
|
||||
local opt_print_modulefiles='no'
|
||||
local opt_print_csv='no'
|
||||
local opt_print_verbose='no'
|
||||
local opt_use_relstages=':'
|
||||
local opt_all_deps='no'
|
||||
local opt_wrap='no'
|
||||
local opt_newest='no'
|
||||
local -- opt_print_header='yes'
|
||||
local -- opt_print_modulefiles='no'
|
||||
local -- opt_print_csv='no'
|
||||
local -- opt_print_verbose='no'
|
||||
local -- opt_use_relstages=':'
|
||||
local -- opt_all_deps='no'
|
||||
local -- opt_wrap='no'
|
||||
local -- opt_newest='no'
|
||||
local -- opt_print_raw='no'
|
||||
|
||||
#.....................................................................
|
||||
@@ -2774,9 +2779,9 @@ subcommand_search() {
|
||||
# with_modules
|
||||
#
|
||||
print_result() {
|
||||
local func_print_header=''
|
||||
local func_print_line=''
|
||||
local fmt=''
|
||||
local -- func_print_header=''
|
||||
local -- func_print_line=''
|
||||
local -- fmt=''
|
||||
|
||||
print_default() {
|
||||
fmt="%-${max_len_modulename}s %-10s %-12s %-12s %-s"
|
||||
@@ -2796,7 +2801,7 @@ subcommand_search() {
|
||||
|
||||
print_line_default() {
|
||||
write_line() {
|
||||
local str="$1"
|
||||
local -- str="$1"
|
||||
if [[ -t 1 && -t 2 ]] && (( ${#str} >= cols )); then
|
||||
str="${str:0:$((cols-1))}>"
|
||||
fi
|
||||
@@ -2833,7 +2838,7 @@ subcommand_search() {
|
||||
}
|
||||
|
||||
print_line_verbose() {
|
||||
local deps="${*:6}"
|
||||
local -- deps="${*:6}"
|
||||
[[ -z ${deps} ]] && deps="(none)"
|
||||
std::info "$1:"
|
||||
std::info " release stage: $2"
|
||||
@@ -2882,7 +2887,7 @@ subcommand_search() {
|
||||
print_default
|
||||
fi
|
||||
|
||||
local _script=''
|
||||
local -- _script=''
|
||||
if [[ ${opt_newest} == 'yes' ]]; then
|
||||
_script='{} END{print}'
|
||||
fi
|
||||
@@ -2938,9 +2943,9 @@ subcommand_search() {
|
||||
if [[ "${OverlayInfo[${ol}:layout]}" == 'Pmodules' ]]; then
|
||||
if [[ "${opt_print_verbose}" == 'yes' ]] || \
|
||||
[[ "${opt_all_deps}" == 'yes' ]]; then
|
||||
local prefix=''
|
||||
local -- prefix=''
|
||||
get_module_prefix prefix "${modulefile}"
|
||||
local dependencies_file="${prefix}/.dependencies"
|
||||
local -- dependencies_file="${prefix}/.dependencies"
|
||||
if [[ -n ${prefix} ]] && [[ -r "${dependencies_file}" ]]; then
|
||||
mapfile -t deps < "${dependencies_file}"
|
||||
fi
|
||||
@@ -3003,10 +3008,10 @@ subcommand_search() {
|
||||
;;
|
||||
--release-stage | --release-stage=* )
|
||||
if [[ "$1" == "--release" ]]; then
|
||||
local arg=$2
|
||||
local -- arg="$2"
|
||||
shift
|
||||
else
|
||||
local arg=${1/--release=}
|
||||
local -- arg="${1/--release=}"
|
||||
fi
|
||||
is_release_stage "${arg}" || \
|
||||
die_relstage_invalid "${arg}"
|
||||
@@ -3014,16 +3019,17 @@ subcommand_search() {
|
||||
;;
|
||||
--with | --with=* )
|
||||
if [[ "$1" == --with ]]; then
|
||||
local arg=$2
|
||||
local -- arg="$2"
|
||||
shift
|
||||
else
|
||||
local arg=${1/--with=}
|
||||
local -- arg="${1/--with=}"
|
||||
fi
|
||||
if [[ -z ${arg} ]] || [[ "${arg}" == -* ]]; then
|
||||
die_args_invalid_value '--with' "${arg}"
|
||||
fi
|
||||
arg=${arg//:/ }
|
||||
arg=${arg//,/ }
|
||||
local -- module=''
|
||||
for module in ${arg}; do
|
||||
with_modules+=" && / ${module//\//\\/}/"
|
||||
done
|
||||
@@ -3062,6 +3068,7 @@ subcommand_search() {
|
||||
local -a modulepath_pmodules=()
|
||||
local -a modulepath_other=()
|
||||
# search in overlays with layout 'Spack'
|
||||
local -- ol_name=''
|
||||
for ol_name in "${UsedOverlays[@]}"; do
|
||||
[[ "${OverlayInfo[${ol_name}:layout]}" != 'Spack' ]] && break
|
||||
[[ "${OverlayInfo[${ol_name}:type]}" == "${ol_replacing}" ]] && \
|
||||
@@ -3277,7 +3284,7 @@ subcommand_help() {
|
||||
if (( ${#args[@]} == 0 )); then
|
||||
print_help 'help'
|
||||
fi
|
||||
local arg
|
||||
local -- arg=''
|
||||
for arg in "${args[@]}"; do
|
||||
if [[ -v Help[${arg}] ]] ; then
|
||||
print_help "${arg}"
|
||||
@@ -3312,8 +3319,8 @@ USAGE:
|
||||
#..............................................................................
|
||||
subcommand_whatis() {
|
||||
local -r __doc__='Implementation of the sub-command whatis.'
|
||||
local -- opts=('--newest')
|
||||
local -- args=()
|
||||
local -a opts=('--newest')
|
||||
local -a args=()
|
||||
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
@@ -3354,7 +3361,7 @@ subcommand_whatis() {
|
||||
else
|
||||
modulecmd="Tcl_cmd"
|
||||
fi
|
||||
local whatis=''
|
||||
local -- whatis=''
|
||||
whatis=$("${modulecmd}" bash \
|
||||
whatis \
|
||||
"${modulename}" \
|
||||
@@ -3379,8 +3386,8 @@ USAGE:
|
||||
#..............................................................................
|
||||
subcommand_apropos() {
|
||||
local -r __doc__='Implementation of the sub-command apropos|keyword'
|
||||
local opts=()
|
||||
local args=()
|
||||
local -a opts=()
|
||||
local -a args=()
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
-\? | --help )
|
||||
@@ -3405,7 +3412,7 @@ subcommand_apropos() {
|
||||
(( ${#args[@]} > 1 )) && \
|
||||
die_args_too_many
|
||||
|
||||
local arg="${args[0],,}"
|
||||
local -- arg="${args[0],,}"
|
||||
|
||||
local -- modules=''
|
||||
find_matching_modules modules '' "${opts[@]}"
|
||||
@@ -3424,7 +3431,7 @@ subcommand_apropos() {
|
||||
else
|
||||
modulecmd="Tcl_cmd"
|
||||
fi
|
||||
local whatis=''
|
||||
local -- whatis=''
|
||||
whatis=$("${modulecmd}" bash \
|
||||
whatis \
|
||||
"${modulefile}" \
|
||||
@@ -3497,7 +3504,7 @@ subcommand_save(){
|
||||
if [[ "${opt_system}" == 'yes' ]]; then
|
||||
basedir="${UsedOverlays[0]}/collections"
|
||||
fi
|
||||
local collection=''
|
||||
local -- collection=''
|
||||
if (( ${#args[@]} == 0 )); then
|
||||
collection="${basedir}/default"
|
||||
else
|
||||
@@ -3531,9 +3538,9 @@ subcommand_save(){
|
||||
# save additional module directories
|
||||
local -a modulepath=()
|
||||
IFS=':' read -r -a modulepath <<< "${MODULEPATH}"
|
||||
local dir=''
|
||||
local ol=''
|
||||
local grp=''
|
||||
local -- dir=''
|
||||
local -- ol=''
|
||||
local -- grp=''
|
||||
for dir in "${modulepath[@]}"; do
|
||||
find_overlay ol grp "${dir}" && continue
|
||||
s+="module use \"${dir}\";\n"
|
||||
@@ -3682,8 +3689,8 @@ subcommand_savelist() {
|
||||
local -n gc_dirs="$2"
|
||||
shift 2
|
||||
_result=()
|
||||
local _pattern
|
||||
local _coll
|
||||
local -- _pattern
|
||||
local -- _coll
|
||||
for _pattern in "$@"; do
|
||||
while read -r _coll; do
|
||||
_result+=( "${_coll}" )
|
||||
@@ -3732,7 +3739,7 @@ subcommand_savelist() {
|
||||
local -a _dirs=( "${UsrCollectionsDir[@]}" )
|
||||
print_collections "User collections:" _dirs "${args[@]}"
|
||||
_dirs=()
|
||||
local _ol
|
||||
local -- _ol
|
||||
for _ol in "${UsedOverlays[@]}"; do
|
||||
_dirs+=( "${OverlayInfo[${_ol}:install_root]}/collections" )
|
||||
done
|
||||
@@ -3921,7 +3928,7 @@ subcommand_initswitch() {
|
||||
local -r __doc__='
|
||||
Implementation of the initswitch sub-command.'
|
||||
|
||||
local args=()
|
||||
local -a args=()
|
||||
while (( $# > 0 )); do
|
||||
case $1 in
|
||||
-\? | --help )
|
||||
|
||||
Reference in New Issue
Block a user