mirror of https://github.com/sbt/sbt.git
Merge pull request #4237 from eed3si9n/wip/help-sbt-new
Fixes `sbt help new` not working as batch command
This commit is contained in:
commit
0dfab79d8d
|
|
@ -43,8 +43,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.")
|
||||||
|
|
|
||||||
|
|
@ -116,10 +116,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.
|
||||||
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
# Issue 732: reload followed by a command that results in an error exits in interactive mode
|
# Issue 732: reload followed by a command that results in an error exits in interactive mode
|
||||||
-> ;reload;not-a-command
|
-> ;reload;not-a-command
|
||||||
> help
|
> about
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
# just need to verify it loads
|
# just need to verify it loads
|
||||||
> help
|
> about
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
> help
|
> about
|
||||||
$ copy-file changes/build.properties project/build.properties
|
$ copy-file changes/build.properties project/build.properties
|
||||||
> reload
|
> reload
|
||||||
> checkSbtVersionWarning
|
> checkSbtVersionWarning
|
||||||
|
|
|
||||||
|
|
@ -9,5 +9,5 @@ $ delete bad.sbt
|
||||||
|
|
||||||
# due to the previous reload failing, this will force the project to be reloaded first
|
# due to the previous reload failing, this will force the project to be reloaded first
|
||||||
# and this should then succeed
|
# and this should then succeed
|
||||||
> help
|
> about
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,2 @@
|
||||||
# just need to verify it loads
|
# just need to verify it loads
|
||||||
> help
|
> about
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue