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"))"