Skip to content

Commit

Permalink
made command's choiches more clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Crisis82 committed Jul 12, 2023
1 parent c5e33c5 commit 935bf32
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions start_stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@ ORANGE="#F09483"
[[ $(groups | grep docker | wc -l) -eq 1 ]] && DOCKER="docker" || DOCKER="sudo docker"
# PASS=$(gum input --password --placeholder "your user password" --header "Sudo password to run docker" --header.foreground "$WHITE")# if [[ $(groups | grep docker | wc -l) -eq 1 ]]

CHOICE=$(gum choose --cursor.foreground "$ORANGE" --item.faint "Up (Directly)" "Up (Build)" "Down" "Exit" --header "What do you want to do with the Farmer?" --header.foreground "$WHITE")

CHOICE=$(gum choose --cursor.foreground "$ORANGE" --item.faint "Build" "Start" "Stop" "Exit" --header "What do you want to do with the Farmer?" --header.foreground "$WHITE")
if [[ $CHOICE == "Exit" ]]
then
echo "Bye :snake:" | gum format -t emoji | gum style --align center --padding "1 6"
exit 1
fi

# LOGS=$(gum choose --cursor.foreground "$ORANGE" --item.faint "Yes" " No" --header "Show logs?" --header.foreground "$WHITE")
# [[ $LOGS == "Yes" ]] && LOGS="--show-output" || LOGS=""

if [[ $CHOICE == "Build" ]]
if [[ $CHOICE == "Up (Build)" ]]
then
gum spin -s line --title "Taking container down ..." -- $DOCKER compose down
gum spin -s line --title "Rebuilding container ..." -- $DOCKER compose up -d --build
gum spin -s line --title "Building container ..." -- $DOCKER compose up -d --build
if [[ $($DOCKER container ls | grep server-app | wc -l) -eq 1 ]]
then
echo "Container correctly $(gum style --foreground "$GREEN" --bold "UP")"
else
echo "$(gum style --foreground "$RED" --bold "Something went wrong") ... Aborting"
exit 1
fi
elif [[ $CHOICE == "Start" ]]
elif [[ $CHOICE == "Up (Directly)" ]]
then
if [[ $($DOCKER container ls | grep server-app | wc -l) -eq 1 ]]
then
Expand All @@ -49,7 +56,7 @@ then
echo "$(gum style --foreground "$RED" --bold "Something went wrong") ... Aborting"
exit 1
fi
elif [[ $CHOICE == "Stop" ]]
elif [[ $CHOICE == "Down" ]]
then
if [[ $($DOCKER container ls | grep server-app | wc -l) -eq 1 ]]
then
Expand Down

0 comments on commit 935bf32

Please sign in to comment.