Class HelpOption<C>

java.lang.Object
com.github.rvesse.airline.HelpOption<C>

public class HelpOption<C> extends Object
An option that provides a simple way for the user to request help with a command
  • Field Details

  • 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 default CliCommandUsageGenerator
      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, if null 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, if null then this method does nothing
      printErrors - Whether to print error messages prior to the help, set to false 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, if null then this method does nothing
      printErrors - Whether to print error messages prior to the help, set to false if your code has already done that
      generator - Command generator for printing the help
      Returns:
      True if help was shown, false otherwise
    • showHelp

      public void showHelp()
      Shows help using the default CliCommandUsageGenerator
    • showHelp

      public void showHelp(CommandUsageGenerator generator)
      Shows help using the given usage generator
      Parameters:
      generator - Usage generator
    • toGroupNames

      private static String[] toGroupNames(CommandGroupMetadata group)