feat: Add 'stop all' to stop all running containers

- ./winctl.sh stop all finds and stops all running containers
- Updated help, WINCTL_GUIDE.md, and readme.md

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Michel Abboud 2026-01-29 00:54:47 +00:00
parent 23cc434703
commit 8864309c7d
3 changed files with 23 additions and 1 deletions

View File

@ -173,6 +173,9 @@ Stop containers with a 2-minute grace period for clean shutdown.
# Stop multiple versions # Stop multiple versions
./winctl.sh stop win11 win10 ./winctl.sh stop win11 win10
# Stop all running containers
./winctl.sh stop all
# Interactive menu # Interactive menu
./winctl.sh stop ./winctl.sh stop
``` ```

View File

@ -91,6 +91,7 @@ Use `winctl.sh` for easy container management:
# Stop containers (with confirmation) # Stop containers (with confirmation)
./winctl.sh stop win11 ./winctl.sh stop win11
./winctl.sh stop all # Stop all running
# View logs # View logs
./winctl.sh logs win11 -f ./winctl.sh logs win11 -f

View File

@ -743,6 +743,23 @@ cmd_start() {
cmd_stop() { cmd_stop() {
local versions=("$@") local versions=("$@")
# Stop all running containers
if [[ ${#versions[@]} -eq 1 && "${versions[0]}" == "all" ]]; then
versions=()
refresh_status_cache
for v in "${ALL_VERSIONS[@]}"; do
local status
status=$(get_status "$v")
if [[ "$status" == "running" ]]; then
versions+=("$v")
fi
done
if [[ ${#versions[@]} -eq 0 ]]; then
info "No running containers found"
return 0
fi
fi
# Interactive selection if no versions specified # Interactive selection if no versions specified
if [[ ${#versions[@]} -eq 0 ]]; then if [[ ${#versions[@]} -eq 0 ]]; then
local selected local selected
@ -1185,7 +1202,7 @@ show_usage() {
printf '\n' printf '\n'
printf '%b\n' "${BOLD}COMMANDS${RESET}" printf '%b\n' "${BOLD}COMMANDS${RESET}"
printf ' %b [version...] Start container(s), interactive if no version\n' "${BOLD}start${RESET}" printf ' %b [version...] Start container(s), interactive if no version\n' "${BOLD}start${RESET}"
printf ' %b [version...] Stop container(s) with 2-min grace period\n' "${BOLD}stop${RESET}" printf ' %b [version...|all] Stop container(s) or all running\n' "${BOLD}stop${RESET}"
printf ' %b [version...] Restart container(s)\n' "${BOLD}restart${RESET}" printf ' %b [version...] Restart container(s)\n' "${BOLD}restart${RESET}"
printf ' %b [version...] Show status of container(s)\n' "${BOLD}status${RESET}" printf ' %b [version...] Show status of container(s)\n' "${BOLD}status${RESET}"
printf ' %b <version> [-f] View container logs (-f to follow)\n' "${BOLD}logs${RESET}" printf ' %b <version> [-f] View container logs (-f to follow)\n' "${BOLD}logs${RESET}"
@ -1211,6 +1228,7 @@ show_usage() {
printf ' %s start win11 # Start Windows 11\n' "${SCRIPT_NAME}" printf ' %s start win11 # Start Windows 11\n' "${SCRIPT_NAME}"
printf ' %s start win11 win10 # Start multiple\n' "${SCRIPT_NAME}" printf ' %s start win11 win10 # Start multiple\n' "${SCRIPT_NAME}"
printf ' %s stop win11 # Stop with confirmation\n' "${SCRIPT_NAME}" printf ' %s stop win11 # Stop with confirmation\n' "${SCRIPT_NAME}"
printf ' %s stop all # Stop all running\n' "${SCRIPT_NAME}"
printf ' %s status # Show all containers\n' "${SCRIPT_NAME}" printf ' %s status # Show all containers\n' "${SCRIPT_NAME}"
printf ' %s logs win11 -f # Follow logs\n' "${SCRIPT_NAME}" printf ' %s logs win11 -f # Follow logs\n' "${SCRIPT_NAME}"
printf ' %s list desktop # List desktop versions\n' "${SCRIPT_NAME}" printf ' %s list desktop # List desktop versions\n' "${SCRIPT_NAME}"