Top Description Fields Constructors Methods
io.vertx.core.cli.impl

public Class DefaultCLI

extends Object
implements CLI
Class Inheritance
All Implemented Interfaces
io.vertx.core.cli.CLI
Imports
io.vertx.core.cli.*, java.util.*, java.util.function.Predicate, java.util.stream.Collectors

Default implementation of CLI.
Author
Clement Escoffier

Field Summary

Modifier and TypeField and Description
private List<Argument>
protected String
protected boolean
protected String
protected List<Option>
protected int
protected String

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public CLI
addArgument(Argument
the argument, must not be null
arg
)

Implements io.vertx.core.cli.CLI.addArgument.

Adds an argument.

public CLI
addArguments(List<Argument>
the arguments, must not be null
args
)

Implements io.vertx.core.cli.CLI.addArguments.

Adds a set of arguments.

public CLI
addOption(Option
the option, must not be null.
option
)

Implements io.vertx.core.cli.CLI.addOption.

Adds an option.

public CLI
addOptions(List<Option>
the options, must not be null
options
)

Implements io.vertx.core.cli.CLI.addOptions.

Adds a set of options.

public Argument
getArgument(String
the name of the argument, must not be null
name
)

Implements io.vertx.core.cli.CLI.getArgument.

Gets an Argument based on its name (argument name).

public Argument
getArgument(int
the index, must be positive or zero.
index
)

Implements io.vertx.core.cli.CLI.getArgument.

Gets an Argument based on its index.

public List<Argument>
getArguments()

Implements io.vertx.core.cli.CLI.getArguments.

Gets the list of defined arguments.

public String
public String
public Option
getOption(String
the name, must not be null
name
)

Implements io.vertx.core.cli.CLI.getOption.

Gets an Option based on its name (short name, long name or argument name).

public List<Option>
getOptions()

Implements io.vertx.core.cli.CLI.getOptions.

Gets the list of options.

public int
public String
public boolean
isHidden()

Implements io.vertx.core.cli.CLI.isHidden.

Checks whether or not the current CLI instance is hidden.

public CommandLine

Returns:

the creates command line
parse
(List<String>
the arguments
arguments
)

Implements io.vertx.core.cli.CLI.parse.

Parses the user command line interface and create a new CommandLine containing extracting values.

public CommandLine

Returns:

the creates command line
parse
(List<String>
the arguments
arguments
,
boolean
enable / disable parsing validation
validate
)

Implements io.vertx.core.cli.CLI.parse.

Parses the user command line interface and create a new CommandLine containing extracting values.

public CLI
removeArgument(int
the argument index
index
)

Implements io.vertx.core.cli.CLI.removeArgument.

Removes an argument identified by its index.

public CLI
removeOption(String
the option name
name
)

Implements io.vertx.core.cli.CLI.removeOption.

Removes an option identified by its name.

public CLI
setArguments(List<Argument>
the list of arguments, must not be null
args
)

Implements io.vertx.core.cli.CLI.setArguments.

Sets the list of arguments.

public CLI
public CLI
setHidden(boolean
enables or disables the hidden aspect of the CI
hidden
)

Implements io.vertx.core.cli.CLI.setHidden.

Sets whether or not the current instance of CLI must be hidden.

public CLI
setName(String
the name
name
)

Implements io.vertx.core.cli.CLI.setName.

Sets the name of the CLI.

public CLI
setOptions(List<Option>
the list of options, must not be null
options
)

Implements io.vertx.core.cli.CLI.setOptions.

Sets the list of arguments.

public CLI
setPriority(int
the priority
priority
)

Implements io.vertx.core.cli.CLI.setPriority.

Sets the priority of the CLI.

public CLI
setSummary(String
the summary
summary
)

Implements io.vertx.core.cli.CLI.setSummary.

Sets the summary of the CLI.

public CLI
usage(StringBuilder
the string builder in which the help is going to be printed
builder
)

Implements io.vertx.core.cli.CLI.usage.

Generates the usage / help of the current CLI.

public CLI
usage(StringBuilder
the string builder in which the help is going to be printed
builder
,
String
an optional prefix
prefix
)

Implements io.vertx.core.cli.CLI.usage.

Generates the usage / help of the current CLI.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

argumentsback to summary
private List<Argument> arguments
descriptionback to summary
protected String description
hiddenback to summary
protected boolean hidden
nameback to summary
protected String name
optionsback to summary
protected List<Option> options
priorityback to summary
protected int priority
summaryback to summary
protected String summary

