vjovanov
vjovanov

Reputation: 120

SBT Command that Calls Another Command and an InputTask

I am writing an SBT Command that is supposed to call another command (eclipse from the Eclipse SBT Plugin) and another InputTask.

How can one achieve this?

Upvotes: 2

Views: 739

Answers (1)

Mohammad Dashti
Mohammad Dashti

Reputation: 755

Assuming that you want to create a "release" command and it needs to call another task named "pack", you can add the following code to build.sbt:

commands += Command.command("release")((state:State) => {
  Project.evaluateTask(pack, state)
  println("release called")
  state
})

Updated:

In addition, if you have to create the "release" command and it requires calling another command named "init_compile", then the following sample code can be used:

commands += Command.command("init_compile")((state:State) => {
  println("init_compile called.")
  state
})

commands += Command.command("release")((state:State) => {
  val newState = Command.process("init_compile",state)
  println("release called.")
  newState
})

Upvotes: 2

Related Questions