public interface Command
Modifier and Type | Method and Description |
---|---|
String |
getCommandName()
Gets the command name as input from the shell.
|
String |
getDescription() |
default org.apache.commons.cli.Options |
getOptions() |
default Map<String,Command> |
getSubCommands() |
String |
getUsage() |
default boolean |
hasSubCommand()
If a command has sub-commands, the first argument should be the sub-command's name,
all arguments and options will be parsed for the sub-command.
|
default org.apache.commons.cli.CommandLine |
parseAndValidateArgs(String... args)
Parses and validates the arguments.
|
default int |
run(org.apache.commons.cli.CommandLine cl)
Runs the command.
|
default void |
validateArgs(org.apache.commons.cli.CommandLine cl)
Checks if the arguments are valid or throw InvalidArgumentException.
|
String getCommandName()
default org.apache.commons.cli.Options getOptions()
Options
of the commanddefault boolean hasSubCommand()
default Map<String,Command> getSubCommands()
default org.apache.commons.cli.CommandLine parseAndValidateArgs(String... args) throws InvalidArgumentException
args
- the arguments for the command, excluding the command nameInvalidArgumentException
- when arguments are not validdefault void validateArgs(org.apache.commons.cli.CommandLine cl) throws InvalidArgumentException
cl
- the parsed command line for the argumentsInvalidArgumentException
- when arguments are not validdefault int run(org.apache.commons.cli.CommandLine cl) throws AlluxioException, IOException
cl
- the parsed command line for the argumentsAlluxioException
IOException
String getUsage()
String getDescription()
Copyright © 2023. All Rights Reserved.