mirror of https://github.com/sbt/sbt.git
commit
2bbeb4bea9
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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]
|
||||
Loading…
Reference in New Issue