Following the document Input Tasks (with a basic change in the name of the input task, so greeting ):
import sbt.complete.Parsers.spaceDelimited val greeting = inputKey[Unit]("A demo input task.") greeting := { val args: Seq[String] = spaceDelimited("<arg>").parsed args foreach println }
With the above in build.sbt you can invoke the input task from the console:
> greeting "hello world" hello world
or from the command line:
โ so-25596401 xsbt 'greeting "hello world"' [info] Loading global plugins from /Users/jacek/.sbt/0.13/plugins [info] Set current project to so-25596401 (in build file:/Users/jacek/sandbox/so-25596401/) hello world [success] Total time: 0 s, completed Sep 1, 2014 1:34:31 AM
Pay attention to the quotation marks indicating what constitutes a single task / command with arguments.
source share