feat: improve management command help
This commit is contained in:
1 parent
1143ae9f62
commit
e483a4ec3a
1 file changed
+40
-30
@@ -33,8 +33,8 @@ die() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
if ((BASH_VERSINFO[0] < 5 ||
|
||||
(BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] < 1))); then
|
||||
if ((BASH_VERSINFO[0] < 5 || (\
|
||||
BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] < 1))); then
|
||||
die "Bash 5.1 or newer is required"
|
||||
fi
|
||||
|
||||
@@ -57,28 +57,34 @@ usage() {
|
||||
cat <<EOF
|
||||
Usage: $(basename "$0") COMMAND [STACK]
|
||||
|
||||
Commands:
|
||||
up Create and start containers
|
||||
start Start existing containers
|
||||
stop Stop containers
|
||||
restart Restart containers
|
||||
down Stop and remove containers and networks
|
||||
pull Pull images
|
||||
update Pull images and apply Compose changes
|
||||
ps Show container status
|
||||
logs Follow logs for a stack
|
||||
config Render Compose configuration for a stack
|
||||
images Show configured images and versions
|
||||
list List discovered stacks and their stage/status
|
||||
Lifecycle:
|
||||
up [STACK] Create and start containers
|
||||
start [STACK] Start existing containers
|
||||
stop [STACK] Stop containers
|
||||
restart [STACK] Restart containers
|
||||
down [STACK] Stop and remove containers and networks
|
||||
pull [STACK] Pull images
|
||||
update [STACK] Pull images and apply Compose changes
|
||||
|
||||
Bulk execution:
|
||||
up/start/restart/pull/update run before, default, then after.
|
||||
stop/down run the same stages in reverse order.
|
||||
Each before/after declaration creates an ordered stage.
|
||||
Stacks within a stage run in parallel up to its configured limit.
|
||||
ps/images/list keep ordered output.
|
||||
Inspect:
|
||||
ps [STACK] Show container status
|
||||
logs STACK Follow logs
|
||||
config STACK Render Compose configuration
|
||||
images [STACK] Show configured images and versions
|
||||
list List stacks, stages, and management status
|
||||
help, -h, --help Show this help
|
||||
|
||||
Configuration: $CONFIG_FILE
|
||||
Stage configuration:
|
||||
max_parallel N Set default concurrency (0 = unlimited)
|
||||
before [--parallel N] STACK... Add an early stage
|
||||
after [--parallel N] STACK... Add a late stage
|
||||
exclude STACK... Exclude stacks from bulk operations
|
||||
|
||||
Each before/after declaration is one ordered stage; unlisted stacks form
|
||||
the default stage. Lifecycle commands run before -> default -> after,
|
||||
reversed for stop/down. A failed stage skips all remaining stages.
|
||||
|
||||
Config: $CONFIG_FILE
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -590,16 +596,23 @@ acquire_lock() {
|
||||
die "another manage.sh operation is already running"
|
||||
}
|
||||
|
||||
load_config
|
||||
discover_stacks
|
||||
validate_config_stacks
|
||||
build_execution_stages
|
||||
|
||||
ACTION="${1:-}"
|
||||
TARGET="${2:-}"
|
||||
|
||||
[[ $# -le 2 ]] || die "too many arguments"
|
||||
|
||||
case "$ACTION" in
|
||||
help | -h | --help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
load_config
|
||||
discover_stacks
|
||||
validate_config_stacks
|
||||
build_execution_stages
|
||||
|
||||
case "$ACTION" in
|
||||
up | start | stop | restart | down | pull | update)
|
||||
acquire_lock
|
||||
@@ -634,9 +647,6 @@ list)
|
||||
[[ -z "$TARGET" ]] || die "list does not accept a stack name"
|
||||
list_stacks
|
||||
;;
|
||||
help | -h | --help)
|
||||
usage
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
|
||||
Reference in new issue
Block a user