remove unwanted comments from standalone scripts

This commit is contained in:
Kay Marquardt (Gnadelwartz) 2020-11-30 18:36:21 +01:00
parent aac3ddf45f
commit c50499c7ff

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$$ v1.1-0-gc0eb399
#### $$VERSION$$ v1.2-pre2-3-gaac3ddf
# magic to ensure that we're always inside the root of our application,
# no matter from which directory we'll run script
@ -38,7 +38,7 @@ echo " ... create unified commands.sh"
{
# first head of commands.sh
sed -n '0,/^if / p' commands.sh | head -n -2
sed -n '0,/^if / p' commands.sh | grep -v -F -e "___" -e "*MUST*" -e "mycommands.sh.dist" -e "mycommands.sh.clean"| head -n -2
# then mycommands from first non comment line on
printf '\n##############################\n# my commands starts here ...\n'
@ -77,7 +77,7 @@ rm -rf modules
echo "Create minimized Version of bashbot.sh and commands.sh"
sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e '/^$/d' -e 'N;s/\\\n/ /;P;D' bashbot.sh |\
sed 'N;s/\\\n/ /;P;D' > bashbot.sh.min
sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e '/^$/d' commands.sh |\
sed -E -e '/(shellcheck)|(#!\/bin\/bash)/! s/^[[:space:]]*#.*//' -e 's/^[[:space:]]*//' -e 's/\)[[:space:]]+#.*/)/' -e '/^$/d' commands.sh |\
sed 'N;s/\\\n/ /;P;D' > commands.sh.min
chmod +x bashbot.sh.min