wx/src/base.sh

55 lines
1023 B
Bash
Raw Normal View History

2024-04-26 01:32:38 +00:00
#!/bin/bash
if [ ! "$BASH_VERSION" ] ; then
bash $0 $1 $2 $3 $4 $5 $6 $7 $8 $9
exit 1
fi
2024-04-26 03:20:28 +00:00
syntax-line-douple() {
2024-04-26 01:32:38 +00:00
echo -n "
==============================
"
}
2024-04-26 03:20:28 +00:00
syntax-line-single() {
2024-04-26 01:32:38 +00:00
echo -n "
------------------------------
"
}
2024-04-26 03:20:28 +00:00
start() {
2024-04-26 03:34:52 +00:00
syntax-line-douple
echo -n "Warén CLI "
syntax-line-douple
2024-04-26 03:20:28 +00:00
}
stop () {
2024-04-26 03:34:52 +00:00
if [[ -d "./src" ]]
2024-04-26 03:22:52 +00:00
then
2024-04-26 03:34:52 +00:00
podman run -it --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp docker.io/library/php:8-cli php generator.php &> /dev/null
mv wx.tmp wx &> /dev/null
chmod +x wx &> /dev/null
else
sudo curl https://git.waren.io/warengroup/wx/raw/branch/master/wx -o /opt/wx &> /dev/null
if [[ -d "/usr/bin" ]]
then
sudo ln -sf /opt/wx /usr/bin/wx &> /dev/null
fi
sudo chmod +x /usr/bin/wx &> /dev/null
2024-04-26 03:22:52 +00:00
fi
2024-04-26 03:34:52 +00:00
echo " "
echo " "
exit 1
2024-04-26 01:32:38 +00:00
}
2024-04-26 03:25:59 +00:00
{{ COMMANDS }}
2024-04-26 01:32:38 +00:00
COMMAND=$1
2024-04-26 03:20:28 +00:00
start
if [[ ! -z $1 ]] && [[ $(type -t warencli-$1) == function ]]
then
2024-04-26 01:32:38 +00:00
warencli-$1 $2 $3 $4 $5 $6 $7 $8 $9
fi
2024-04-26 03:20:28 +00:00
stop