- java.lang.Object
-
- com.github.rvesse.airline.HelpOption<C>
-
public class HelpOption<C> extends java.lang.Object
An option that provides a simple way for the user to request help with a command
-
-
Field Summary
Fields Modifier and Type Field Description private CommandMetadata
commandMetadata
private GlobalMetadata<C>
globalMetadata
private CommandGroupMetadata
groupMetadata
java.lang.Boolean
help
private boolean
shown
-
Constructor Summary
Constructors Constructor Description HelpOption()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
showHelpIfRequested()
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 java.lang.String[]
toGroupNames(CommandGroupMetadata group)
-
-
-
Field Detail
-
globalMetadata
@AirlineModule private GlobalMetadata<C> globalMetadata
-
groupMetadata
@AirlineModule private CommandGroupMetadata groupMetadata
-
commandMetadata
@AirlineModule private CommandMetadata commandMetadata
-
help
@Option(name={"-h","--help"}, description="Display help information") public java.lang.Boolean help
-
shown
private boolean shown
-
-
Method Detail
-
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
public boolean showHelpIfRequested(CommandUsageGenerator generator)
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
public <T> boolean showHelpIfErrors(ParseResult<T> result)
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
public <T> boolean showHelpIfErrors(ParseResult<T> result, boolean printErrors)
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
public void showHelp(CommandUsageGenerator generator)
Shows help using the given usage generator- Parameters:
generator
- Usage generator
-
toGroupNames
private static java.lang.String[] toGroupNames(CommandGroupMetadata group)
-
-