Skip to content
This repository has been archived by the owner on Apr 22, 2020. It is now read-only.

Commit

Permalink
Adds syntax to make easier the use of command aliases (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
juanpedromoreno authored Apr 28, 2017
1 parent 6e51a8d commit 466b57e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions core/src/main/scala/sbtorgpolicies/runnable/syntax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ object syntax {
implicit def runnableCommandOpsSyntax[T](command: String): RunnableCommandOps =
new RunnableCommandOps(command)

implicit def runnableCommandListOpsSyntax[T](commandList: List[String]): RunnableCommandListOps =
new RunnableCommandListOps(commandList)

final class RunnableTaskOps[T](taskKey: TaskKey[T]) {

def asRunnableItemFull: RunnableItemConfigScope[T] =
Expand Down Expand Up @@ -77,6 +80,14 @@ object syntax {
crossScalaVersions: Boolean): RunnableItemConfigScope[Unit] =
RunnableItemConfigScope(RunnableProcess(command), allModules, aggregated, crossScalaVersions)

def asCmd: String =
if (command.contains("/")) s";project ${command.replaceAll("/", ";")}"
else s";$command"
}

final class RunnableCommandListOps(commandList: List[String]) {

def asCmd: String = commandList.map(_.asCmd).mkString("")
}

}
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.4.16")
addSbtPlugin("com.47deg" % "sbt-org-policies" % "0.4.18")
libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value

0 comments on commit 466b57e

Please sign in to comment.