scopt

OptionParser

case class OptionParser (programName: Option[String], version: Option[String], errorOnUnknownArgument: Boolean) extends Product with Serializable

OptionParser is instantiated within your object, set up by an (ordered) sequence of invocations of the various builder methods such as opt method or arg method.

val parser = new OptionParser("scopt") {
  intOpt("f", "foo", "foo is an integer property", {v: Int => config.foo = v})
  opt("o", "output", "<file>", "output is a string property", {v: String => config.bar = v})
  booleanOpt("xyz", "xyz is a boolean property", {v: Boolean => config.xyz = v})
  keyValueOpt("l", "lib", "<libname>", "<filename>", "load library <libname>",
    {(key: String, value: String) => { config.libname = key; config.libfile = value } })
  arg("<singlefile>", "<singlefile> is an argument", {v: String => config.whatnot = v})
  // arglist("<file>...", "arglist allows variable number of arguments",
  //   {v: String => config.files = (v :: config.files).reverse })
}
if (parser.parse(args)) {
  // do stuff
}
else {
  // arguments are bad, usage message will have been displayed
}
Linear Supertypes
Serializable, Serializable, Product, Equals, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. OptionParser
  2. Serializable
  3. Serializable
  4. Product
  5. Equals
  6. AnyRef
  7. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new OptionParser (programName: String, errorOnUnknownArgument: Boolean)

  2. new OptionParser (errorOnUnknownArgument: Boolean)

  3. new OptionParser (programName: String, version: String)

  4. new OptionParser (programName: String)

  5. new OptionParser ()

  6. new OptionParser (programName: Option[String], version: Option[String], errorOnUnknownArgument: Boolean)

