I'm writing an SBT Plugin that adds a Command and would like users to be able to configure this Command by setting variables in their build.sbt
. What is the simplest way to achieve this?
Here is an simplified example of what the Plugin looks like:
import sbt.Keys._
import sbt._
object MyPlugin extends Plugin {
override lazy val settings = Seq(commands += Command.args("mycommand", "myarg")(myCommand))
def myCommand = (state: State, args: Seq[String]) => {
//Logic for command...
state
}
}
I would like someone to be able to add the follow to their build.sbt
file:
newSetting := "light"
How do I make this available as a String
variable from inside the myCommand
Command above?