Have a case class extend this trait for its fields to become command line arguments, and its body the core of your app using these.
Have a case class extend this trait for its fields to become command line arguments, and its body the core of your app using these.
Extends DelayedInit
, so that the body of the case class gets called later.
Remaining arguments are accessible via the method remainingArgs
.
Example
case class Foo( i: Int, foo: String ) extends App { // core of your app, using the fields above } object FooApp extends AppOf[Foo]
In the example above, FooApp
now has a main
method, that parses the arguments it is given,
and matches these to the fields i
(-i 2
gives i
the value 2
) and foo
(--foo ab
gives foo
the value "ab"
) of Foo
. It also accepts --help
/ -h
/ --usage
arguments,
and prints help or usage messages when these are present.
Name for the annotated case class of arguments E.g.
Name for the annotated case class of arguments E.g. MyApp
Have a singleton extends this class to get a class with a main method for the app of T
App version for the annotated case class of arguments
Name for the extra arguments of the annotated case class of arguments
Have a sealed trait extend this for its case class children to become commands.
Have a sealed trait extend this for its case class children to become commands.
Extends DelayedInit
like App
does.
Like with App
, the remaining arguments are accessible with the method remainingArgs
.
Example
sealed trait DemoCommand extends Command case class First( ) extends DemoCommand { // ... } case class Second( ) extends DemoCommand { // ... } object MyApp extends CommandAppOf[DemoCommand]
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.
Set the command name of the annotated case class of arguments E.g.
Set the command name of the annotated case class of arguments E.g. my-app
Help message for the annotated argument
Do not include this field / argument in the help message
Extra name for the annotated argument
Program name for the annotated case class of arguments E.g.
Program name for the annotated case class of arguments E.g. my-app
Description of the value of the annotated argument