Allows "if(MyFlag) .
Allows "if(MyFlag) ..."
Allows: if(NameOpt) .
Allows: if(NameOpt) ... instead of if(NameOpt.value.isDefined) ...
Allows BoolOpt(enables=MyOpt) instead of BoolOpt(enables=Seq(MyOpt))
Allows BoolOpt(enables=MyOpt) instead of BoolOpt(enables=Seq(MyOpt))
Allows any Option methods to be used on an OptVal
Allows any Option methods to be used on an OptVal
Allows regex usage for the validate option: validate="^[a-zA-Z]+$"
Allows regex usage for the validate option: validate="^[a-zA-Z]+$"
Allows longName="name" without needing long=Some("name")
Allows longName="name" without needing long=Some("name")
Declare a "default option"
Exit the application with a message
Exit the application with a message
Print the help message to STDERR
A default help option (--help or -h) that displays the help message
Override to true to enable simple println's showing what OptParse is doing
By default OptParse will do a System.
By default OptParse will do a System.exit on any parsing errors or when --help is invoked. You can override this to false if you want an IllegalArgumentException exception thrown instead
Parse the given command line options
Simple Command Line Parsing for Scala
OptParse provides simple command line parsing for Scala that only requires a minimal amount of code.
Hello World Example
And then you can pass options with:
or
More Complete Example
Show help message
or
Pass in some options
./myApp --flag --name Tim --aliases Timothy --aliases Timmy --number 123
Nested Options Object Example
You can also use a nested options object (or class) for parsing the options:
Command Line Option Types