public final class ArgumentParsers extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_FORMAT_WIDTH
Default format width of text output.
|
static String |
DEFAULT_PREFIX_CHARS
Default prefix characters.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
getCjkWidthHack()
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static int |
getFormatWidth()
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static boolean |
getNoDestConversionForPositionalArgs()
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static boolean |
getTerminalWidthDetection()
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static boolean |
isSingleMetavar()
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static ArgumentParser |
newArgumentParser(String prog)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static ArgumentParser |
newArgumentParser(String prog,
boolean addHelp)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static ArgumentParser |
newArgumentParser(String prog,
boolean addHelp,
String prefixChars)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static ArgumentParser |
newArgumentParser(String prog,
boolean addHelp,
String prefixChars,
String fromFilePrefix)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static ArgumentParserBuilder |
newFor(String prog)
Creates
ArgumentParserBuilder with given program name. |
static void |
setCJKWidthHack(boolean flag)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static void |
setNoDestConversionForPositionalArgs(boolean flag)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static void |
setSingleMetavar(boolean singleMetavar)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
static void |
setTerminalWidthDetection(boolean flag)
Deprecated.
This is not thread safe. Use
newFor(String) instead. |
public static final String DEFAULT_PREFIX_CHARS
public static final int DEFAULT_FORMAT_WIDTH
public static ArgumentParserBuilder newFor(String prog)
Creates ArgumentParserBuilder
with given program name.
prog
- The program name@Deprecated public static ArgumentParser newArgumentParser(String prog)
newFor(String)
instead.
Creates ArgumentParser
with given program name.
This is equivalent with newArgumentParser(prog, true, "-", null)
.
prog
- The program name@Deprecated public static ArgumentParser newArgumentParser(String prog, boolean addHelp)
newFor(String)
instead.
Creates ArgumentParser
with given program name and addHelp.
This is equivalent with ArgumentParser(prog, addHelp, "-", null)
.
prog
- The program nameaddHelp
- If true, -h/--help
are available. If false, they are
not.@Deprecated public static ArgumentParser newArgumentParser(String prog, boolean addHelp, String prefixChars)
newFor(String)
instead.
Creates ArgumentParser
with given program name, addHelp and
prefixChars.
This is equivalent with
ArgumentParser(prog, addHelp, prefixChars, null)
.
prog
- The program nameaddHelp
- If true, -h/--help
are available. If false, they are
not.prefixChars
- The set of characters that prefix named arguments.@Deprecated public static ArgumentParser newArgumentParser(String prog, boolean addHelp, String prefixChars, String fromFilePrefix)
newFor(String)
instead.
Creates ArgumentParser
with given program name, addHelp and
prefixChars.
prog
- The program nameaddHelp
- If true, -h/--help
are available. If false, they are
not.prefixChars
- The set of characters that prefix named arguments.fromFilePrefix
- The set of characters that prefix file path from which
additional arguments should be read. Specify null
to
disable reading arguments from file.@Deprecated public static void setCJKWidthHack(boolean flag)
newFor(String)
instead.
Set true
to enable CJK width hack.
The CJK width hack is treat Unicode characters having East Asian Width property Wide/Full/Ambiguous to have twice a width of ascii characters when formatting help message if locale is "ja", "zh" or "ko". This feature is enabled by default.
flag
- true
or false
@Deprecated public static boolean getCjkWidthHack()
newFor(String)
instead.true
or false
@Deprecated public static void setTerminalWidthDetection(boolean flag)
newFor(String)
instead.
Set true
to enable terminal width detection.
If this feature is enabled, argparse4j will automatically detect the terminal width and use it to format help messages.
flag
- true
or false
@Deprecated public static boolean getTerminalWidthDetection()
newFor(String)
instead.true
or false
@Deprecated public static int getFormatWidth()
newFor(String)
instead.DEFAULT_FORMAT_WIDTH
is returned.@Deprecated public static void setSingleMetavar(boolean singleMetavar)
newFor(String)
instead.
If singleMetavar is true
, a metavar string in help message is
only shown after the last flag instead of each flag.
By default and false
is given to this method, a metavar is shown
after each flag:
-f FOO, --foo FOO
If true
is given to this method, a metavar string is shown only
once:
-f, --foo FOO
singleMetavar
- Switch to display a metavar only after the last flag.@Deprecated public static boolean isSingleMetavar()
newFor(String)
instead.true
or false
@Deprecated public static void setNoDestConversionForPositionalArgs(boolean flag)
newFor(String)
instead.
Do not perform any conversion to produce "dest" value (See
Argument.getDest()
) from positional argument name.
Prior 0.5.0, no conversion is made to produce "dest" value from positional argument name. Since 0.5.0, "dest" value is generated by replacing "-" with "_" in positional argument name. This is the same conversion rule for named arguments.
By default, this is set to false
(which means, conversion will be
done). Application is advised to update its implementation to cope with
this change. But if it is not feasible, call this method with
true
to turn off the conversion and retain the same behaviour
with pre-0.5.0 version.
flag
- Switch not to perform conversion to produce dest for
positional arguments. If true
is given, no conversion
is made.@Deprecated public static boolean getNoDestConversionForPositionalArgs()
newFor(String)
instead.true
iff no destination value conversion for positional
arguments is enabled.true
or false
Copyright © 2012–2017. All rights reserved.