summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
diff options
context:
space:
mode:
Diffstat (limited to 'src/compiler/scala/tools/nsc/settings/MutableSettings.scala')
-rw-r--r--src/compiler/scala/tools/nsc/settings/MutableSettings.scala18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
index 7b4c55c2af..822e0f16bf 100644
--- a/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
+++ b/src/compiler/scala/tools/nsc/settings/MutableSettings.scala
@@ -751,11 +751,19 @@ class MutableSettings(val errorFn: String => Unit)
override def isHelping: Boolean = sawHelp
override def help: String = {
- val choiceLength = choices.map(_.length).max + 1
- val formatStr = s" %-${choiceLength}s %s"
- choices.zipAll(descriptions, "", "").map {
- case (arg, descr) => formatStr.format(arg, descr)
- } mkString (f"$descr%n", f"%n", "")
+ val describe: ((String, String)) => String = {
+ val choiceWidth = choices.map(_.length).max + 1
+ val formatStr = s" %-${choiceWidth}s %s"
+ locally {
+ case (choice, description) => formatStr.format(choice, description)
+ }
+ }
+ val verboseDefault = default match {
+ case Some("_" :: Nil) => Some("All choices are enabled by default." :: Nil)
+ case _ => default
+ }
+ val orelse = verboseDefault.map(_.mkString(f"%nDefault: ", ", ", f"%n")).getOrElse("")
+ choices.zipAll(descriptions, "", "").map(describe).mkString(f"${descr}%n", f"%n", orelse)
}
def clear(): Unit = {