load modules in commands.sh on debug only

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2019-05-31 22:53:48 +02:00
parent dbb6caf667
commit 7029f7f93d
3 changed files with 14 additions and 12 deletions

View File

@ -11,7 +11,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.90-rc1-3-g4297fc1
#### $$VERSION$$ v0.90-rc1-4-gdbb6caf
#
# Exit Codes:
# - 0 sucess (hopefully)
@ -141,12 +141,7 @@ export res CAPTION
COMMANDS="${BASHBOT_ETC:-.}/commands.sh"
if [ "${SOURCE}" = "yes" ]; then
for modules in ${MODULEDIR:-.}/*.sh ; do
# shellcheck source=./modules/aliases.sh
[ -r "${modules}" ] && source "${modules}" "source"
done
else
if [ "${SOURCE}" != "yes" ]; then
if [ ! -f "${COMMANDS}" ] || [ ! -r "${COMMANDS}" ]; then
echo -e "${RED}ERROR: ${COMMANDS} does not exist or is not readable!.${NC}"
ls -l "${COMMANDS}"
@ -156,6 +151,13 @@ else
source "${COMMANDS}" "source"
fi
###############
# load modules
for modules in ${MODULEDIR:-.}/*.sh ; do
# shellcheck source=./modules/aliases.sh
[ -r "${modules}" ] && source "${modules}" "source"
done
#################
# BASHBOT INTERNAL functions
# $1 URL, $2 filename in DATADIR

View File

@ -5,7 +5,7 @@
# This file is public domain in the USA and all free countries.
# Elsewhere, consider it to be WTFPLv2. (wtfpl.net/txt/copying)
#
#### $$VERSION$$ v0.90-rc1-1-g46271cc
#### $$VERSION$$ v0.90-rc1-4-gdbb6caf
#
# adjust your language setting here, e.g.when run from other user or cron.
@ -37,7 +37,7 @@ Get the code in my [GitHub](http://github.com/topkecleon/telegram-bot-bash)
'
# load modues on startup and always on on debug
if [ "${1}" = "source" ] || [[ "${1}" = *"debug"* ]] ; then
if [[ "${1}" = *"debug"* ]] ; then
# load all readable modules
for modules in ${MODULEDIR:-.}/*.sh ; do
# shellcheck source=./modules/aliases.sh

View File

@ -5,7 +5,7 @@
# If you your bot is finished you can use make-standalone.sh to create the
# the old all-in-one bashbot: bashbot.sh and commands.sh only!
#
#### $$VERSION$$ v0.90-rc1-0-g93b4914
#### $$VERSION$$ v0.90-rc1-4-gdbb6caf
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -65,7 +65,7 @@ echo " ... create unified bashbot.sh"
{
# first head of bashbot.sh
sed -n '0,/\/commands.sh"/ p' bashbot.sh | head -n -2
sed -n '0,/for modules in/ p' bashbot.sh | head -n -3
# then mycommands from first non comment line on
printf '\n##############################\n# bashbot modules starts here ...\n'
@ -73,7 +73,7 @@ echo " ... create unified bashbot.sh"
# last tail of commands.sh
printf '\n##############################\n# bashbot internal functions starts here ...\n\n'
sed -n '/\/commands.sh"/,$ p' bashbot.sh
sed -n '/BASHBOT INTERNAL functions/,$ p' bashbot.sh | head -n -4
} >>$$bashbot.sh