From 364218dcdc9245e90432bb070dee34891d090dc4 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Tue, 23 Oct 2018 15:46:34 +0200 Subject: [PATCH] new: ``logs`` command has a ``--tail 10`` default parameter. --- bin/compose | 6 ++++++ test/test | 8 ++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/bin/compose b/bin/compose index c48042b..e6b9c74 100755 --- a/bin/compose +++ b/bin/compose @@ -2896,6 +2896,12 @@ case "$action" in fi launch_docker_compose "${compose_opts[@]}" "$action" "${action_opts[@]}" "${action_posargs[@]}" "${remainder_args[@]}" ;; + logs) + if ! array_member action_opts --tail; then ## force daemon mode for up + action_opts+=("--tail" "10") + fi + launch_docker_compose "${compose_opts[@]}" "$action" "${action_opts[@]}" "${action_posargs[@]}" "${remainder_args[@]}" + ;; "") launch_docker_compose "${compose_opts[@]}" ;; diff --git a/test/test b/test/test index 690e514..d8cda0e 100755 --- a/test/test +++ b/test/test @@ -1317,8 +1317,8 @@ expected="docker-compose run -T web_site" cd "$test_tmpdir" -out=\$("$tprog" --dry-compose-run logs -ft web_site 2>&1 >/dev/null) -expected="docker-compose logs -f -t web_site" +out=\$("$tprog" --dry-compose-run logs -ft --tail 20 web_site 2>&1 >/dev/null) +expected="docker-compose logs -f -t --tail 20 web_site" [ "\$out" == "\$expected" ] || { echo -e "DIFF:\n\$(diff <(echo "\$out") <(echo "\$expected"))" @@ -1380,8 +1380,8 @@ expected_reg="Unknown option '-Z'" cd "$test_tmpdir" -out=\$("$tprog" --dry-compose-run logs web_site mysql 2>&1 >/dev/null) -expected="docker-compose logs web_site mysql" +out=\$("$tprog" --dry-compose-run logs --tail 15 web_site mysql 2>&1 >/dev/null) +expected="docker-compose logs --tail 15 web_site mysql" [ "\$out" == "\$expected" ] || { echo -e "DIFF:\n\$(diff <(echo "\$out") <(echo "\$expected"))"