Merge pull request #1941 from sbt/wip/1940

Wip/1940
This commit is contained in:
eugene yokota 2015-03-25 15:11:58 -07:00
commit 2bbeb4bea9
2 changed files with 28 additions and 2 deletions

View File

@ -13,6 +13,8 @@ import BasicKeys._
import java.io.File
import scala.util.control.NonFatal
object BasicCommands {
lazy val allBasicCommands = Seq(nop, ignore, help, completionsCommand, multi, ifLast, append, setOnFailure, clearOnFailure, stashOnFailure, popOnFailure, reboot, call, early, exit, continuous, history, shell, read, alias) ++ compatCommands
@ -27,7 +29,10 @@ object BasicCommands {
def helpParser(s: State) =
{
val h = (Help.empty /: s.definedCommands)(_ ++ _.help(s))
val h = (Help.empty /: s.definedCommands) { (a, b) =>
a ++
(try b.help(s) catch { case NonFatal(ex) => Help.empty })
}
val helpCommands = h.detail.keySet
val spacedArg = singleArgument(helpCommands).?
applyEffect(spacedArg)(runHelp(s, h))
@ -35,7 +40,12 @@ object BasicCommands {
def runHelp(s: State, h: Help)(arg: Option[String]): State =
{
val message = Help.message(h, arg)
val message = try
Help.message(h, arg)
catch {
case NonFatal(ex) =>
ex.toString
}
System.out.println(message)
s
}

View File

@ -0,0 +1,16 @@
[@cunei]: https://github.com/cunei
[@eed3si9n]: https://github.com/eed3si9n
[@gkossakowski]: https://github.com/gkossakowski
[@jsuereth]: https://github.com/jsuereth
[@DavidPerezIngeniero]: https://github.com/DavidPerezIngeniero
[1900]: https://github.com/sbt/sbt/issues/1900
[1940]: https://github.com/sbt/sbt/pull/1940
### Changes with compatibility implications
### Improvements
### Fixes
- Captures errors on `help` command. [#1900][1900]/[#1940][1940] by [@DavidPerezIngeniero][@DavidPerezIngeniero]