mirror of
https://github.com/shadoll/just-commons.git
synced 2026-02-04 04:43:14 +00:00
Refactor: Add follow option to logs command for real-time log streaming
This commit is contained in:
@@ -235,7 +235,7 @@ status service="" compose-file="":
|
|||||||
|
|
||||||
# View logs for specific service or all services
|
# View logs for specific service or all services
|
||||||
[no-cd]
|
[no-cd]
|
||||||
logs service="" compose-file="":
|
logs service="" compose-file="" follow="true":
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -254,12 +254,17 @@ logs service="" compose-file="":
|
|||||||
file_arg="-f $compose_file"
|
file_arg="-f $compose_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
follow_flag=""
|
||||||
|
if [ "{{follow}}" = "true" ]; then
|
||||||
|
follow_flag="-f"
|
||||||
|
fi
|
||||||
|
|
||||||
if [ -n "$service" ]; then
|
if [ -n "$service" ]; then
|
||||||
echo -e "{{BLUE}}Showing logs for: $service{{NORMAL}}"
|
echo -e "{{BLUE}}Showing logs for: $service{{NORMAL}}"
|
||||||
$compose_cmd $file_arg logs -f "$service"
|
$compose_cmd $file_arg logs $follow_flag "$service"
|
||||||
else
|
else
|
||||||
echo -e "{{BLUE}}Showing logs for all services{{NORMAL}}"
|
echo -e "{{BLUE}}Showing logs for all services{{NORMAL}}"
|
||||||
$compose_cmd $file_arg logs -f
|
$compose_cmd $file_arg logs $follow_flag
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Open shell in specific container
|
# Open shell in specific container
|
||||||
|
|||||||
Reference in New Issue
Block a user