summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/CompilerCommand.scala
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-06-06 14:21:06 +0000
committermichelou <michelou@epfl.ch>2007-06-06 14:21:06 +0000
commit83d0d76b1273df16842e76741ac6b9644f79bd7f (patch)
treef814eb8fa3248ae2c1318574b570effc50900bfd /src/compiler/scala/tools/nsc/CompilerCommand.scala
parentf324c3aa0729eae530092a9953c7a2ac69b5f6f8 (diff)
downloadscala-83d0d76b1273df16842e76741ac6b9644f79bd7f.tar.gz
scala-83d0d76b1273df16842e76741ac6b9644f79bd7f.tar.bz2
scala-83d0d76b1273df16842e76741ac6b9644f79bd7f.zip
splitted usage message
Diffstat (limited to 'src/compiler/scala/tools/nsc/CompilerCommand.scala')
-rw-r--r--src/compiler/scala/tools/nsc/CompilerCommand.scala44
1 files changed, 30 insertions, 14 deletions
diff --git a/src/compiler/scala/tools/nsc/CompilerCommand.scala b/src/compiler/scala/tools/nsc/CompilerCommand.scala
index a84dbeb172..0f534c6338 100644
--- a/src/compiler/scala/tools/nsc/CompilerCommand.scala
+++ b/src/compiler/scala/tools/nsc/CompilerCommand.scala
@@ -9,7 +9,7 @@ package scala.tools.nsc
/** A class representing command line info for scalac */
class CompilerCommand(arguments: List[String], val settings: Settings,
- error: String => unit, interactive: boolean) {
+ error: String => Unit, interactive: Boolean) {
private var fs: List[String] = List()
@@ -22,24 +22,40 @@ class CompilerCommand(arguments: List[String], val settings: Settings,
/** The file extension of files that the compiler can process */
val fileEnding = ".scala"
+ private val helpSyntaxColumnWidth: Int =
+ Iterable.max(settings.allSettings map (_.helpSyntax.length))
+
+ private def format(s: String): String = {
+ val buf = new StringBuilder(s)
+ var i = s.length
+ while (i < helpSyntaxColumnWidth) { buf.append(' '); i += 1 }
+ buf.toString()
+ }
+
/** A message explaining usage and options */
def usageMsg: String = {
- // todo: print -X and -javadoc options only on demand
- val helpSyntaxColumnWidth: int =
- Iterable.max(settings.allSettings map (_.helpSyntax.length))
- def format(s: String): String = {
- val buf = new StringBuilder(s)
- var i = s.length
- while (i < helpSyntaxColumnWidth) { buf.append(' '); i += 1 }
- buf.toString()
- }
settings.allSettings
+ .filter(setting =>
+ setting.isStandard &&
+ (settings.doc.value == setting.isDocOption))
+ .map(setting =>
+ format(setting.helpSyntax) + " " + setting.helpDescription)
+ .mkString("Usage: " + cmdName + " <options | source files>\n" +
+ "where possible standard options include:\n",
+ "\n",
+ "\n")
+ }
+
+ /** A message explaining usage and options */
+ def xusageMsg: String = {
+ settings.allSettings
+ .filter(setting =>
+ !setting.isStandard &&
+ (settings.doc.value == setting.isDocOption))
.map(setting =>
format(setting.helpSyntax) + " " + setting.helpDescription)
- .mkString(
- "Usage: " + cmdName + " <options | source files>\n" +
- "where possible options include: \n ",
- "\n ",
+ .mkString("Possible non-standard options include:\n",
+ "\n",
"\n")
}