Package software.amazon.smithy.cli
Interface Command
-
- All Known Implementing Classes:
AstCommand
,BuildCommand
,DiffCommand
,SelectCommand
,SmithyCommand
,Upgrade1to2Command
,ValidateCommand
public interface Command
Represents a CLI command.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
Command.Env
Environment settings for the command.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description int
execute(Arguments arguments, Command.Env env)
Executes the command using the provided arguments.default java.lang.String
getDocumentation(CliPrinter printer)
Gets the long description of the command.java.lang.String
getName()
Gets the name of the command.java.lang.String
getSummary()
Gets a short summary of the command that's shown in the main help.void
printHelp(Arguments arguments, CliPrinter printer)
Prints help output.
-
-
-
Method Detail
-
getName
java.lang.String getName()
Gets the name of the command.The returned name should contain no spaces or special characters.
- Returns:
- Returns the command name.
-
getSummary
java.lang.String getSummary()
Gets a short summary of the command that's shown in the main help.- Returns:
- Returns the short help description.
-
getDocumentation
default java.lang.String getDocumentation(CliPrinter printer)
Gets the long description of the command.- Parameters:
printer
- CliPrinter used in case formatting is needed viaCliPrinter.style(String, Style...)
.- Returns:
- Returns the long description.
-
printHelp
void printHelp(Arguments arguments, CliPrinter printer)
Prints help output.- Parameters:
arguments
- Arguments that have been parsed so far.printer
- Where to write help.
-
execute
int execute(Arguments arguments, Command.Env env)
Executes the command using the provided arguments.- Parameters:
arguments
- CLI arguments.env
- CLI environment settings like stdout, stderr, etc.- Returns:
- Returns the exit code.
-
-