caseapp
package caseapp
- Alphabetic
- By Inheritance
- caseapp
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
- type @@[T, Tag] = AnyRef { type Tag = shapeless.newtype.NewtypeTag[T,Tag] }
- abstract class CaseApp[T] extends AnyRef
- abstract class CommandApp[T] extends CommandAppWithPreCommand[DefaultBaseCommand, T]
- abstract class CommandAppWithPreCommand[D, T] extends AnyRef
- type CommandParser[T] = caseapp.core.CommandParser[T]
- sealed trait Counter extends AnyRef
- type ExtraName = Name
- type Parser[T] = caseapp.core.Parser[T]
- final case class RemainingArgs(remainingArgs: Seq[String], unparsedArgs: Seq[String]) extends Product with Serializable
-
trait
App extends DefaultArgsApp with DelayedInit
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,
FooAppnow has amainmethod, that parses the arguments it is given, and matches these to the fieldsi(-i 2givesithe value2) andfoo(--foo abgivesfoothe value"ab") ofFoo. It also accepts--help/-h/--usagearguments, and prints help or usage messages when these are present.- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0-M2) See CaseApp instead
-
abstract
class
AppOf[T <: ArgsApp] extends AnyRef
Have a singleton extends this class to get a class with a main method for the app of
THave a singleton extends this class to get a class with a main method for the app of
T- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0-M2) Use CaseApp instead
-
trait
Command extends DefaultCommandArgsApp with DelayedInit
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
DelayedInitlikeAppdoes.Like with
App, the remaining arguments are accessible with the methodremainingArgs.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,
MyAppnow has amainmethod, that accepts arguments likefirst a borsecond 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 aSecondinstead, and call its body too.- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0-M2) See CommandApp instead
-
abstract
class
CommandAppOf[T <: ArgsApp] extends CommandAppOfWithBase[DefaultBaseCommand, T]
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0-M2) Use CommandApp instead
-
abstract
class
CommandAppOfWithBase[D <: CommandArgsApp, T <: ArgsApp] extends AnyRef
- Annotations
- @deprecated
- Deprecated
(Since version 1.2.0-M2) Use CommandAppWithPreCommand instead
Value Members
- val CommandParser: caseapp.core.CommandParser.type
- val Parser: caseapp.core.Parser.type
- implicit def optionGeneric[T]: Aux[Option[T], :+:[Some[T], :+:[None.type, CNil]]]
- object CaseApp
- object Tag