Merge pull request #4355 from eed3si9n/wip/one-letter

Allow single-letter aliases
This commit is contained in:
eugene yokota 2018-09-16 02:58:45 -04:00 committed by GitHub
commit 3f1ae8bd55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 1 deletions

View File

@ -20,6 +20,10 @@ import sbt.internal.util.complete.{ DefaultParsers, Parser }
import sbt.io.IO
import sbt.librarymanagement.CrossVersion
/**
* Cross implements the Scala cross building commands:
* + ("cross") command and ++ ("switch") command.
*/
object Cross {
private[sbt] def spacedFirst(name: String) = opOrIDSpaced(name) ~ any.+
@ -69,7 +73,7 @@ object Cross {
token(CrossCommand <~ OptSpace) flatMap { _ =>
(token(Parser.opt("-v" <~ Space)) ~ token(matched(state.combinedParser))).map {
case (verbose, command) => CrossArgs(command, verbose.isDefined)
} & spacedFirst(CrossCommand)
}
}
private def crossRestoreSessionParser: Parser[String] = token(CrossRestoreSessionCommand)

View File

@ -1,2 +1,3 @@
addCommandAlias("demo-success", "run true")
addCommandAlias("demo-failure", "run false")
addCommandAlias("z", "scalaVersion")

View File

@ -1,2 +1,4 @@
> demo-success
-> demo-failure
> +z
> z