com.frugalmechanic.optparse

BoolOpt

class BoolOpt extends OptVal[Boolean]

A boolean/flag command line option

Examples

import com.frugalmechanic.optparse._

object MyApp extends OptParse {
  // Basic flag using a default long name of --flag and short name of -f
  val flag = BoolOpt()

  // Example with all available options instead of relying on the defaults
  val verbose = BoolOpt(
     long="verbose",     // Long name to use (--verbose)
     short="v",          // Short name to use (-v)
     default=false,      // Default value for this flag (true/false)
     desc="Be verbose",  // Help message description
     enables=noisy,      // Other flags to enable if this one is enabled (single option or a Seq of options)
     disables=Seq(quiet),// Other flags to disable if this one is enabled (single option or a Seq of options)
     invalidWith=quiet,  // Other options this flag is invalid with (they cannot be set)
     validWith=noisy,    // Other options that are required with this flag
     exclusive=false,    // Other options can be set when this option is set
  )

  // You can also use "new BoolOpt()" instead of using the companion object
  val noisy = new BoolOpt()
  val quiet = new BoolOpt()

  def main(args:Array[String]) {
    parse(args)

    if(verbose) println("You want verbose output")
  }
}
Linear Supertypes
OptVal[Boolean], Opt, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. BoolOpt
  2. OptVal
  3. Opt
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new BoolOpt(long: Option[String], short: Option[Char], default: Option[Boolean], desc: String, enables: ⇒ Seq[BoolOpt], disables: ⇒ Seq[BoolOpt], invalidWith: ⇒ Seq[Opt], validWith: ⇒ Seq[Opt], exclusive: Boolean)

    long

    Long name for this option (--long_name on the command line)

    short

    Short name for this option (-short_name on the command line)

    default

    Default value for this option

    desc

    Description of the parameter (used in help message)

    enables

    Other flags that this option implicitly enables

    disables

    Other flags that this option implicitly disables

    validWith

    Other options that are required to be set when using this options

    exclusive

    Whether or not this option is exclusive and cannot be used with any other options (e.g. like --help where it prints the help message and exits)

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. var actualLong: Option[String]

    Attributes
    protected[com.frugalmechanic.optparse]
    Definition Classes
    Opt
  7. var actualShort: Option[Char]

    Attributes
    protected[com.frugalmechanic.optparse]
    Definition Classes
    Opt
  8. def apply(): Boolean

    Get the value

    Get the value

    This calls Option.get on the underlying value so an exception will be thrown if the value is not set.

    Definition Classes
    OptVal
  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  11. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  12. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  13. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. var methodName: String

    Attributes
    protected[com.frugalmechanic.optparse]
    Definition Classes
    Opt
  18. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  19. final def notify(): Unit

    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  21. def reset: Unit

    Reset the value to the default

    Reset the value to the default

    Definition Classes
    OptValOpt
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. def toString(): String

    Definition Classes
    AnyRef → Any
  24. def value: Option[Boolean]

    The value attached to this command line option (wrapped in an Option)

    The value attached to this command line option (wrapped in an Option)

    Definition Classes
    OptVal
  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from OptVal[Boolean]

Inherited from Opt

Inherited from AnyRef

Inherited from Any

Ungrouped