Class SubparsersImpl
- java.lang.Object
-
- net.sourceforge.argparse4j.internal.SubparsersImpl
-
- All Implemented Interfaces:
Subparsers
public final class SubparsersImpl extends Object implements Subparsers
The application code must not use this class directly.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SubparserImpladdParser(String command)Adds and returnsSubparserobject with given sub-command name.SubparserImpladdParser(String command, boolean addHelp)Adds and returnsSubparserobject with given sub-command name and addHelp.SubparserImpladdParser(String command, boolean addHelp, String prefixChars)Adds and returnsSubparserobject with given sub-command name, addHelp and prefixChars.SubparsersImpldescription(String description)Sets the text to display to briefly describe sub-commands in the help message.SubparsersImpldest(String dest)Sets the name of attribute which the selected command name is stored.StringgetDescription()StringgetTitle()SubparsersImplhelp(String help)Sets the text to display in the help message for sub-commands.SubparsersImplmetavar(String metavar)Sets the text used to represent sub-commands in help messages.SubparsersImpltitle(String title)Sets the text to display as a title of sub-commands in the help message.
-
-
-
Method Detail
-
addParser
public SubparserImpl addParser(String command)
Description copied from interface:SubparsersAdds and returns
Subparserobject with given sub-command name. The given command must be unique for each Subparsers instance.The prefixChars is inherited from main ArgumentParser.
- Specified by:
addParserin interfaceSubparsers- Parameters:
command- Sub-command name- Returns:
Subparserobject.
-
addParser
public SubparserImpl addParser(String command, boolean addHelp)
Description copied from interface:SubparsersAdds and returns
Subparserobject with given sub-command name and addHelp. The given command must be unique for each Subparsers instance.For
addHelp, seeArgumentParsers.newArgumentParser(String, boolean, String). The prefixChars is inherited from main ArgumentParser.- Specified by:
addParserin interfaceSubparsers- Parameters:
command- Sub-command nameaddHelp- If true,-h/--helpare available. If false, they are not.- Returns:
Subparserobject
-
addParser
public SubparserImpl addParser(String command, boolean addHelp, String prefixChars)
Description copied from interface:SubparsersAdds and returns
Subparserobject with given sub-command name, addHelp and prefixChars. The given command must be unique for each Subparsers instance.For
addHelp, seeArgumentParsers.newArgumentParser(String, boolean, String).- Specified by:
addParserin interfaceSubparsers- Parameters:
command- Sub-command nameaddHelp- If true,-h/--helpare available. If false, they are not.prefixChars- The set of characters that prefix named arguments.- Returns:
Subparserobject
-
dest
public SubparsersImpl dest(String dest)
Description copied from interface:SubparsersSets the name of attribute which the selected command name is stored.- Specified by:
destin interfaceSubparsers- Parameters:
dest- The name of attribute the selected command name is stored.- Returns:
- this.
-
help
public SubparsersImpl help(String help)
Description copied from interface:SubparsersSets the text to display in the help message for sub-commands.- Specified by:
helpin interfaceSubparsers- Parameters:
help- The text to display in the help message.- Returns:
- this
-
title
public SubparsersImpl title(String title)
Description copied from interface:SubparsersSets the text to display as a title of sub-commands in the help message.
If either title or description(
Subparsers.description(String)) is specified, sub-command help will be displayed in its own group.- Specified by:
titlein interfaceSubparsers- Parameters:
title- The text to display as a title of sub-commands- Returns:
- this
-
getTitle
public String getTitle()
-
description
public SubparsersImpl description(String description)
Description copied from interface:SubparsersSets the text to display to briefly describe sub-commands in the help message.
If either description or title(
Subparsers.title(String)) is specified, sub-command help will be displayed in its own group.- Specified by:
descriptionin interfaceSubparsers- Parameters:
description- The text to display to briefly describe sub-commands- Returns:
- this
-
getDescription
public String getDescription()
-
metavar
public SubparsersImpl metavar(String metavar)
Description copied from interface:SubparsersSets the text used to represent sub-commands in help messages.
By default, text to represent sub-commands are concatenation of all sub-commands. This method can override this default behavior and sets arbitrary string to use. This is useful if there are many sub-commands and you don't want to show them all.
- Specified by:
metavarin interfaceSubparsers- Parameters:
metavar- The text used to represent sub-commands in help messages- Returns:
- this
-
-