mirror of https://github.com/sbt/sbt.git
fix sbt help new does not explain how to use sbt new
This commit is contained in:
parent
bcd21ba9b6
commit
27a30a933a
|
|
@ -41,8 +41,14 @@ $HelpCommand <regular expression>
|
||||||
def CompletionsBrief = (CompletionsCommand, CompletionsDetailed)
|
def CompletionsBrief = (CompletionsCommand, CompletionsDetailed)
|
||||||
|
|
||||||
def templateBrief = (TemplateCommand, "Creates a new sbt build.")
|
def templateBrief = (TemplateCommand, "Creates a new sbt build.")
|
||||||
def templateDetailed = TemplateCommand + """ [--options] <template>
|
def templateDetailed =
|
||||||
Create a new sbt build based on the given template."""
|
TemplateCommand + """ [--options] <template>
|
||||||
|
Create a new sbt build based on the given template.
|
||||||
|
sbt provides out-of-the-box support for Giter8 templates. See foundweekends.org/giter8/ for details.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
sbt new scala/scala-seed.g8
|
||||||
|
"""
|
||||||
|
|
||||||
def HistoryHelpBrief =
|
def HistoryHelpBrief =
|
||||||
(HistoryCommands.Start -> "History command help. Lists and describes all history commands.")
|
(HistoryCommands.Start -> "History command help. Lists and describes all history commands.")
|
||||||
|
|
|
||||||
|
|
@ -87,10 +87,20 @@ object BasicCommands {
|
||||||
}
|
}
|
||||||
|
|
||||||
def runHelp(s: State, h: Help)(arg: Option[String]): State = {
|
def runHelp(s: State, h: Help)(arg: Option[String]): State = {
|
||||||
val message = try Help.message(h, arg)
|
|
||||||
|
val (extraArgs, remainingCommands) = s.remainingCommands match {
|
||||||
|
case xs :+ exec if exec.commandLine == "shell" => (xs, exec :: Nil)
|
||||||
|
case xs => (xs, Nil)
|
||||||
|
}
|
||||||
|
|
||||||
|
val topic = (arg.toList ++ extraArgs.map(_.commandLine)) match {
|
||||||
|
case Nil => None
|
||||||
|
case xs => Some(xs.mkString(" "))
|
||||||
|
}
|
||||||
|
val message = try Help.message(h, topic)
|
||||||
catch { case NonFatal(ex) => ex.toString }
|
catch { case NonFatal(ex) => ex.toString }
|
||||||
System.out.println(message)
|
System.out.println(message)
|
||||||
s
|
s.copy(remainingCommands = remainingCommands)
|
||||||
}
|
}
|
||||||
|
|
||||||
def completionsCommand: Command =
|
def completionsCommand: Command =
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
[@panaeon]: https://github.com/panaeon
|
||||||
|
|
||||||
|
[#2932]: https://github.com/sbt/sbt/issues/2939
|
||||||
|
|
||||||
|
### Bug fixes
|
||||||
|
|
||||||
|
- Make sure that when `sbt help <command>` is executed from the command line it behaves similar to `sbt "help <command>"`.
|
||||||
|
- Add basic example and link to gitter8 templates page to `sbt new` help message.
|
||||||
|
|
||||||
|
### Note:
|
||||||
|
Unfortunately `sbt help shell` will print default general help message and drop to the sbt shell instead of displaying sbt shell help.
|
||||||
|
Also now `help` command will consume commands after it so `;help smth; other cmd` will not work.
|
||||||
|
|
||||||
Loading…
Reference in New Issue