wx/src/base.sh

54 lines
918 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() {
syntax-line-douple
2024-04-26 01:32:38 +00:00
echo -n "Warén CLI "
2024-04-26 03:20:28 +00:00
syntax-line-douple
if [[ -d "./src" ]]
then
2024-04-26 02:49:45 +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
2024-04-26 03:20:28 +00:00
mv wx.tmp wx &> /dev/null
chmod +x wx &> /dev/null
2024-04-26 01:32:38 +00:00
else
2024-04-26 01:58:29 +00:00
sudo curl https://git.waren.io/warengroup/wx/raw/branch/master/wx -o /opt/wx &> /dev/null
2024-04-26 03:20:28 +00:00
if [[ -d "/usr/bin" ]]
then
2024-04-26 01:58:29 +00:00
sudo ln -sf /opt/wx /usr/bin/wx &> /dev/null
fi
sudo chmod +x /usr/bin/wx &> /dev/null
2024-04-26 01:32:38 +00:00
fi
2024-04-26 03:20:28 +00:00
}
stop () {
echo " "
echo " "
exit 1
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