Constructor Detail

DefaultCLIback to summary
public DefaultCLI()

Method Detail

addArgumentback to summary
public CLI addArgument(Argument arg)

Implements io.vertx.core.cli.CLI.addArgument.

Doc from io.vertx.core.cli.CLI.addArgument.

Adds an argument.

Parameters
arg:Argument

the argument, must not be null

Returns:CLI

the current CLI instance

Annotations
@Override
addArgumentsback to summary
public CLI addArguments(List<Argument> args)

Implements io.vertx.core.cli.CLI.addArguments.

Doc from io.vertx.core.cli.CLI.addArguments.

Adds a set of arguments. Unlike setArguments(List), this method does not remove the existing arguments. The given list is appended to the existing list.

Parameters
args:List<Argument>

the arguments, must not be null

Returns:CLI

the current CLI instance

Annotations
@Override
addOptionback to summary
public CLI addOption(Option option)

Implements io.vertx.core.cli.CLI.addOption.

Doc from io.vertx.core.cli.CLI.addOption.

Adds an option.

Parameters
option:Option

the option, must not be null.

Returns:CLI

the current CLI instance

Annotations
@Override
addOptionsback to summary
public CLI addOptions(List<Option> options)

Implements io.vertx.core.cli.CLI.addOptions.

Doc from io.vertx.core.cli.CLI.addOptions.

Adds a set of options. Unlike setOptions(List)}, this method does not remove the existing options. The given list is appended to the existing list.

Parameters
options:List<Option>

the options, must not be null

Returns:CLI

the current CLI instance

Annotations
@Override
getArgumentback to summary
public Argument getArgument(String name)

Implements io.vertx.core.cli.CLI.getArgument.

Doc from io.vertx.core.cli.CLI.getArgument.

Gets an Argument based on its name (argument name).

Parameters
name:String

the name of the argument, must not be null

Returns:Argument

the Argument, null if not found.

Annotations
@Override
getArgumentback to summary
public Argument getArgument(int index)

Implements io.vertx.core.cli.CLI.getArgument.

Doc from io.vertx.core.cli.CLI.getArgument.

Gets an Argument based on its index.

Parameters
index:int

the index, must be positive or zero.

Returns:Argument

the Argument, null if not found.

Annotations
@Override
getArgumentsback to summary
public List<Argument> getArguments()

Implements io.vertx.core.cli.CLI.getArguments.

Doc from io.vertx.core.cli.CLI.getArguments.

Gets the list of defined arguments.

Returns:List<Argument>

the list of argument, empty if none.

Annotations
@Override
getDescriptionback to summary
public String getDescription()

Implements io.vertx.core.cli.CLI.getDescription.

Returns:String

Doc from io.vertx.core.cli.CLI.getDescription.

the CLI description.

Annotations
@Override
getNameback to summary
public String getName()

Implements io.vertx.core.cli.CLI.getName.

Returns:String

Doc from io.vertx.core.cli.CLI.getName.

the CLI name.

Annotations
@Override
getOptionback to summary
public Option getOption(String name)

Implements io.vertx.core.cli.CLI.getOption.

Doc from io.vertx.core.cli.CLI.getOption.

Gets an Option based on its name (short name, long name or argument name).

Parameters
name:String

the name, must not be null

Returns:Option

the Option, null if not found

Annotations
@Override
getOptionsback to summary
public List<Option> getOptions()

Implements io.vertx.core.cli.CLI.getOptions.

Doc from io.vertx.core.cli.CLI.getOptions.

Gets the list of options.

Returns:List<Option>

the list of options, empty if none.

Annotations
@Override
getPriorityback to summary
public int getPriority()

Implements io.vertx.core.cli.CLI.getPriority.

Returns:int

Doc from io.vertx.core.cli.CLI.getPriority.

the CLI priority.

Annotations
@Override
getSummaryback to summary
public String getSummary()

Implements io.vertx.core.cli.CLI.getSummary.

Returns:String

Doc from io.vertx.core.cli.CLI.getSummary.

the CLI summary.

Annotations
@Override
isHiddenback to summary
public boolean isHidden()

Implements io.vertx.core.cli.CLI.isHidden.

Doc from io.vertx.core.cli.CLI.isHidden.

Checks whether or not the current CLI instance is hidden.

Returns:boolean

