- All Superinterfaces:
ArgumentContainer
,ArgumentParser
- All Known Implementing Classes:
SubparserImpl
This interface defines Subparser used to add sub-command to
ArgumentParser
.
-
Method Summary
Modifier and TypeMethodDescriptionSets alias names for this Subparser.defaultHelp
(boolean defaultHelp) If defaultHelp istrue
, the default values of arguments are printed in help message.description
(String description) Sets the description for the arguments of this container.Sets the text to display after the argument help.Sets the text to display in help message.help
(FeatureControl ctrl) Sets special value to control help message handling.setDefault
(String dest, Object value) Sets parser-level default value of attributedest
.setDefaults
(Map<String, Object> attrs) Sets parser-level default values fromattrs
.Sets version string.Methods inherited from interface net.sourceforge.argparse4j.inf.ArgumentContainer
addArgument
Methods inherited from interface net.sourceforge.argparse4j.inf.ArgumentParser
addArgumentGroup, addMutuallyExclusiveGroup, addMutuallyExclusiveGroup, addSubparsers, formatHelp, formatUsage, formatVersion, getConfig, getDefault, handleError, handleError, parseArgs, parseArgs, parseArgs, parseArgs, parseArgsOrFail, parseKnownArgs, parseKnownArgs, parseKnownArgs, parseKnownArgs, parseKnownArgsOrFail, printHelp, printHelp, printUsage, printUsage, printVersion, printVersion, usage
-
Method Details
-
description
Description copied from interface:ArgumentContainer
Sets the description for the arguments of this container.- Specified by:
description
in interfaceArgumentContainer
- Specified by:
description
in interfaceArgumentParser
- Parameters:
description
- The description of this container.- Returns:
- this
-
epilog
Description copied from interface:ArgumentParser
Sets the text to display after the argument help.- Specified by:
epilog
in interfaceArgumentParser
- Parameters:
epilog
- The text to display after the argument help.- Returns:
- this
-
version
Description copied from interface:ArgumentParser
Sets version string. It will be displayed
ArgumentParser.printVersion()
.If the given usage contains
${prog}
string, it will be replaced with the program name given inArgumentParsers.newArgumentParser(String)
. This processed text will be printed without text-wrapping.- Specified by:
version
in interfaceArgumentParser
- Parameters:
version
- The version string.- Returns:
- this
-
defaultHelp
Description copied from interface:ArgumentParser
If defaultHelp is
true
, the default values of arguments are printed in help message.By default, the default values are not printed in help message.
- Specified by:
defaultHelp
in interfaceArgumentParser
- Parameters:
defaultHelp
- Switch to display the default value in help message.- Returns:
- this
-
setDefault
Description copied from interface:ArgumentParser
Sets parser-level default value of attribute
dest
.The parser-level defaults always override argument-level defaults.
- Specified by:
setDefault
in interfaceArgumentParser
- Parameters:
dest
- The attribute name.value
- The default value.- Returns:
- this
-
setDefaults
Description copied from interface:ArgumentParser
Sets parser-level default values from
attrs
.All key-value pair in
attrs
are registered to parser-level defaults. The parser-level defaults always override argument-level defaults.- Specified by:
setDefaults
in interfaceArgumentParser
- Parameters:
attrs
- The parser-level default values to add.- Returns:
- this
-
help
Sets the text to display in help message.- Parameters:
help
- The text to display in help message.- Returns:
- this
-
help
Sets special value to control help message handling.
Currently, only
FeatureControl.SUPPRESS
is available. If it is given, the help entry for this Subparser is not displayed in the help message.- Parameters:
ctrl
- The special value to control help message handling.- Returns:
- this
- Since:
- 0.8.0
-
aliases
Sets alias names for this Subparser. The alias names must be unique for eachSubparsers
instance which this object belongs to.- Parameters:
alias
- Alias name for this Subparser.- Returns:
- this
-