- java.lang.Object
-
- com.github.rvesse.airline.HelpOption<C>
-
public class HelpOption<C> extends java.lang.ObjectAn option that provides a simple way for the user to request help with a command
-
-
Field Summary
Fields Modifier and Type Field Description private CommandMetadatacommandMetadataprivate GlobalMetadata<C>globalMetadataprivate CommandGroupMetadatagroupMetadatajava.lang.Booleanhelpprivate booleanshown
-
Constructor Summary
Constructors Constructor Description HelpOption()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidshowHelp()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 detectedbooleanshowHelpIfRequested()Shows 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 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, ifnullthen 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, 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
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)
-
-