How to validate arguments and pass them to an action in a Command

5 views
Skip to first unread message

Michael Schmitz

unread,
Apr 24, 2014, 8:29:40 PM4/24/14
to simple-b...@googlegroups.com
Hi, the sbt MEAP shows how to use SBT commands that run a chain of tasks.  What if my command takes command line arguments, which I want to validate early and pass on to a subtask?

For example, I might have a deploy command that takes an argument specifying a destination server.  First I want to validate the arguments, then I want to make sure the git repository is clean, then I want to compile and stage the application, and finally I want to deploy the application--using the arguments that were passed into the command.

Would I create a task to validate the arguments, and then create a task string later on with args.mkString(" ")?  I.e. my task chain would be:

("validate " + args.mkString(" ")) :: ensureGitClean :: clean :: stage :: ("deploy " + args.mkString(" "))

Or is there a better way?

Peace.  Michael

 

Michael Schmitz

unread,
Apr 24, 2014, 8:31:48 PM4/24/14
to simple-b...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages