Class/Object

com.frugalmechanic.optparse

BoolOpt

Related Docs: object BoolOpt | package optparse

Permalink

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
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)

    Permalink

    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

    invalidWith

    Other options that this option is not valid with

    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: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. var actualLong: Option[String]

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

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

    Permalink

    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
  7. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  8. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate() @throws( ... )
  9. def default: Option[Boolean]

    Permalink

    The default value for this options

    The default value for this options

    Definition Classes
    OptVal
  10. def desc: String

    Permalink

    The description of this option which is used as part of the help message

    The description of this option which is used as part of the help message

    Definition Classes
    Opt
  11. def disables: Seq[BoolOpt]

    Permalink

    A list of boolean option that this option disables

    A list of boolean option that this option disables

    Definition Classes
    Opt
  12. def enables: Seq[BoolOpt]

    Permalink

    A List of boolean options that this option enables

    A List of boolean options that this option enables

    Definition Classes
    Opt
  13. final def eq(arg0: AnyRef): Boolean

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

    Permalink
    Definition Classes
    AnyRef → Any
  15. def exclusive: Boolean

    Permalink

    Whether or not this command line options is exclusive and cannot be used with any other options (e.g.

    Whether or not this command line options is exclusive and cannot be used with any other options (e.g. a help options that prints the help message and then quits)

    Definition Classes
    Opt
  16. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  17. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
    Annotations
    @HotSpotIntrinsicCandidate()
  18. def invalidWith: Seq[Opt]

    Permalink

    Other command line options that this option is invalid with

    Other command line options that this option is invalid with

    Definition Classes
    Opt
  19. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  20. def long: Option[String]

    Permalink

    The long form of this option (if any)

    The long form of this option (if any)

    (e.g. "myoption" would be called with "--myoption" on the command line)

    Definition Classes
    Opt
  21. var methodName: String

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

    Permalink
    Definition Classes
    AnyRef
  23. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  24. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @HotSpotIntrinsicCandidate()
  25. def reset(): Unit

    Permalink

    Reset the value to the default

    Reset the value to the default

    Definition Classes
    OptValOpt
  26. def short: Option[Char]

    Permalink

    The short form of this option (if any)

    The short form of this option (if any)

    (e.g. "a" would be called with "-a" on the command line)

    Definition Classes
    Opt
  27. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  28. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  29. def validWith: Seq[Opt]

    Permalink

    Other command line options that are required when this option is set

    Other command line options that are required when this option is set

    Definition Classes
    Opt
  30. def value: Option[Boolean]

    Permalink

    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
  31. final def wait(arg0: Long, arg1: Int): Unit

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @Deprecated @deprecated @throws( classOf[java.lang.Throwable] )
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from OptVal[Boolean]

Inherited from Opt

Inherited from AnyRef

Inherited from Any

Ungrouped