fix: streamline parallel stack output
This commit is contained in:
1 parent
5e20bc70af
commit
c76b2dfb9d
1 file changed
+13
-4
@@ -254,19 +254,27 @@ stack_group() {
|
|||||||
compose() {
|
compose() {
|
||||||
local stack="$1"
|
local stack="$1"
|
||||||
shift
|
shift
|
||||||
|
local -a docker_args=(compose)
|
||||||
|
|
||||||
|
if [[ "${STACKS_FORCE_ANSI:-0}" == "1" ]]; then
|
||||||
|
docker_args+=(--ansi always)
|
||||||
|
fi
|
||||||
|
|
||||||
(
|
(
|
||||||
cd -- "$STACKS_DIR/$stack" || exit 1
|
cd -- "$STACKS_DIR/$stack" || exit 1
|
||||||
docker compose "$@"
|
docker "${docker_args[@]}" "$@"
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
run_stack() {
|
run_stack() {
|
||||||
local stack="$1"
|
local stack="$1"
|
||||||
local action="$2"
|
local action="$2"
|
||||||
|
local show_heading="${3:-1}"
|
||||||
|
|
||||||
echo
|
if [[ "$show_heading" == "1" ]]; then
|
||||||
echo "==> $stack: $action"
|
echo
|
||||||
|
echo "==> $stack: $action"
|
||||||
|
fi
|
||||||
|
|
||||||
case "$action" in
|
case "$action" in
|
||||||
up)
|
up)
|
||||||
@@ -289,8 +297,9 @@ run_stack_prefixed() {
|
|||||||
local action="$2"
|
local action="$2"
|
||||||
local line status
|
local line status
|
||||||
|
|
||||||
run_stack "$stack" "$action" 2>&1 |
|
STACKS_FORCE_ANSI=1 run_stack "$stack" "$action" 0 2>&1 |
|
||||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
|
[[ -n "$line" ]] || continue
|
||||||
printf '[%s] %s\n' "$stack" "$line"
|
printf '[%s] %s\n' "$stack" "$line"
|
||||||
done
|
done
|
||||||
status="${PIPESTATUS[0]}"
|
status="${PIPESTATUS[0]}"
|
||||||
|
|||||||
Reference in new issue
Block a user