Add logs action to docker-project-manager

This commit is contained in:
Chris King
2025-02-13 16:12:18 -08:00
parent c6c28b2d69
commit 8a7bd95625

View File

@@ -9,9 +9,9 @@ pull_images=false
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
--up|--down|--restart)
--up|--down|--restart|--logs)
if [ -n "$action" ]; then
echo "Error: Cannot specify multiple actions (--up, --down, --restart)"
echo "Error: Cannot specify multiple actions (--up, --down, --restart, --logs)"
exit 1
fi
action="${1#--}" # Remove leading --
@@ -35,7 +35,7 @@ done
# Validate inputs
if [ -z "$action" ]; then
echo "Error: Must specify either --up, --down, or --restart"
echo "Error: Must specify either --up, --down, --restart, or --logs"
exit 1
fi
@@ -77,4 +77,8 @@ for project_name in "${projects[@]}"; do
docker compose up -d
;;
esac
if [ "$action" = "logs" ]; then
docker compose logs --follow
fi
done