Feat: Module list can be comma or space delimited
This commit is contained in:
parent
f0734ee8cb
commit
ea4806df9d
6
xrsbd
6
xrsbd
@ -27,7 +27,7 @@ main() {
|
|||||||
# Since stat_cache is hash ordered, maintain the display order (as defined
|
# Since stat_cache is hash ordered, maintain the display order (as defined
|
||||||
# by mod_list) of the keys so we can loop over the cache in display order
|
# by mod_list) of the keys so we can loop over the cache in display order
|
||||||
# when generating the full status
|
# when generating the full status
|
||||||
local -a stat_cache_ordered_mods
|
local -a stat_cache_ordered_mods mods
|
||||||
local mod mod_file
|
local mod mod_file
|
||||||
|
|
||||||
# Map the module file name to the module function
|
# Map the module file name to the module function
|
||||||
@ -37,7 +37,8 @@ main() {
|
|||||||
|
|
||||||
# For each module in the list, if the module file exists then source it, add
|
# For each module in the list, if the module file exists then source it, add
|
||||||
# its name to the ordered array, and call its function and cache the value
|
# its name to the ordered array, and call its function and cache the value
|
||||||
for mod in ${mod_list}; do
|
IFS=', ' read -r -a mods <<< "${mod_list}"
|
||||||
|
for mod in ${mods[@]}; do
|
||||||
mod_file="${MOD_DIR}/${mod}"
|
mod_file="${MOD_DIR}/${mod}"
|
||||||
if [[ -r "${mod_file}" ]]; then
|
if [[ -r "${mod_file}" ]]; then
|
||||||
# shellcheck source=/dev/null
|
# shellcheck source=/dev/null
|
||||||
@ -47,7 +48,6 @@ main() {
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
# Construct and display the status by looping over the cached values in order
|
# Construct and display the status by looping over the cached values in order
|
||||||
draw_status() {
|
draw_status() {
|
||||||
local mod stat
|
local mod stat
|
||||||
|
Loading…
Reference in New Issue
Block a user