From d3901ba519c98bb0e9f5053bf7d1cdad1b830332 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Fri, 26 Apr 2024 06:20:28 +0300 Subject: [PATCH] Source Update --- src/base.sh | 49 ++++++++++++++++++++--------------------- src/commands/help.sh | 5 ----- src/commands/install.sh | 3 --- wx | 49 ++++++++++++++++++++--------------------- 4 files changed, 48 insertions(+), 58 deletions(-) delete mode 100644 src/commands/install.sh diff --git a/src/base.sh b/src/base.sh index 9cc2ec3..e01302b 100644 --- a/src/base.sh +++ b/src/base.sh @@ -5,50 +5,49 @@ if [ ! "$BASH_VERSION" ] ; then exit 1 fi -warencli-syntax-line-douple() { +syntax-line-douple() { echo -n " ============================== " } -warencli-syntax-line-single() { +syntax-line-single() { echo -n " ------------------------------ " } -warencli-start() { -warencli-syntax-line-douple +start() { +syntax-line-douple echo -n "Warén CLI " -warencli-syntax-line-douple +syntax-line-douple +if [[ -d "./src" ]] +then + 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 +fi + } -warencli-stop () { +stop () { echo " " echo " " exit 1 } -warencli-update() { -if [[ -d "./src" ]]; then - echo ">>> Building... <<<" - 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 - chmod +x wx -else - echo ">>> Updating... <<<" - 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 -fi -} - COMMAND=$1 -warencli-start -if [[ ! -z $1 ]]; then +start +if [[ ! -z $1 ]] && [[ $(type -t warencli-$1) == function ]] +then warencli-$1 $2 $3 $4 $5 $6 $7 $8 $9 fi -warencli-stop +stop diff --git a/src/commands/help.sh b/src/commands/help.sh index f9d2b15..45231ac 100644 --- a/src/commands/help.sh +++ b/src/commands/help.sh @@ -13,10 +13,5 @@ Authentication Commands: Management Commands: settings Settings - -Maintenance Commands: - install Install - update Update "; } - diff --git a/src/commands/install.sh b/src/commands/install.sh deleted file mode 100644 index 6ebf57b..0000000 --- a/src/commands/install.sh +++ /dev/null @@ -1,3 +0,0 @@ -warencli-install() { -echo ">>> Install"; -} diff --git a/wx b/wx index 9cc2ec3..e01302b 100755 --- a/wx +++ b/wx @@ -5,50 +5,49 @@ if [ ! "$BASH_VERSION" ] ; then exit 1 fi -warencli-syntax-line-douple() { +syntax-line-douple() { echo -n " ============================== " } -warencli-syntax-line-single() { +syntax-line-single() { echo -n " ------------------------------ " } -warencli-start() { -warencli-syntax-line-douple +start() { +syntax-line-douple echo -n "Warén CLI " -warencli-syntax-line-douple +syntax-line-douple +if [[ -d "./src" ]] +then + 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 +fi + } -warencli-stop () { +stop () { echo " " echo " " exit 1 } -warencli-update() { -if [[ -d "./src" ]]; then - echo ">>> Building... <<<" - 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 - chmod +x wx -else - echo ">>> Updating... <<<" - 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 -fi -} - COMMAND=$1 -warencli-start -if [[ ! -z $1 ]]; then +start +if [[ ! -z $1 ]] && [[ $(type -t warencli-$1) == function ]] +then warencli-$1 $2 $3 $4 $5 $6 $7 $8 $9 fi -warencli-stop +stop