Class HelpCommand

java.lang.Object
org.apache.sis.console.CommandRunner
org.apache.sis.console.HelpCommand

final class HelpCommand extends CommandRunner
The "help" subcommand.
Since:
0.3
Version:
0.8
  • Field Details

    • COMMANDS

      private static final String[] COMMANDS
      The commands, in the order to be shown.
  • Constructor Details

    • HelpCommand

      HelpCommand(CommandRunner parent)
      Copies the configuration of the given sub-command. This constructor is used for printing help about another command.
    • HelpCommand

      HelpCommand(int commandIndex, String... arguments) throws InvalidOptionException
      Creates the "help" sub-command.
      Parameters:
      commandIndex - index of the arguments element containing the "help" command name, or -1 if none.
      arguments - the command-line arguments provided by the user.
      Throws:
      InvalidOptionException - if an illegal option has been provided, or the option has an illegal value.
  • Method Details

    • run

      public int run() throws IOException
      Prints the help instructions.
      Specified by:
      run in class CommandRunner
      Returns:
      0 on success, or an exit code if the command failed for a reason other than a Java exception.
      Throws:
      IOException - should never happen, because we are writing to a PrintWriter.
    • help

      void help(boolean showHeader, String[] commandNames, EnumSet<Option> validOptions) throws IOException
      Implementation of run(), also shared by CommandRunner.help(String).
      Parameters:
      showHeader - true for printing the "Apache SIS" header.
      commandNames - the names of the commands to list.
      validOptions - the options to list.
      Throws:
      IOException - should never happen, because we are writing to a PrintWriter.