From 59c77784f33294f35d474af2145593289d2db72b Mon Sep 17 00:00:00 2001 From: Myve Date: Tue, 23 Jul 2024 05:47:32 +0000 Subject: [PATCH] Improve ./up syntax --- firefox/up | 24 ++++++++++++++++++++---- novnc/up | 32 ++++++++++++++++++++++---------- plasma/up | 24 ++++++++++++++++++++---- 3 files changed, 62 insertions(+), 18 deletions(-) diff --git a/firefox/up b/firefox/up index 256603a..fac9971 100755 --- a/firefox/up +++ b/firefox/up @@ -5,7 +5,23 @@ # docker build . \ # --build-arg debug=${debug:-""} \ # --tag ${buildtag:-myvnc/novnc} -case ${1} in - build) docker compose up --build --detach;; - *) docker compose up --detach;; -esac +# Grab options +while [ ${1} ] +do + case ${1} in + -b | --build | b | build ) + build="--build" + ;; + -d | --detach | d | detach ) + detach="--detach" + ;; + bd | db ) + build="--build" + detach="--detach" + ;; + esac + shift +done + +# Compose up +docker compose up ${build} ${detach} diff --git a/novnc/up b/novnc/up index 7054851..d61f15f 100755 --- a/novnc/up +++ b/novnc/up @@ -5,14 +5,26 @@ # docker build . \ # --build-arg debug=${debug:-""} \ # --tag ${buildtag:-myvnc/novnc} -case ${2} in - build) build="--build" - ;; -esac +# Grab options +while [ ${1} ] +do + case ${1} in + -b | --build | b | build ) + build="--build" + ;; + -d | --detach | d | detach ) + detach="--detach" + ;; + bd | db ) + build="--build" + detach="--detach" + ;; + 590[0-9] ) + envar="MYVNC_NOVNC_VNCSSH_PORT=${1}" + ;; + esac + shift +done -if [[ ${1} =~ ^[0-9]+$ ]] -then - MYVNC_NOVNC_VNCSSH_PORT=${1} docker compose up ${build} --detach -else - docker compose up ${build} --detach -fi +# Compose up +${envar} docker compose up ${build} ${detach} diff --git a/plasma/up b/plasma/up index 256603a..fac9971 100755 --- a/plasma/up +++ b/plasma/up @@ -5,7 +5,23 @@ # docker build . \ # --build-arg debug=${debug:-""} \ # --tag ${buildtag:-myvnc/novnc} -case ${1} in - build) docker compose up --build --detach;; - *) docker compose up --detach;; -esac +# Grab options +while [ ${1} ] +do + case ${1} in + -b | --build | b | build ) + build="--build" + ;; + -d | --detach | d | detach ) + detach="--detach" + ;; + bd | db ) + build="--build" + detach="--detach" + ;; + esac + shift +done + +# Compose up +docker compose up ${build} ${detach}