-
- All Superinterfaces:
ArgumentContainer
,ArgumentParser
- All Known Implementing Classes:
SubparserImpl
public interface Subparser extends ArgumentParser
This interface defines Subparser used to add sub-command to
ArgumentParser
.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Subparser
aliases(java.lang.String... alias)
Sets alias names for this Subparser.Subparser
defaultHelp(boolean defaultHelp)
If defaultHelp istrue
, the default values of arguments are printed in help message.Subparser
description(java.lang.String description)
Sets the description for the arguments of this container.Subparser
epilog(java.lang.String epilog)
Sets the text to display after the argument help.Subparser
help(java.lang.String help)
Sets the text to display in help message.Subparser
help(FeatureControl ctrl)
Sets special value to control help message handling.Subparser
setDefault(java.lang.String dest, java.lang.Object value)
Sets parser-level default value of attributedest
.Subparser
setDefaults(java.util.Map<java.lang.String,java.lang.Object> attrs)
Sets parser-level default values fromattrs
.Subparser
version(java.lang.String version)
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 Detail
-
description
Subparser description(java.lang.String 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
Subparser epilog(java.lang.String 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
Subparser version(java.lang.String 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
Subparser defaultHelp(boolean 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
Subparser setDefault(java.lang.String dest, java.lang.Object value)
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
Subparser setDefaults(java.util.Map<java.lang.String,java.lang.Object> attrs)
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
Subparser help(java.lang.String help)
Sets the text to display in help message.- Parameters:
help
- The text to display in help message.- Returns:
- this
-
help
Subparser help(FeatureControl ctrl)
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
Subparser aliases(java.lang.String... alias)
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
-
-