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 CommandMetadata
private GlobalMetadata
<C> private CommandGroupMetadata
private boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
showHelp()
Shows help using the defaultCliCommandUsageGenerator
void
showHelp
(CommandUsageGenerator generator) Shows help using the given usage generator<T> boolean
showHelpIfErrors
(ParseResult<T> result) Shows help if any parsing errors were detected.<T> boolean
showHelpIfErrors
(ParseResult<T> result, boolean printErrors) Shows help if any parsing errors were detected<T> boolean
showHelpIfErrors
(ParseResult<T> result, boolean printErrors, CommandUsageGenerator generator) Shows help if any parsing errors were detectedboolean
Shows help if user requested it and it hasn't already been shown using the defaultCliCommandUsageGenerator
boolean
showHelpIfRequested
(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, ifnull
then 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, ifnull
then this method does nothingprintErrors
- Whether to print error messages prior to the help, set tofalse
if 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, ifnull
then this method does nothingprintErrors
- Whether to print error messages prior to the help, set tofalse
if 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
-