Skip to content

Commit

Permalink
added stop stack menu voice and function
Browse files Browse the repository at this point in the history
  • Loading branch information
MRColorR committed Nov 5, 2022
1 parent 1a8cdb9 commit 9678715
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
36 changes: 30 additions & 6 deletions runme.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ function fn_setupEnv {
}

function fn_startStack {
Clear-Host
Write-Output "This menu item will launch all the apps using the configured .env file and the docker-compose.yml file (Docker must be already installed and running)"
$yn = Read-Host -prompt "Do you wish to proceed Y/N?"
if ($yn -eq 'Y' -or $yn -eq 'y' -or $yn -eq 'Yes' -or $yn -eq 'yes' ) {
Expand All @@ -346,6 +347,25 @@ function fn_startStack {
}
}

function fn_stopStack() {
Clear-Host
Write-Output "This menu item will stop all the apps and delete the docker stack previously created using the configured .env file and the docker-compose.yml file."
Write-Output "You don't need to use this command to temporarily pause apps or to update the stack. Use it only in case of uninstallation!"
$yn = Read-Host -prompt "Do you wish to proceed Y/N?"
if ($yn -eq 'Y' -or $yn -eq 'y' -or $yn -eq 'Yes' -or $yn -eq 'yes' ) {
docker compose down
Write-Output "All Apps stopped and stack deleted.";
Read-Host "Now press enter to go back to the menu";
mainmenu;
}
else {
Write-Output "Docker stack removal canceled.";
Read-Host -prompt "Press Enter to go back to mainmenu";
mainmenu; ;
}

}

function fn_resetEnv {
Write-Output "Now a fresh env file will be downloaded and will need to be configured to be used again"
$yn = Read-Host -prompt "Do you wish to proceed Y/N? "
Expand Down Expand Up @@ -384,9 +404,10 @@ function mainmenu {
Write-Output "2) Install Docker"
Write-Output "3) Setup .env file"
Write-Output "4) Start apps stack"
Write-Output "5) Reset .env File"
Write-Output "6) Reset docker-compose.yml file"
Write-Output "7) Exit"
Write-Output "5) Stop apps stack"
Write-Output "6) Reset .env File"
Write-Output "7) Reset docker-compose.yml file"
Write-Output "8) Exit"
Do {
$Select = Read-Host
Switch ($Select) {
Expand All @@ -403,20 +424,23 @@ function mainmenu {
fn_startStack
}
5 {
fn_resetEnv
fn_stopStack
}
6 {
fn_resetDockerCompose
fn_resetEnv
}
7 {
fn_resetDockerCompose
}
8 {
fn_bye
}
DEFAULT {
fn_unknown
}
}
}
While ($Select -ne 6)
While ($Select -ne 8)
}

### Startup ##
Expand Down
18 changes: 15 additions & 3 deletions runme.sh
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,17 @@ fn_startStack(){
esac
}

fn_stopStack(){
yellowprint "This menu item will stop all the apps and delete the docker stack previously created using the configured .env file and the docker-compose.yml file."
yellowprint "You don't need to use this command to temporarily pause apps or to update the stack. Use it only in case of uninstallation!"
read -r -p "Do you wish to proceed Y/N? " yn
case $yn in
[Yy]* ) sudo docker compose down; greenprint "All Apps stopped and stack deleted."; read -r -p "Now press enter to go back to the menu"; mainmenu;;
[Nn]* ) blueprint "Docker stack removal canceled.";read -r -p "Press Enter to go back to mainmenu"; mainmenu;;
* ) printf "Please answer yes or no.";;
esac
}

fn_resetEnv(){
redprint "Now a fresh env file will be downloaded and will need to be configured to be used again"
read -r -p "Do you wish to proceed Y/N? " yn
Expand All @@ -314,7 +325,7 @@ mainmenu() {
clear;
PS3="Select an option and press Enter "

items=("Show apps' links to register or go to dashboard" "Install Docker" "Setup .env file" "Start apps stack" "Reset .env File" "Reset docker-compose.yml file")
items=("Show apps' links to register or go to dashboard" "Install Docker" "Setup .env file" "Start apps stack" "Stop apps stack" "Reset .env File" "Reset docker-compose.yml file")

select item in "${items[@]}" Quit
do
Expand All @@ -323,8 +334,9 @@ mainmenu() {
2) clear; fn_dockerInstall; break;;
3) clear; fn_setupEnv; break;;
4) clear; fn_startStack; break;;
5) clear; fn_resetEnv; break;;
6) clear; fn_resetDockerCompose; break;;
5) clear; fn_stopStack; break;;
6) clear; fn_resetEnv; break;;
7) clear; fn_resetDockerCompose; break;;
$((${#items[@]}+1))) fn_bye;;
*) clear; fn_unknown; break;;
esac
Expand Down

0 comments on commit 9678715

Please sign in to comment.