Value Members

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

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

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

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

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

    Attributes
    final
    Definition Classes
    Any
  6. def arg (name: String, description: String, action: (String) ⇒ Unit): Unit

    adds an argument invoked by an option without - or --.

    adds an argument invoked by an option without - or --.

    name

    name in the usage text

    description

    description in the usage text

    action

    callback function

  7. def argOpt (name: String, description: String, action: (String) ⇒ Unit): Unit

    adds an optional argument invoked by an option without - or --.

    adds an optional argument invoked by an option without - or --.

    name

    name in the usage text

    description

    description in the usage text

    action

    callback function

  8. def arglist (name: String, description: String, action: (String) ⇒ Unit): Unit

    adds a list of arguments invoked by options without - or --.

    adds a list of arguments invoked by options without - or --.

    name

    name in the usage text

    description

    description in the usage text

    action

    callback function

  9. def arglistOpt (name: String, description: String, action: (String) ⇒ Unit): Unit

    adds an optional list of arguments invoked by options without - or --.

    adds an optional list of arguments invoked by options without - or --.

    name

    name in the usage text

    description

    description in the usage text

    action

    callback function

  10. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  11. def booleanOpt (shortopt: Option[String], longopt: String, valueName: String, description: String, action: (Boolean) ⇒ Unit): Unit

  12. def booleanOpt (shortopt: String, longopt: String, valueName: String, description: String, action: (Boolean) ⇒ Unit): Unit

  13. def booleanOpt (longopt: String, description: String, action: (Boolean) ⇒ Unit): Unit

  14. def booleanOpt (shortopt: String, longopt: String, description: String, action: (Boolean) ⇒ Unit): Unit

  15. def canEqual (arg0: Any): Boolean

    Definition Classes
    OptionParser → Equals
  16. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  17. def doubleOpt (shortopt: Option[String], longopt: String, valueName: String, description: String, action: (Double) ⇒ Unit): Unit

  18. def doubleOpt (shortopt: String, longopt: String, valueName: String, description: String, action: (Double) ⇒ Unit): Unit

  19. def doubleOpt (longopt: String, description: String, action: (Double) ⇒ Unit): Unit

  20. def doubleOpt (shortopt: String, longopt: String, description: String, action: (Double) ⇒ Unit): Unit

  21. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  22. def equals (arg0: Any): Boolean

    Definition Classes
    OptionParser → Equals → AnyRef → Any
  23. val errorOnUnknownArgument : Boolean

  24. def finalize (): Unit

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

    Attributes
    final
    Definition Classes
    AnyRef
  26. def hashCode (): Int

    Definition Classes
    OptionParser → AnyRef → Any
  27. def help (shortopt: Option[String], longopt: String, description: String): Unit

  28. def help (shortopt: String, longopt: String, description: String): Unit

  29. def intOpt (shortopt: Option[String], longopt: String, valueName: String, description: String, action: (Int) ⇒ Unit): Unit

  30. def intOpt (shortopt: String, longopt: String, valueName: String, description: String, action: (Int) ⇒ Unit): Unit

  31. def intOpt (longopt: String, description: String, action: (Int) ⇒ Unit): Unit

  32. def intOpt (shortopt: String, longopt: String, description: String, action: (Int) ⇒ Unit): Unit

  33. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  34. def keyBooleanValueOpt (shortopt: Option[String], longopt: String, keyName: String, valueName: String, description: String, action: (String, Boolean) ⇒ Unit): Unit

  35. def keyBooleanValueOpt (shortopt: String, longopt: String, keyName: String, valueName: String, description: String, action: (String, Boolean) ⇒ Unit): Unit

  36. def keyBooleanValueOpt (longopt: String, description: String, action: (String, Boolean) ⇒ Unit): Unit

  37. def keyBooleanValueOpt (shortopt: String, longopt: String, description: String, action: (String, Boolean) ⇒ Unit): Unit

  38. def keyDoubleValueOpt (shortopt: Option[String], longopt: String, keyName: String, valueName: String, description: String, action: (String, Double) ⇒ Unit): Unit

  39. def keyDoubleValueOpt (shortopt: String, longopt: String, keyName: String, valueName: String, description: String, action: (String, Double) ⇒ Unit): Unit

  40. def keyDoubleValueOpt (longopt: String, description: String, action: (String, Double) ⇒ Unit): Unit

  41. def keyDoubleValueOpt (shortopt: String, longopt: String, description: String, action: (String, Double) ⇒ Unit): Unit

  42. def keyIntValueOpt (shortopt: Option[String], longopt: String, keyName: String, valueName: String, description: String, action: (String, Int) ⇒ Unit): Unit

  43. def keyIntValueOpt (shortopt: String, longopt: String, keyName: String, valueName: String, description: String, action: (String, Int) ⇒ Unit): Unit

  44. def keyIntValueOpt (longopt: String, description: String, action: (String, Int) ⇒ Unit): Unit

  45. def keyIntValueOpt (shortopt: String, longopt: String, description: String, action: (String, Int) ⇒ Unit): Unit

  46. def keyValueOpt (shortopt: Option[String], longopt: String, keyName: String, valueName: String, description: String, action: (String, String) ⇒ Unit): Unit

  47. def keyValueOpt (shortopt: String, longopt: String, keyName: String, valueName: String, description: String, action: (String, String) ⇒ Unit): Unit

  48. def keyValueOpt (longopt: String, description: String, action: (String, String) ⇒ Unit): Unit

  49. def keyValueOpt (shortopt: String, longopt: String, description: String, action: (String, String) ⇒ Unit): Unit

  50. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  51. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  52. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  53. def opt (longopt: String, description: String, action: ⇒ Unit): Unit

    adds a flag option invoked by --longopt.

    adds a flag option invoked by --longopt.

    longopt

    long option

    description

    description in the usage text

    action

    callback function

  54. def opt (shortopt: String, longopt: String, description: String, action: ⇒ Unit): Unit

    adds a flag option invoked by -shortopt or --longopt.

    adds a flag option invoked by -shortopt or --longopt.

    shortopt

    short option

    longopt

    long option

    description

    description in the usage text

    action

    callback function

  55. def opt (shortopt: Option[String], longopt: String, valueName: String, description: String, action: (String) ⇒ Unit): Unit

    adds a String option invoked by -shortopt x or --longopt x.

    adds a String option invoked by -shortopt x or --longopt x.

    shortopt

    short option, or None

    longopt

    long option

    valueName

    value name in the usage text

    description

    description in the usage text

    action

    callback function

  56. def opt (shortopt: String, longopt: String, valueName: String, description: String, action: (String) ⇒ Unit): Unit

    adds a String option invoked by -shortopt x or --longopt x.

    adds a String option invoked by -shortopt x or --longopt x.

    shortopt

    short option

    longopt

    long option

    valueName

    value name in the usage text

    description

    description in the usage text

    action

    callback function

  57. def opt (longopt: String, description: String, action: (String) ⇒ Unit): Unit

    adds a String option invoked by --longopt x.

    adds a String option invoked by --longopt x.

    longopt

    long option

    description

    description in the usage text

    action

    callback function

  58. def opt (shortopt: String, longopt: String, description: String, action: (String) ⇒ Unit): Unit

    adds a String option invoked by -shortopt x or --longopt x.

    adds a String option invoked by -shortopt x or --longopt x.

    shortopt

    short option

    longopt

    long option

    description

    description in the usage text

    action

    callback function

  59. def parse (args: Seq[String]): Boolean

    parses the given args.

    parses the given args.

    returns

    true if successful, false otherwise

  60. def productArity : Int

    Definition Classes
    OptionParser → Product
  61. def productElement (arg0: Int): Any

    Definition Classes
    OptionParser → Product
  62. def productIterator : Iterator[Any]

    Definition Classes
    Product
  63. def productPrefix : String

    Definition Classes
    OptionParser → Product
  64. val programName : Option[String]

  65. def separator (description: String): Unit

  66. def showUsage : Unit

  67. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  68. def toString (): String

    Definition Classes
    OptionParser → AnyRef → Any
  69. def usage : String

  70. val version : Option[String]

  71. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  74. def productElements : Iterator[Any]

    Definition Classes
    Product
    Annotations
    @deprecated
    Deprecated

    use productIterator instead

Inherited from Serializable

Inherited from Serializable

Inherited from Product

Inherited from Equals

Inherited from AnyRef

Inherited from Any