/**
   * {@inheritDoc}
   *
   * @see schemacrawler.tools.commandline.CommandLine#execute()
   */
  @Override
  public void execute() throws SchemaCrawlerException {
    final CommandRegistry commandRegistry = new CommandRegistry();
    if (command != null && !commandRegistry.hasCommand(command)) {
      throw new SchemaCrawlerException("Unknown command, " + command);
    }

    System.out.println(helpOptions.getTitle());
    showHelp("/help/SchemaCrawler.txt");
    System.out.println();

    showHelp(helpOptions.getResourceConnections());
    showHelp("/help/SchemaCrawlerOptions.txt");
    if (!hideConfig) {
      showHelp("/help/Config.txt");
    }
    showHelp("/help/ApplicationOptions.txt");
    if (command == null) {
      showHelp("/help/Command.txt");
      System.out.println("  Available commands are: ");
      final String[] availableCommands = commandRegistry.lookupAvailableCommands();
      for (final String availableCommand : availableCommands) {
        System.out.println("  " + availableCommand);
      }
    } else {
      final String helpResource = commandRegistry.getHelpResource(command);
      showHelp(helpResource);
    }

    System.exit(0);
  }
  /**
   * {@inheritDoc}
   *
   * @see schemacrawler.tools.commandline.CommandLine#execute()
   */
  @Override
  public void execute() throws SchemaCrawlerException {
    System.out.println(helpOptions.getTitle());
    showHelp("/help/SchemaCrawler.txt");
    System.out.println();

    showHelp(helpOptions.getResourceConnections());
    showHelp("/help/SchemaCrawlerOptions.txt");
    if (!hideConfig) {
      showHelp("/help/Config.txt");
    }
    showHelp("/help/ApplicationOptions.txt");
    final CommandRegistry commandRegistry = new CommandRegistry();
    if (command == null) {
      showHelp("/help/Command.txt");
      System.out.println("  Available commands are: ");
      final String[] availableCommands = commandRegistry.lookupAvailableCommands();
      for (final String availableCommand : availableCommands) {
        System.out.println("  " + availableCommand);
      }
    } else {
      final String commandExecutableClassName =
          commandRegistry.lookupCommandExecutableClassName(command);
      final String helpResource =
          "/help/"
              + commandExecutableClassName.substring(
                  commandExecutableClassName.lastIndexOf('.') + 1)
              + ".txt";
      showHelp(helpResource);
    }

    System.exit(0);
  }