true if the current CLI is hidden, false otherwise

Annotations
@Override
parseback to summary
public CommandLine parse(List<String> arguments)

Implements io.vertx.core.cli.CLI.parse.

Parses the user command line interface and create a new CommandLine containing extracting values.

Parameters
arguments:List<String>

the arguments

Returns:CommandLine

the creates command line

Annotations
@Override
parseback to summary
public CommandLine parse(List<String> arguments, boolean validate)

Implements io.vertx.core.cli.CLI.parse.

Parses the user command line interface and create a new CommandLine containing extracting values.

Parameters
arguments:List<String>

the arguments

validate:boolean

enable / disable parsing validation

Returns:CommandLine

the creates command line

Annotations
@Override
removeArgumentback to summary
public CLI removeArgument(int index)

Implements io.vertx.core.cli.CLI.removeArgument.

Doc from io.vertx.core.cli.CLI.removeArgument.

Removes an argument identified by its index. This method does nothing if the argument cannot be found.

Parameters
index:int

the argument index

Returns:CLI

the current CLI instance

Annotations
@Override
removeOptionback to summary
public CLI removeOption(String name)

Implements io.vertx.core.cli.CLI.removeOption.

Doc from io.vertx.core.cli.CLI.removeOption.

Removes an option identified by its name. This method does nothing if the option cannot be found.

Parameters
name:String

the option name

Returns:CLI

the current CLI instance

Annotations
@Override
setArgumentsback to summary
public CLI setArguments(List<Argument> args)

Implements io.vertx.core.cli.CLI.setArguments.

Doc from io.vertx.core.cli.CLI.setArguments.

Sets the list of arguments.

Parameters
args:List<Argument>

the list of arguments, must not be null

Returns:CLI

the current CLI instance

Annotations
@Override
setDescriptionback to summary
public CLI setDescription(String desc)

Implements io.vertx.core.cli.CLI.setDescription.

Annotations
@Override
setHiddenback to summary
public CLI setHidden(boolean hidden)

Implements io.vertx.core.cli.CLI.setHidden.

Doc from io.vertx.core.cli.CLI.setHidden.

Sets whether or not the current instance of CLI must be hidden. Hidden CLI are not listed when displaying usages / help messages. In other words, hidden commands are for power user.

Parameters
hidden:boolean

enables or disables the hidden aspect of the CI

Returns:CLI

the current CLI instance

Annotations
@Override
setNameback to summary
public CLI setName(String name)

Implements io.vertx.core.cli.CLI.setName.

Doc from io.vertx.core.cli.CLI.setName.

Sets the name of the CLI.

Parameters
name:String

the name

Returns:CLI

the current CLI instance

Annotations
@Override
setOptionsback to summary
public CLI setOptions(List<Option> options)

Implements io.vertx.core.cli.CLI.setOptions.

Doc from io.vertx.core.cli.CLI.setOptions.

Sets the list of arguments.

Parameters
options:List<Option>

the list of options, must not be null

Returns:CLI

the current CLI instance

Annotations
@Override
setPriorityback to summary
public CLI setPriority(int priority)

Implements io.vertx.core.cli.CLI.setPriority.

Doc from io.vertx.core.cli.CLI.setPriority.

Sets the priority of the CLI.

Parameters
priority:int

the priority

Returns:CLI

the current CLI instance

Annotations
@Override
setSummaryback to summary
public CLI setSummary(String summary)

Implements io.vertx.core.cli.CLI.setSummary.

Doc from io.vertx.core.cli.CLI.setSummary.

Sets the summary of the CLI.

Parameters
summary:String

the summary

Returns:CLI

the current CLI instance

Annotations
@Override
usageback to summary
public CLI usage(StringBuilder builder)

Implements io.vertx.core.cli.CLI.usage.

Doc from io.vertx.core.cli.CLI.usage.

Generates the usage / help of the current CLI.

Parameters
builder:StringBuilder

the string builder in which the help is going to be printed

Returns:CLI

the current CLI instance

Annotations
@Override
usageback to summary
public CLI usage(StringBuilder builder, String prefix)

Implements io.vertx.core.cli.CLI.usage.

Doc from io.vertx.core.cli.CLI.usage.

Generates the usage / help of the current CLI.

Parameters
builder:StringBuilder

the string builder in which the help is going to be printed

prefix:String

an optional prefix

Returns:CLI

the current CLI instance

Annotations
@Override