In my build.sbt file, I want to have a task with input parameters that calls the method mainin my code, but before calling the method I would like to have the parameters analyzed .
This is the definition of InputKey:
val clearDatabase = inputKey[Unit]("Clear database, arguments: endpoint user password")
The analyzer that I would like to use:
val databaseTaskParser = sbt.Def.spaceDelimited("endpoint username password").map(_.toList).map {
case List(endpoint) => (endpoint, "", "")
case List(endpoint, username, password) => (endpoint, username, password)
case _ =>
sys.error("Supported arguments: \"endpoint\" or \"endpoint username password\"")
}
And then I know that to pass the input arguments to the main method I need to use a parameter fullRunInputTaskparameterized with the InputKey above:
fullRunInputTask(clearDatabase, Compile, "my.code.ClearDatabaseTask")
Now, how can I combine the call with fullRunInputTaskusing databaseTaskParser(to display an error when the wrong set of parameters is set) even before the method is calledmain
source
share