Class HelpOption<C>
java.lang.Object
com.github.rvesse.airline.HelpOption<C>
An option that provides a simple way for the user to request help with a
command
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate CommandMetadataprivate GlobalMetadata<C> private CommandGroupMetadataprivate boolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidshowHelp()Shows help using the defaultCliCommandUsageGeneratorvoidshowHelp(CommandUsageGenerator generator) Shows help using the given usage generator<T> booleanshowHelpIfErrors(ParseResult<T> result) Shows help if any parsing errors were detected.<T> booleanshowHelpIfErrors(ParseResult<T> result, boolean printErrors) Shows help if any parsing errors were detected<T> booleanshowHelpIfErrors(ParseResult<T> result, boolean printErrors, CommandUsageGenerator generator) Shows help if any parsing errors were detectedbooleanShows help if user requested it and it hasn't already been shown using the defaultCliCommandUsageGeneratorbooleanshowHelpIfRequested(CommandUsageGenerator generator) Shows help if user requested it, and it hasn't already been shownprivate static String[]toGroupNames(CommandGroupMetadata group)
-
Field Details
-
globalMetadata
-
groupMetadata
-
commandMetadata
-
help
-
shown
private boolean shown
-
-
Constructor Details
-
HelpOption
public HelpOption()
-
-
Method Details
-
showHelpIfRequested
public boolean showHelpIfRequested()Shows help if user requested it and it hasn't already been shown using the defaultCliCommandUsageGenerator- Returns:
- True if help was requested by the user
-
showHelpIfRequested
Shows help if user requested it, and it hasn't already been shown- Parameters:
generator- Usage generator- Returns:
- True if help was requested by the user
-
showHelpIfErrors
Shows help if any parsing errors were detected. If errors were detected the error messages are printed prior to the help- Type Parameters:
T- Command type we were attempting to parse- Parameters:
result- Parsing result, ifnullthen this method does nothing- Returns:
- True if help was shown
-
showHelpIfErrors
Shows help if any parsing errors were detected- Type Parameters:
T- Command type we were attempting to parse- Parameters:
result- Parsing result, ifnullthen this method does nothingprintErrors- Whether to print error messages prior to the help, set tofalseif your code has already done that- Returns:
- True if help was shown
-
showHelpIfErrors
public <T> boolean showHelpIfErrors(ParseResult<T> result, boolean printErrors, CommandUsageGenerator generator) Shows help if any parsing errors were detected- Type Parameters:
T- Command type we were attempting to parse- Parameters:
result- Parsing result, ifnullthen this method does nothingprintErrors- Whether to print error messages prior to the help, set tofalseif your code has already done thatgenerator- Command generator for printing the help- Returns:
- True if help was shown, false otherwise
-
showHelp
public void showHelp()Shows help using the defaultCliCommandUsageGenerator -
showHelp
Shows help using the given usage generator- Parameters:
generator- Usage generator
-
toGroupNames
-