-
- 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 Subparseraliases(java.lang.String... alias)Sets alias names for this Subparser.SubparserdefaultHelp(boolean defaultHelp)If defaultHelp istrue, the default values of arguments are printed in help message.Subparserdescription(java.lang.String description)Sets the description for the arguments of this container.Subparserepilog(java.lang.String epilog)Sets the text to display after the argument help.Subparserhelp(java.lang.String help)Sets the text to display in help message.Subparserhelp(FeatureControl ctrl)Sets special value to control help message handling.SubparsersetDefault(java.lang.String dest, java.lang.Object value)Sets parser-level default value of attributedest.SubparsersetDefaults(java.util.Map<java.lang.String,java.lang.Object> attrs)Sets parser-level default values fromattrs.Subparserversion(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:ArgumentContainerSets the description for the arguments of this container.- Specified by:
descriptionin interfaceArgumentContainer- Specified by:
descriptionin interfaceArgumentParser- Parameters:
description- The description of this container.- Returns:
- this
-
epilog
Subparser epilog(java.lang.String epilog)
Description copied from interface:ArgumentParserSets the text to display after the argument help.- Specified by:
epilogin interfaceArgumentParser- Parameters:
epilog- The text to display after the argument help.- Returns:
- this
-
version
Subparser version(java.lang.String version)
Description copied from interface:ArgumentParserSets 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:
versionin interfaceArgumentParser- Parameters:
version- The version string.- Returns:
- this
-
defaultHelp
Subparser defaultHelp(boolean defaultHelp)
Description copied from interface:ArgumentParserIf 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:
defaultHelpin 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:ArgumentParserSets parser-level default value of attribute
dest.The parser-level defaults always override argument-level defaults.
- Specified by:
setDefaultin 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:ArgumentParserSets parser-level default values from
attrs.All key-value pair in
attrsare registered to parser-level defaults. The parser-level defaults always override argument-level defaults.- Specified by:
setDefaultsin 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.SUPPRESSis 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 eachSubparsersinstance which this object belongs to.- Parameters:
alias- Alias name for this Subparser.- Returns:
- this
-
-