Package org.kohsuke.args4j
Class ParserProperties
- java.lang.Object
-
- org.kohsuke.args4j.ParserProperties
-
public class ParserProperties extends java.lang.Object
Set of properties that controlsCmdLineParser
behaviours.- See Also:
CmdLineParser(Object, ParserProperties)
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ParserProperties
defaults()
Returns an instance of the default parser properties.boolean
getAtSyntax()
Gets whether @-prefix-parsing is enabled.java.lang.String
getOptionValueDelimiter()
boolean
getShowDefaults()
Gets whether show defaults is enabled.ParserProperties
withAtSyntax(boolean atSyntax)
Toggles the parsing of @-prefixes in values.ParserProperties
withOptionSorter(java.util.Comparator<OptionHandler> sorter)
Controls how options are sorted in the usage screen.ParserProperties
withOptionValueDelimiter(java.lang.String v)
Sets the string used to separate option name and its value (such as --foo=bar vs --foo bar) Default to whitespace.ParserProperties
withShowDefaults(boolean showDefaults)
Toggles the showing of default values in the command line help.ParserProperties
withUsageWidth(int usageWidth)
Sets the width of a usage line.
-
-
-
Method Detail
-
defaults
public static ParserProperties defaults()
Returns an instance of the default parser properties. This instance can be manipulated with thewithXXX()
methods in this class.
-
withAtSyntax
public ParserProperties withAtSyntax(boolean atSyntax)
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()
-
getAtSyntax
public boolean getAtSyntax()
Gets whether @-prefix-parsing is enabled.- See Also:
withAtSyntax(boolean)
-
withShowDefaults
public ParserProperties withShowDefaults(boolean showDefaults)
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()
-
getShowDefaults
public boolean getShowDefaults()
Gets whether show defaults is enabled.- See Also:
withShowDefaults(boolean)
-
withUsageWidth
public ParserProperties withUsageWidth(int usageWidth)
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:
java.lang.IllegalArgumentException
- ifusageWidth
is negative
-
withOptionSorter
public ParserProperties withOptionSorter(java.util.Comparator<OptionHandler> sorter)
Controls how options are sorted in the usage screen.- Parameters:
sorter
- If non-null
, options are sorted in the order induced by this comparator.
-
withOptionValueDelimiter
public ParserProperties withOptionValueDelimiter(java.lang.String v)
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
public java.lang.String getOptionValueDelimiter()
-
-