Package software.amazon.smithy.cli
Class HelpPrinter
java.lang.Object
software.amazon.smithy.cli.HelpPrinter
Generates and prints structured help output to a
CliPrinter.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondocumentation(String documentation) Defines the optional long-form documentation that comes after long argument descriptions.static HelpPrinterfromArguments(String name, Arguments arguments) Create a HelpPrinter that registers help options and parameters defined in the givenarguments.maxWidth(int maxWidth) Adds an option that takes no argument value.Adds a parameter that requires an argument value.positional(String name, String description) Defines a positional argument.voidprint(CliPrinter printer) Prints the generated help to the given printer.Defines the summary text of the command that comes after the short argument description and before the long argument descriptions.
-
Constructor Details
-
HelpPrinter
-
-
Method Details
-
maxWidth
-
fromArguments
Create a HelpPrinter that registers help options and parameters defined in the givenarguments.- Parameters:
name- Name of the command.arguments- Arguments to extract params from.- Returns:
- Returns the created HelpPrinter.
-
summary
Defines the summary text of the command that comes after the short argument description and before the long argument descriptions.- Parameters:
summary- Summary text to display.- Returns:
- Returns the printer.
-
documentation
Defines the optional long-form documentation that comes after long argument descriptions.- Parameters:
documentation- Documentation to display.- Returns:
- Returns the printer.
-
option
Adds an option that takes no argument value.- Parameters:
longName- Nullable argument long form (e.g., "--foo").shortName- Nullable argument short form (e.g., null).description- Description description of the argument.- Returns:
- Returns the printer.
-
param
public HelpPrinter param(String longName, String shortName, String exampleValue, String description) Adds a parameter that requires an argument value.- Parameters:
longName- Nullable argument long form (e.g., "--foo").shortName- Nullable argument short form (e.g., null).exampleValue- Example value of the parameter (e.g., "FOO").description- Description description of the argument.- Returns:
- Returns the printer.
-
positional
Defines a positional argument.- Parameters:
name- Name of the positional argument (e.g.,<MODEL...>)description- Description of the argument.- Returns:
- Returns the printer.
-
print
Prints the generated help to the given printer.- Parameters:
printer- CliPrinter to write to.
-