Package software.amazon.smithy.cli
Class Cli
java.lang.Object
software.amazon.smithy.cli.Cli
This class provides a basic CLI abstraction.
 
Why are we not using a library for this? Because parsing command line options isn't difficult, we don't need to take a dependency, this code uses no reflection to improve startup time. We can control exactly what CLI features are supported in case we want to migrate to a library or event a different language.
- 
Constructor Summary
ConstructorsConstructorDescriptionCli(Command command, ClassLoader classLoader) Creates a new CLI with the given name. - 
Method Summary
Modifier and TypeMethodDescriptionvoidcolorFormatter(ColorFormatter colorFormatter) intExecute the command line using the given arguments.voidstderr(CliPrinter stderrPrinter) voidstdout(CliPrinter stdoutPrinter)  
- 
Constructor Details
- 
Cli
Creates a new CLI with the given name.- Parameters:
 command- CLI command to run.classLoader- ClassLoader to use when invoking commands.
 
 - 
 - 
Method Details
- 
run
Execute the command line using the given arguments.- Parameters:
 args- Arguments to parse.- Returns:
 - Returns the exit code.
 - Throws:
 CliError- on error.
 - 
colorFormatter
 - 
stdout
 - 
stderr
 
 -