name.kevinlocke.ultragetopt
Enum UltraGetopt.Behavior

java.lang.Object
  extended by java.lang.Enum<UltraGetopt.Behavior>
      extended by name.kevinlocke.ultragetopt.UltraGetopt.Behavior
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<UltraGetopt.Behavior>
Enclosing class:
UltraGetopt

public static enum UltraGetopt.Behavior
extends java.lang.Enum<UltraGetopt.Behavior>

Different behavior options for UltraGetopt.


Enum Constant Summary
ACCEPT_OPTIONLIKE_OPT_ARGS
          Accept option arguments which begin with a leader string.
CASE_INSENSITIVE
          Do argument matching case-insensitively.
LONG_OPT_ADJACENT_ARG
          Allow long options to have arguments which are adjacent to the option.
NO_EAT_DASH_DASH
          Include "--" in the list of non-option arguments if it appears on the command-line.
NO_EXCEPTIONS
          Do not throw exceptions upon encountering errors.
NONOPTION_AS_ARGUMENT
          Return non-option arguments as arguments to a null option.
PARTIAL_MATCHING
          Attempt to match long options against the list of accepted options.
SEPARATED_OPTIONAL_ARGUMENT
          Allow options with optional arguments to accept options which are not explicitly assigned.
SHORT_OPTION_ASSIGN
          Typically short options are not allowed to be assigned an argument (such as -o=file.txt).
TRY_LONG_FIRST
          Attempt to match options with a single leader character against the list of long options before attempting to match against short options.
UNRECOGNIZED_AS_NONOPTARG
          Return unrecognized long options as non-option arguments.
 
Method Summary
static UltraGetopt.Behavior valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static UltraGetopt.Behavior[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

CASE_INSENSITIVE

public static final UltraGetopt.Behavior CASE_INSENSITIVE
Do argument matching case-insensitively.


ACCEPT_OPTIONLIKE_OPT_ARGS

public static final UltraGetopt.Behavior ACCEPT_OPTIONLIKE_OPT_ARGS
Accept option arguments which begin with a leader string. Without this behavior option, UltraGetopt will throw a MissingArgumentException when it encounters an option with a required argument followed by an argument beginning with a leader string.


NO_EAT_DASH_DASH

public static final UltraGetopt.Behavior NO_EAT_DASH_DASH
Include "--" in the list of non-option arguments if it appears on the command-line. Conventionally "--" is used to signal that all following command-line arguments are non-option arguments (which would be necessary for arguments starting with a '-' which are not options). It is customary to not return "--" in the list of non-option arguments. This option changes that behavior.


SEPARATED_OPTIONAL_ARGUMENT

public static final UltraGetopt.Behavior SEPARATED_OPTIONAL_ARGUMENT
Allow options with optional arguments to accept options which are not explicitly assigned. Conventionally, an option in the form of --optionalarg arg would be interpreted as the option "optionalarg" without an argument and "arg" as a non-option argument. This behavioral option changes that behavior to interpret "arg" as an argument to "optionalarg".


SHORT_OPTION_ASSIGN

public static final UltraGetopt.Behavior SHORT_OPTION_ASSIGN
Typically short options are not allowed to be assigned an argument (such as -o=file.txt). This behavioral option would cause "-o=file.txt" to be interpreted as the option "o" with argument "file.txt"


NO_EXCEPTIONS

public static final UltraGetopt.Behavior NO_EXCEPTIONS
Do not throw exceptions upon encountering errors. This behavior will force UltraGetopt to continue parsing the command-line arguments and ignore any errors that it encounters (not recommended).


PARTIAL_MATCHING

public static final UltraGetopt.Behavior PARTIAL_MATCHING
Attempt to match long options against the list of accepted options. This would cause "-hel" to be interpreted as option "help" (assuming "help" was a recognized option). However, this option causes an AmbiguousOptionException if there are multiple long options which would match the given option (e.g. if "help" and "hello" were both recognized options). This behavior is similar to the behavior of getopt_long_only in several C libraries.


LONG_OPT_ADJACENT_ARG

public static final UltraGetopt.Behavior LONG_OPT_ADJACENT_ARG
Allow long options to have arguments which are adjacent to the option. This would cause "--helpverbose" to be interpreted as option "help" with argument "verbose" (assuming "help" was a recognized option and there were no longer options such as "helpv"). Note: This is lower priority than PARTIAL_MATCHING, so if both behaviors are specified and the option "hel" is encountered and both "help" and "he" are accepted as options, "hel" will be interpreted as matching "help" rather than matching "he" with argument "l".


TRY_LONG_FIRST

public static final UltraGetopt.Behavior TRY_LONG_FIRST
Attempt to match options with a single leader character against the list of long options before attempting to match against short options. Conventionally an option such as -bv would be interpreted the same as -b -v (two short options), but if this behavior is specified it would instead attempt to match a long option named "bv" before matching 'b' and 'v'. The purpose of this behavior is to provide the functionality of getopt_long_only, available in many getopt implementations libraries.


NONOPTION_AS_ARGUMENT

public static final UltraGetopt.Behavior NONOPTION_AS_ARGUMENT
Return non-option arguments as arguments to a null option. This behavior only applies to getOrderedOptions. Instead of not returning non-option arguments this behavior will cause them to be returned in an OptionArgumentPair where the option is set to null. This is useful for programs which depend on the ordering of non-option arguments with respect to the command-line options.

See Also:
UltraGetopt.getOptionsOrdered()

UNRECOGNIZED_AS_NONOPTARG

public static final UltraGetopt.Behavior UNRECOGNIZED_AS_NONOPTARG
Return unrecognized long options as non-option arguments. Rather than producing an error when an unrecognized option is encountered, this behavior causes the unrecognized option to be treated as a non-option argument. This may be useful for programs which must tolerate arguments beginning with a leader character without requiring the user to denote the end of options with a "--".

See Also:
UltraGetopt.getOptionsOrdered()
Method Detail

values

public static UltraGetopt.Behavior[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (UltraGetopt.Behavior c : UltraGetopt.Behavior.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static UltraGetopt.Behavior valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null