summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSom Snytt <som.snytt@gmail.com>2014-05-28 13:04:24 -0700
committerSom Snytt <som.snytt@gmail.com>2014-05-28 13:04:24 -0700
commitc8f8782f6a07d1cc3297f22b1798f8e2d562db88 (patch)
treececd1abb2edef65270e664c9d81d748dc4b7569e
parent5551cf66e5b27ae398b527df6fe4247aed1ff307 (diff)
downloadscala-c8f8782f6a07d1cc3297f22b1798f8e2d562db88.tar.gz
scala-c8f8782f6a07d1cc3297f22b1798f8e2d562db88.tar.bz2
scala-c8f8782f6a07d1cc3297f22b1798f8e2d562db88.zip
SI-8503 Clean up interpolation of help message
We have interpolation now. This commit also moves an extra blank line from the end to the middle of the message.
-rw-r--r--src/compiler/scala/tools/nsc/GenericRunnerCommand.scala22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala
index e710222285..253f18dec6 100644
--- a/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala
+++ b/src/compiler/scala/tools/nsc/GenericRunnerCommand.scala
@@ -50,17 +50,16 @@ extends CompilerCommand(args, settings) {
case Nil => AsRepl
case hd :: _ => waysToRun find (_.name == settings.howtorun.value) getOrElse guessHowToRun(hd)
}
- private def interpolate(s: String) = s.trim.replaceAll("@cmd@", cmdName).replaceAll("@compileCmd@", compCmdName) + "\n"
- def shortUsageMsg = interpolate("""
-Usage: @cmd@ <options> [<script|class|object|jar> <arguments>]
- or @cmd@ -help
+ def shortUsageMsg =
+s"""|Usage: $cmdName <options> [<script|class|object|jar> <arguments>]
+ | or $cmdName -help
+ |
+ |All options to $compCmdName (see $compCmdName -help) are also allowed.
+""".stripMargin
-All options to @compileCmd@ (see @compileCmd@ -help) are also allowed.
-""")
-
- override def usageMsg = shortUsageMsg + interpolate("""
-The first given argument other than options to @cmd@ designates
+ override def usageMsg = f"""$shortUsageMsg
+The first given argument other than options to $cmdName designates
what to run. Runnable targets are:
- a file containing scala source
@@ -68,7 +67,7 @@ what to run. Runnable targets are:
- a runnable jar file with a valid Main-Class attribute
- or if no argument is given, the repl (interactive shell) is started
-Options to @cmd@ which reach the java runtime:
+Options to $cmdName which reach the java runtime:
-Dname=prop passed directly to java to set system properties
-J<arg> -J is stripped and <arg> passed to java as-is
@@ -86,8 +85,7 @@ A file argument will be run as a scala script unless it contains only
self-contained compilation units (classes and objects) and exactly one
runnable main method. In that case the file will be compiled and the
main method invoked. This provides a bridge between scripts and standard
-scala source.
- """) + "\n"
+scala source.%n"""
}
object GenericRunnerCommand {