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() {
|
||||
local stack="$1"
|
||||
shift
|
||||
local -a docker_args=(compose)
|
||||
|
||||
if [[ "${STACKS_FORCE_ANSI:-0}" == "1" ]]; then
|
||||
docker_args+=(--ansi always)
|
||||
fi
|
||||
|
||||
(
|
||||
cd -- "$STACKS_DIR/$stack" || exit 1
|
||||
docker compose "$@"
|
||||
docker "${docker_args[@]}" "$@"
|
||||
)
|
||||
}
|
||||
|
||||
run_stack() {
|
||||
local stack="$1"
|
||||
local action="$2"
|
||||
local show_heading="${3:-1}"
|
||||
|
||||
echo
|
||||
echo "==> $stack: $action"
|
||||
if [[ "$show_heading" == "1" ]]; then
|
||||
echo
|
||||
echo "==> $stack: $action"
|
||||
fi
|
||||
|
||||
case "$action" in
|
||||
up)
|
||||
@@ -289,8 +297,9 @@ run_stack_prefixed() {
|
||||
local action="$2"
|
||||
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
|
||||
[[ -n "$line" ]] || continue
|
||||
printf '[%s] %s\n' "$stack" "$line"
|
||||
done
|
||||
status="${PIPESTATUS[0]}"
|
||||
|
||||
Reference in new issue
Block a user