Merge pull request #2000 from dwijnand/command-to-string

Implement SimpleCommand.toString. Fixes #1998.
This commit is contained in:
eugene yokota 2015-05-07 10:45:16 -07:00
commit c1952698e4
4 changed files with 20 additions and 0 deletions

View File

@ -17,6 +17,7 @@ private[sbt] final class SimpleCommand(val name: String, private[sbt] val help0:
assert(Command validID name, "'" + name + "' is not a valid command name.")
def tag[T](key: AttributeKey[T], value: T): SimpleCommand = new SimpleCommand(name, help0, parser, tags.put(key, value))
def help = const(help0)
override def toString = s"SimpleCommand($name)"
}
private[sbt] final class ArbitraryCommand(val parser: State => Parser[() => State], val help: State => Help, val tags: AttributeMap) extends Command {
def tag[T](key: AttributeKey[T], value: T): ArbitraryCommand = new ArbitraryCommand(parser, help, tags.put(key, value))

View File

@ -0,0 +1,12 @@
[@dwijnand]: http://github.com/dwijnand
[1998]: https://github.com/sbt/sbt/issues/1998
[2000]: https://github.com/sbt/sbt/pull/2000
### Fixes with compatibility implications
### Improvements
- Add a nicer toString to SimpleCommand to make it more human-friendly. [#1998][1998]/[#2000][2000] by [@dwijnand][@dwijnand]
### Bug fixes

View File

@ -0,0 +1,6 @@
commands += Command.command("noop") { s => s }
TaskKey[Unit]("check") := {
assert(commands.value.toString() == "List(SimpleCommand(noop))",
s"""commands should display "List(SimpleCommand(noop))" but is ${commands.value}""")
}

View File

@ -0,0 +1 @@
> check