Packages

  • package root
    Definition Classes
    root
  • package cmdr
    Definition Classes
    root
  • object Parser

    Low-level parsing functionality.

    Low-level parsing functionality. See ArgParser for a user-friendly API.

    Definition Classes
    cmdr
  • ParamDef
c

cmdr.Parser

ParamDef

case class ParamDef(names: Seq[String], parseAndSet: (String, Option[String]) => Unit, missing: () => Unit, isFlag: Boolean, repeatPositional: Boolean, absorbRemaining: Boolean) extends Product with Serializable

A parameter definition is the low-level building block to define the grammar of a command-line, and its functionality.

ParamDefs associate parameter names to actions that are invoked by Parser.parse() in certain situations.

names

All names that may be used by this parameter. If a name starts with -, it is considered a "named" parameter, otherwise it is considered a "positional" parameter. Arguments associated to named parameters may appear in any order on the command line, as long as they are prefixed by the parameter's name. Positional parameters are given arguments in the order they appear in.

parseAndSet

A function that is invoked anytime this parameter is encountered on the command line. In case of an named param, the first element is the actual name used, and the second element is the argument or None if no argument followed. In case of a position param, no name is given and the argument value is always defined.

missing

A function that is invoked if this parameter has not been encountered at all.

isFlag

Indicates if this named parameter is a flag, i.e. one that never accepts an argument. In case its name is encountered, its value is set to "true". Has no effect on positional parameters.

repeatPositional

If this is a positional parameter, it will be the parser will repeat it indefinitely.

absorbRemaining

Treat all subsequent parameters as positionals, regardless of their name. This can be useful for constructing nested commands.

Linear Supertypes
Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ParamDef
  2. Serializable
  3. Product
  4. Equals
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new ParamDef(names: Seq[String], parseAndSet: (String, Option[String]) => Unit, missing: () => Unit, isFlag: Boolean, repeatPositional: Boolean, absorbRemaining: Boolean)

    names

    All names that may be used by this parameter. If a name starts with -, it is considered a "named" parameter, otherwise it is considered a "positional" parameter. Arguments associated to named parameters may appear in any order on the command line, as long as they are prefixed by the parameter's name. Positional parameters are given arguments in the order they appear in.

    parseAndSet

    A function that is invoked anytime this parameter is encountered on the command line. In case of an named param, the first element is the actual name used, and the second element is the argument or None if no argument followed. In case of a position param, no name is given and the argument value is always defined.

    missing

    A function that is invoked if this parameter has not been encountered at all.

    isFlag

    Indicates if this named parameter is a flag, i.e. one that never accepts an argument. In case its name is encountered, its value is set to "true". Has no effect on positional parameters.

    repeatPositional

    If this is a positional parameter, it will be the parser will repeat it indefinitely.

    absorbRemaining

    Treat all subsequent parameters as positionals, regardless of their name. This can be useful for constructing nested commands.

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. val absorbRemaining: Boolean
  5. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  7. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  9. val isFlag: Boolean
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. def isNamed: Boolean
  12. val missing: () => Unit
  13. val names: Seq[String]
  14. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  15. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  16. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  17. val parseAndSet: (String, Option[String]) => Unit
  18. def productElementNames: Iterator[String]
    Definition Classes
    Product
  19. val repeatPositional: Boolean
  20. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  21. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  22. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  23. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any

Ungrouped