class getopt extends AnyRef
POSIX getopt(3) parser with GNU extension '--', but without long options.
import com.filez.scala.getopt.getopt object Example extends App { protected val g = new getopt(args, "ab:c") g.options.get('b').foreach{ arg => println(s"-b arg value is $arg") } }
- Version
1.1
- Since
1.0
- Exceptions thrown
java.lang.IllegalArgumentExceptionif input parameters are invalidjava.lang.NoSuchElementExceptionif option is unknown or parameter is missing. Strict mode only.
- Alphabetic
- By Inheritance
- getopt
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Instance Constructors
- new getopt(arg: Seq[String], optstring: String, strict: Boolean = false)
Create immutable getopt instance
Create immutable getopt instance
- arg
Sequence of command line arguments. Sequence can be empty but can not contain zero sized strings.
- optstring
list of legitimate option characters. If character is followed by colon, the option requires argument. Must not be empty.
- strict
If argument is missing or option is unknown exception is raised.
- Annotations
- @throws("Input parameters are incorrect") @throws("Argument validation failed. Strict mode only")
- Exceptions thrown
java.lang.IllegalArgumentExceptionif input parameters are invalidjava.lang.NoSuchElementExceptionif option is unknown or parameter is missing. Strict mode only.
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- val arguments: Seq[String]
Command line arguments with options and their arguments removed.
Command line arguments with options and their arguments removed.
- Since
1.0
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- val options: Map[Char, String]
Command line options and their values.
Command line options and their values. If option does not have argument map contains empty string as value. If command line option was found but not declared in optstring, null is stored.
- Since
1.0
- val options_map: ListMap[Char, Boolean]
options argument flag map.
options argument flag map. Value true indicates that option has required argument. This map is created from optstring.
- Since
1.0
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- def validate(): Unit
Validate parsed options.
Validate parsed options. Throws an Exception if unknown option is encountered or required argument is missing. If getopt is created in strict mode this function is automatically called after options are parsed.
- Annotations
- @throws("If option is unknown or required argument is missing")
- Since
1.1
- Exceptions thrown
NoSuchElementExceptionif option is unknown or argument is missing
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
Deprecated Value Members
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable]) @Deprecated
- Deprecated