| Package | Description |
|---|---|
| org.apache.commons.cli |
Apache Commons CLI provides a simple API for presenting, processing, and validating a Command Line Interface.
|
| org.apache.commons.cli.help |
The help production system.
|
| Modifier and Type | Field | Description |
|---|---|---|
protected Option |
DefaultParser.currentOption
The last option parsed.
|
| Modifier and Type | Field | Description |
|---|---|---|
protected Comparator<Option> |
HelpFormatter.optionComparator
Deprecated.
Comparator used to sort the options when they output in help text
Defaults to case-insensitive alphabetical sorting by option key
|
| Modifier and Type | Method | Description |
|---|---|---|
Option |
Option.Builder.build()
Deprecated.
Use
Option.Builder.get(). |
|
static Option |
OptionBuilder.create()
Deprecated.
Creates an Option using the current settings.
|
|
static Option |
OptionBuilder.create(char opt)
Deprecated.
Creates an Option using the current settings and with the specified Option
char. |
|
static Option |
OptionBuilder.create(String opt)
Deprecated.
Creates an Option using the current settings and with the specified Option
char. |
|
Option |
Option.Builder.get()
Constructs an Option with the values declared by this
Option.Builder. |
|
Option |
MissingArgumentException.getOption()
Gets the option requiring an argument that wasn't provided on the command line.
|
|
Option |
AlreadySelectedException.getOption()
Gets the option that was added to the group and triggered the exception.
|
|
Option |
Options.getOption(String opt)
Gets the
Option matching the long or short name specified. |
|
Option[] |
CommandLine.getOptions()
Gets an array of the processed
Options. |
| Modifier and Type | Method | Description |
|---|---|---|
Comparator<Option> |
HelpFormatter.getOptionComparator()
Deprecated.
Comparator used to sort the options when they output in help text.
|
|
Collection<Option> |
Options.getOptions()
Gets a read-only list of options in this set.
|
|
Collection<Option> |
OptionGroup.getOptions()
Gets the options in this group as a
Collection. |
|
Iterator<Option> |
CommandLine.iterator()
Returns an iterator over the Option members of CommandLine.
|
| Modifier and Type | Method | Description |
|---|---|---|
Options |
Options.addOption(Option opt)
Adds an option instance.
|
|
OptionGroup |
OptionGroup.addOption(Option option)
Adds the given
Option to this group. |
|
protected void |
CommandLine.addOption(Option option)
Adds an option to the command line.
|
|
CommandLine.Builder |
CommandLine.Builder.addOption(Option option)
Adds an option to the command line.
|
|
static String |
HelpFormatter.getDescription(Option option)
Deprecated.
Gets the option description or an empty string if the description is
null. |
|
int |
CommandLine.getOptionCount(Option option)
Gets the number of times this option appears in the command line.
|
|
OptionGroup |
Options.getOptionGroup(Option option)
Gets the OptionGroup the
opt belongs to. |
|
Properties |
CommandLine.getOptionProperties(Option option)
Gets the map of values associated to the option.
|
|
String |
CommandLine.getOptionValue(Option option)
Gets the first argument, if any, of this option.
|
|
String |
CommandLine.getOptionValue(Option option,
String defaultValue)
Gets the first argument, if any, of an option.
|
|
String |
CommandLine.getOptionValue(Option option,
Supplier<String> defaultValue)
Gets the first argument, if any, of an option.
|
|
String[] |
CommandLine.getOptionValues(Option option)
Gets the array of values, if any, of an option.
|
|
<T> T |
CommandLine.getParsedOptionValue(Option option)
Gets a version of this
Option converted to a particular type. |
|
<T> T |
CommandLine.getParsedOptionValue(Option option,
Supplier<T> defaultValue)
Gets a version of this
Option converted to a particular type. |
|
<T> T |
CommandLine.getParsedOptionValue(Option option,
T defaultValue)
Gets a version of this
Option converted to a particular type. |
|
<T> T[] |
CommandLine.getParsedOptionValues(Option option)
Gets a version of this
Option converted to an array of a particular type. |
|
<T> T[] |
CommandLine.getParsedOptionValues(Option option,
Supplier<T[]> defaultValue)
Gets a version of this
Option converted to an array of a particular type. |
|
<T> T[] |
CommandLine.getParsedOptionValues(Option option,
T[] defaultValue)
Gets a version of this
Option converted to an array of a particular type. |
|
boolean |
CommandLine.hasOption(Option option)
Tests to see if an option has been set.
|
|
void |
Parser.processArgs(Option opt,
ListIterator<String> iter)
Deprecated.
Processes the argument values for the specified Option
opt using the values retrieved from the specified
iterator iter. |
|
void |
OptionGroup.setSelected(Option option)
Sets the selected option of this group to
name. |
| Modifier and Type | Method | Description |
|---|---|---|
DefaultParser.Builder |
DefaultParser.Builder.setDeprecatedHandler(Consumer<Option> deprecatedHandler)
Sets the deprecated option handler.
|
|
CommandLine.Builder |
CommandLine.Builder.setDeprecatedHandler(Consumer<Option> deprecatedHandler)
Sets the deprecated option handler.
|
|
void |
HelpFormatter.setOptionComparator(Comparator<Option> comparator)
Deprecated.
Sets the comparator used to sort the options when they output in help text.
|
|
HelpFormatter.Builder |
HelpFormatter.Builder.setShowDeprecated(Function<Option,String> deprecatedFormatFunction)
Sets whether to show deprecated options.
|
| Constructor | Description |
|---|---|
AlreadySelectedException(OptionGroup optionGroup,
Option option)
Constructs a new
AlreadySelectedException for the specified option group. |
|
MissingArgumentException(Option option)
Constructs a new
MissingArgumentException with the specified detail message. |
| Modifier and Type | Field | Description |
|---|---|---|
static Function<Option,String> |
OptionFormatter.COMPLEX_DEPRECATED_FORMAT
A function to display a deprecated option with a "Deprecated" prefix that displays all deprecation information.
|
|
static Comparator<Option> |
AbstractHelpFormatter.DEFAULT_COMPARATOR
The default comparator for
Option implementations. |
|
static Function<Option,String> |
OptionFormatter.NO_DEPRECATED_FORMAT
A function to display a deprecated option with the "[Deprecated]" prefix.
|
|
static Function<Option,String> |
OptionFormatter.SIMPLE_DEPRECATED_FORMAT
A function to display a deprecated option with the "[Deprecated]" prefix.
|
| Modifier and Type | Method | Description |
|---|---|---|
protected Comparator<Option> |
AbstractHelpFormatter.getComparator()
Gets the comparator for sorting options.
|
|
protected Comparator<Option> |
AbstractHelpFormatter.Builder.getComparator()
Gets the comparator to sort lists of options.
|
|
List<Option> |
AbstractHelpFormatter.sort(Iterable<Option> options)
Creates a new list of options ordered by the comparator.
|
|
List<Option> |
AbstractHelpFormatter.sort(Options options)
Creates a new list of options ordered by the comparator.
|
| Modifier and Type | Method | Description |
|---|---|---|
OptionFormatter |
OptionFormatter.Builder.build(Option option)
Build an OptionFormatter to format the specified option.
|
|
static OptionFormatter |
OptionFormatter.from(Option option)
|
|
OptionFormatter |
AbstractHelpFormatter.getOptionFormatter(Option option)
Constructs an
OptionFormatter for the specified Option. |
| Modifier and Type | Method | Description |
|---|---|---|
protected abstract TableDefinition |
AbstractHelpFormatter.getTableDefinition(Iterable<Option> options)
Converts a collection of
Options into a TableDefinition. |
|
TableDefinition |
HelpFormatter.getTableDefinition(Iterable<Option> options)
Gets the table definition for the options.
|
|
void |
AbstractHelpFormatter.printHelp(String cmdLineSyntax,
String header,
Iterable<Option> options,
String footer,
boolean autoUsage)
Prints the help for
Options with the specified command line syntax. |
|
void |
AbstractHelpFormatter.printOptions(Iterable<Option> options)
Prints the option table for a collection of
Option objects to the HelpAppendable. |
|
B |
AbstractHelpFormatter.Builder.setComparator(Comparator<Option> comparator)
Sets the comparator to use for sorting options.
|
|
OptionFormatter.Builder |
OptionFormatter.Builder.setDeprecatedFormatFunction(Function<Option,String> deprecatedFormatFunction)
Specifies the function to construct the deprecated massage for the Option.
|
|
List<Option> |
AbstractHelpFormatter.sort(Iterable<Option> options)
Creates a new list of options ordered by the comparator.
|
|
String |
AbstractHelpFormatter.toSyntaxOptions(Iterable<Option> options)
Return the string representation of the options as used in the syntax display.
|
|
protected String |
AbstractHelpFormatter.toSyntaxOptions(Iterable<Option> options,
Function<Option,OptionGroup> lookup)
Return the string representation of the options as used in the syntax display.
|
|
protected String |
AbstractHelpFormatter.toSyntaxOptions(Iterable<Option> options,
Function<Option,OptionGroup> lookup)
Return the string representation of the options as used in the syntax display.
|
Copyright © 2002-2025 The Apache Software Foundation. All rights reserved.Apache Commons CLI | Issue management | Source repository