move nameOption to the trait

This commit is contained in:
Miklos Martin 2017-11-02 16:56:14 +01:00
parent 951c78a4d7
commit 1f89e3dc02
1 changed files with 5 additions and 7 deletions

View File

@ -25,6 +25,11 @@ sealed trait Command {
def tags: AttributeMap
def tag[T](key: AttributeKey[T], value: T): Command
def nameOption: Option[String] = this match {
case sc: SimpleCommand => Some(sc.name)
case _ => None
}
}
private[sbt] final class SimpleCommand(
@ -187,13 +192,6 @@ 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(val cmd: Command) extends AnyVal {
def nameOption: Option[String] = cmd match {
case sc: SimpleCommand => Some(sc.name)
case _ => None
}
}
}
trait Help {