mirror of https://github.com/sbt/sbt.git
separate out help message functions
This commit is contained in:
parent
74438d0c72
commit
53e7960976
|
|
@ -30,23 +30,16 @@ object BasicCommands
|
|||
val spacedArg = singleArgument(helpCommands).?
|
||||
applyEffect(spacedArg)(runHelp(s, h))
|
||||
}
|
||||
|
||||
def runHelp(s: State, h: Help)(arg: Option[String]): State =
|
||||
{
|
||||
val message = arg match {
|
||||
case Some(x) => detail(x, h.detail)
|
||||
case None =>
|
||||
val brief = aligned(" ", " ", h.brief).mkString("\n", "\n", "\n")
|
||||
val more = h.more.toSeq.sorted
|
||||
if(more.isEmpty)
|
||||
brief
|
||||
else
|
||||
brief + "\n" + moreHelp(more)
|
||||
}
|
||||
val message = Help.message(h, arg)
|
||||
System.out.println(message)
|
||||
s
|
||||
}
|
||||
def moreHelp(more: Seq[String]): String =
|
||||
more.mkString("More command help available using 'help <command>' for:\n ", ", ", "\n")
|
||||
@deprecated("Use Help.moreMessage", "0.13.0")
|
||||
def moreHelp(more: Seq[String]): String = Help.moreMessage(more)
|
||||
|
||||
|
||||
def multiParser(s: State): Parser[Seq[String]] =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -139,6 +139,22 @@ object Help
|
|||
def briefDetail(help: Seq[(String, String)]): Help = apply(help, help.toMap)
|
||||
def briefOnly(help: Seq[(String, String)]): Help = apply(help, Map.empty[String,String])
|
||||
def detailOnly(help: Seq[(String, String)]): Help = apply(Nil, help.toMap)
|
||||
|
||||
import CommandUtil._
|
||||
|
||||
def message(h: Help, arg: Option[String]): String =
|
||||
arg match {
|
||||
case Some(x) => detail(x, h.detail)
|
||||
case None =>
|
||||
val brief = aligned(" ", " ", h.brief).mkString("\n", "\n", "\n")
|
||||
val more = h.more.toSeq.sorted
|
||||
if(more.isEmpty)
|
||||
brief
|
||||
else
|
||||
brief + "\n" + moreMessage(more)
|
||||
}
|
||||
def moreMessage(more: Seq[String]): String =
|
||||
more.mkString("More command help available using 'help <command>' for:\n ", ", ", "\n")
|
||||
}
|
||||
trait CommandDefinitions extends (State => State)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue