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