Add help for 'show' command. Fixes #236.

This commit is contained in:
Mark Harrah 2011-10-20 22:59:30 -04:00
parent 2fcbaaf4fa
commit 078b72ee48
3 changed files with 16 additions and 3 deletions

View File

@ -10,6 +10,7 @@ package sbt
import DefaultParsers._
import Types.idFun
import java.net.URI
import CommandSupport.ShowCommand
object Act
{
@ -153,7 +154,7 @@ object Act
scopedKeyParser(extracted) flatMap Aggregation.valueParser(state, structure, show)
}
}
def showParser = token( ("show" ~ Space) ^^^ true) ?? false
def showParser = token( (ShowCommand ~ Space) ^^^ true) ?? false
def scopedKeyParser(state: State): Parser[ScopedKey[_]] = scopedKeyParser(Project extract state)
def scopedKeyParser(extracted: Extracted): Parser[ScopedKey[_]] =
{

View File

@ -38,6 +38,7 @@ object CommandSupport
val TasksCommand = "tasks"
val ProjectCommand = "project"
val ProjectsCommand = "projects"
val ShowCommand = "show"
val Exit = "exit"
val Quit = "quit"
@ -49,6 +50,17 @@ EvalCommand + """ <expression>
Evaluates the given Scala expression and prints the result and type.
"""
def actHelp = Help(ShowCommand, (ShowCommand + " <key>", actBrief), actDetailed)
def actBrief = "Displays the result of evaluating the setting or task associated with 'key'."
def actDetailed =
ShowCommand + """ <setting>
Displays the value of the specified setting.
""" + ShowCommand + """ <task>
Evaluates the specified task and display the value returned by the task."""
val LastCommand = "last"
val LastGrepCommand = "last-grep"
@ -109,7 +121,7 @@ SetCommand + """ <setting-expression>
/** The command name to terminate the program.*/
val TerminateAction: String = Exit
def continuousBriefHelp = (ContinuousExecutePrefix + " <action>", "Executes the specified command whenever source files change.")
def continuousBriefHelp = (ContinuousExecutePrefix + " <command>", "Executes the specified command whenever source files change.")
def tasksPreamble = """
This is a list of tasks defined for the current project.

View File

@ -391,7 +391,7 @@ object BuiltinCommands
for(id <- build.defined.keys.toSeq.sorted) log.info("\t" + prefix(id) + id)
}
def act = Command.custom(Act.actParser)
def act = Command.custom(Act.actParser, actHelp :: Nil)
def projects = Command.command(ProjectsCommand, projectsBrief, projectsDetailed ) { s =>
val extracted = Project extract s