Package org.kohsuke.args4j
Class ParserProperties
java.lang.Object
org.kohsuke.args4j.ParserProperties
Set of properties that controls
CmdLineParser
behaviours.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
(package private) static final Comparator
<OptionHandler> private static final int
private Comparator
<OptionHandler> private String
private boolean
private int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ParserProperties
defaults()
Returns an instance of the default parser properties.boolean
Gets whether @-prefix-parsing is enabled.(package private) Comparator
<OptionHandler> boolean
Gets whether show defaults is enabled.(package private) int
withAtSyntax
(boolean atSyntax) Toggles the parsing of @-prefixes in values.withOptionSorter
(Comparator<OptionHandler> sorter) Controls how options are sorted in the usage screen.Sets the string used to separate option name and its value (such as --foo=bar vs --foo bar) Default to whitespace.withShowDefaults
(boolean showDefaults) Toggles the showing of default values in the command line help.withUsageWidth
(int usageWidth) Sets the width of a usage line.
-
Field Details
-
DEFAULT_USAGE_WIDTH
private static final int DEFAULT_USAGE_WIDTH- See Also:
-
usageWidth
private int usageWidth -
optionSorter
-
optionValueDelimiter
-
atSyntax
private boolean atSyntax -
showDefaults
private boolean showDefaults -
DEFAULT_COMPARATOR
-
-
Constructor Details
-
ParserProperties
private ParserProperties()
-
-
Method Details
-
defaults
Returns an instance of the default parser properties. This instance can be manipulated with thewithXXX()
methods in this class. -
withAtSyntax
Toggles the parsing of @-prefixes in values. If a command line value starts with @, it is interpreted as being a file, loaded, and interpreted as if the file content would have been passed to the command line.- Parameters:
atSyntax
-true
if at sign is being parsed,false
if it is to be ignored. Defaults totrue
.- See Also:
-
getAtSyntax
public boolean getAtSyntax()Gets whether @-prefix-parsing is enabled.- See Also:
-
withShowDefaults
Toggles the showing of default values in the command line help.- Parameters:
showDefaults
-true
if to show defaults,false
otherweise. Defaults totrue
.- See Also:
-
getShowDefaults
public boolean getShowDefaults()Gets whether show defaults is enabled.- See Also:
-
withUsageWidth
Sets the width of a usage line. If the usage message is longer than this value, the parser wraps the line. Defaults to80
.- Parameters:
usageWidth
- the width of the usage output in columns.- Throws:
IllegalArgumentException
- ifusageWidth
is negative
-
getUsageWidth
int getUsageWidth()- Returns:
- the width of a usage line.
-
withOptionSorter
Controls how options are sorted in the usage screen.- Parameters:
sorter
- If non-null
, options are sorted in the order induced by this comparator.
-
getOptionSorter
Comparator<OptionHandler> getOptionSorter()- Returns:
null
if options are left unsorted and should be listed by their discovery order. Otherwise the returned comparator is used to sort options. The default value is a comparator that sorts options alphabetically.
-
withOptionValueDelimiter
Sets the string used to separate option name and its value (such as --foo=bar vs --foo bar) Default to whitespace. Note that the tokens separated in the argument array (such as '-foo','bar') is always recognized as a valid name/value separator. -
getOptionValueDelimiter
-