aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaria Lisina <sekoohaka.sarisan@gmail.com>2025-06-09 16:20:11 +0500
committerMaria Lisina <sekoohaka.sarisan@gmail.com>2025-06-09 16:20:11 +0500
commite75b1ce03dc55990bf285259c8e254f45b0f697c (patch)
tree7e9dbc9dfb59683d8a70a999d8580af4d00518a4
parent528f9cef31b9c3fa06dd418d922a2b766fd1a49e (diff)
bot: Move all dependencies to separated array lists
Signed-off-by: Maria Lisina <sekoohaka.sarisan@gmail.com>
-rwxr-xr-xbot.zsh42
1 files changed, 35 insertions, 7 deletions
diff --git a/bot.zsh b/bot.zsh
index eaea6fb..1ca01ae 100755
--- a/bot.zsh
+++ b/bot.zsh
@@ -33,6 +33,34 @@ units="${dir}/units"
users="${dir}/users"
offset=-1
+zmods=(
+ zsh/datetime
+ zsh/files
+ zsh/stat
+ zsh/zutil
+)
+
+reqs=(
+ busybox
+ curl
+ jq
+ recode
+ xq
+)
+
+busybox=(
+ base64
+ cut
+ find
+ grep
+ ls
+ sed
+ sort
+ sha1sum
+ sleep
+ tr
+)
+
if [[ -n "${1}" ]]
then
while getopts ha:lg:r:m:t:s:cjqui:e:d:n:x: opts
@@ -139,11 +167,11 @@ then
exit 0
fi
-for module in zsh/datetime zsh/files zsh/stat zsh/zutil
+for zmod in ${zmods[@]}
do
- if ! zmodload ${module}
+ if ! zmodload ${zmod}
then
- failed="${failed} ${module}"
+ failed="${failed} ${zmod}"
fi
done
@@ -154,11 +182,11 @@ then
exit 1
fi
-for required in busybox curl jq recode xq
+for req in ${reqs[@]}
do
- if ! command -v ${required} > /dev/null
+ if ! command -v ${req} > /dev/null
then
- missing="${missing} ${required}"
+ missing="${missing} ${req}"
fi
done
@@ -169,7 +197,7 @@ then
exit 1
fi
-for function in base64 cut find grep ls sed sort sha1sum sleep tr
+for function in ${busybox[@]}
do
if busybox ${function} --help > /dev/null
then