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
caseclass Foo(
i: Int,
foo: String
) extendsApp {
// 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.
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
In the example above,
FooApp
now has amain
method, that parses the arguments it is given, and matches these to the fieldsi
(-i 2
givesi
the value2
) andfoo
(--foo ab
givesfoo
the value"ab"
) ofFoo
. It also accepts--help
/-h
/--usage
arguments, and prints help or usage messages when these are present.