In the example above, MyApp now has a main method, that accepts arguments
like first a b or second c d. In the first case, it will create a First, and
call its body (whose initialization is delayed thanks to delayed initialization). In the
second case, it will create a Second instead, and call its body too.
Have a sealed trait extend this for its case class children to become commands.
Extends
DelayedInit
likeApp
does.Like with
App
, the remaining arguments are accessible with the methodremainingArgs
.Example
In the example above,
MyApp
now has amain
method, that accepts arguments likefirst a b
orsecond c d
. In the first case, it will create aFirst
, and call its body (whose initialization is delayed thanks to delayed initialization). In the second case, it will create aSecond
instead, and call its body too.