public final class SubparsersImpl extends Object implements Subparsers
Modifier and Type | Method and Description |
---|---|
SubparserImpl |
addParser(String command)
Adds and returns
Subparser object with given sub-command name. |
SubparserImpl |
addParser(String command,
boolean addHelp)
Adds and returns
Subparser object with given sub-command name and
addHelp. |
SubparserImpl |
addParser(String command,
boolean addHelp,
String prefixChars)
Adds and returns
Subparser object with given sub-command name,
addHelp and prefixChars. |
SubparsersImpl |
description(String description)
Sets the text to display to briefly describe sub-commands in the help
message.
|
SubparsersImpl |
dest(String dest)
Sets the name of attribute which the selected command name is stored.
|
String |
getDescription() |
String |
getTitle() |
SubparsersImpl |
help(String help)
Sets the text to display in the help message for sub-commands.
|
SubparsersImpl |
metavar(String metavar)
Sets the text used to represent sub-commands in help messages.
|
SubparsersImpl |
title(String title)
Sets the text to display as a title of sub-commands in the help message.
|
public SubparserImpl addParser(String command)
Subparsers
Adds and returns Subparser
object with given sub-command name.
The given command must be unique for each Subparsers instance.
The prefixChars is inherited from main ArgumentParser.
addParser
in interface Subparsers
command
- Sub-command nameSubparser
object.public SubparserImpl addParser(String command, boolean addHelp)
Subparsers
Adds and returns Subparser
object with given sub-command name and
addHelp. The given command must be unique for each Subparsers instance.
For addHelp
, see
ArgumentParsers.newArgumentParser(String, boolean, String)
. The
prefixChars is inherited from main ArgumentParser.
addParser
in interface Subparsers
command
- Sub-command nameaddHelp
- If true, -h/--help
are available. If false, they are
not.Subparser
objectpublic SubparserImpl addParser(String command, boolean addHelp, String prefixChars)
Subparsers
Adds and returns Subparser
object with given sub-command name,
addHelp and prefixChars. The given command must be unique for each
Subparsers instance.
For addHelp
, see
ArgumentParsers.newArgumentParser(String, boolean, String)
.
addParser
in interface Subparsers
command
- Sub-command nameaddHelp
- If true, -h/--help
are available. If false, they are
not.prefixChars
- The set of characters that prefix named arguments.Subparser
objectpublic SubparsersImpl dest(String dest)
Subparsers
dest
in interface Subparsers
dest
- The name of attribute the selected command name is stored.public SubparsersImpl help(String help)
Subparsers
help
in interface Subparsers
help
- The text to display in the help message.public SubparsersImpl title(String title)
Subparsers
Sets 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.
title
in interface Subparsers
title
- The text to display as a title of sub-commandspublic String getTitle()
public SubparsersImpl description(String description)
Subparsers
Sets 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.
description
in interface Subparsers
description
- The text to display to briefly describe sub-commandspublic String getDescription()
public SubparsersImpl metavar(String metavar)
Subparsers
Sets 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.
metavar
in interface Subparsers
metavar
- The text used to represent sub-commands in help messagesCopyright © 2012–2017. All rights reserved.