From c57c950e92a9ccf74cb16717a41aeced20920b41 Mon Sep 17 00:00:00 2001 From: exoego Date: Fri, 19 Jul 2019 08:32:41 +0900 Subject: [PATCH] Improve message since sbtVersion may vary for different projects --- integration-test/src/test/scala/RunnerTest.scala | 10 ++++++++++ src/universal/bin/sbt | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/integration-test/src/test/scala/RunnerTest.scala b/integration-test/src/test/scala/RunnerTest.scala index 708ab13e1..30cca6b5e 100644 --- a/integration-test/src/test/scala/RunnerTest.scala +++ b/integration-test/src/test/scala/RunnerTest.scala @@ -79,4 +79,14 @@ object SbtRunnerTest extends SimpleTestSuite with PowerAssertions { () } + test("sbt -V|-version should print sbtVersion") { + val out = sbtProcessWithOpts("-version", "", "").!!.trim + val expectedVersion = "^sbt version in this project: \\d\\.\\d+\\.\\d+\\S*$" + assert(out.matches(expectedVersion)) + + val out2 = sbtProcessWithOpts("-V", "", "").!!.trim + assert(out2.matches(expectedVersion)) + () + } + } diff --git a/src/universal/bin/sbt b/src/universal/bin/sbt index 954c25c9f..a630386ee 100755 --- a/src/universal/bin/sbt +++ b/src/universal/bin/sbt @@ -378,7 +378,7 @@ run() { if [[ $print_sbt_version ]]; then # print sbtVersion - execRunner "$java_cmd" -jar "$sbt_jar" "sbtVersion" | tail -1 + execRunner "$java_cmd" -jar "$sbt_jar" "sbtVersion" | tail -1 | sed -e 's/\[info\]/sbt version in this project:/g' else # run sbt execRunner "$java_cmd" \