mirror of https://github.com/sbt/sbt.git
better naming + value class
This commit is contained in:
parent
79e75f02e5
commit
951c78a4d7
|
|
@ -188,8 +188,8 @@ object Command {
|
|||
def spacedC(name: String, c: Parser[Char]): Parser[String] =
|
||||
((c & opOrIDSpaced(name)) ~ c.+) map { case (f, rem) => (f +: rem).mkString }
|
||||
|
||||
implicit class CommandWithName(cmd: Command) {
|
||||
def commandName: Option[String] = cmd match {
|
||||
implicit class CommandWithName(val cmd: Command) extends AnyVal {
|
||||
def nameOption: Option[String] = cmd match {
|
||||
case sc: SimpleCommand => Some(sc.name)
|
||||
case _ => None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
val command = Command.command("noop") { s => s }
|
||||
|
||||
TaskKey[Unit]("check") := {
|
||||
assert(command.commandName == Some("noop"), """command.commandName should be "noop"""")
|
||||
assert(command.nameOption == Some("noop"), """command.commandName should be "noop"""")
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue