private int parseAndRun(String[] args) throws IOException {

    // Check if backup is enabled
    if (!BackupManager.isBackupEnabled(getConf())) {
      System.err.println(BackupRestoreConstants.ENABLE_BACKUP);
      return -1;
    }

    String cmd = null;
    String[] remainArgs = null;
    if (args == null || args.length == 0) {
      printToolUsage();
      return -1;
    } else {
      cmd = args[0];
      remainArgs = new String[args.length - 1];
      if (args.length > 1) {
        System.arraycopy(args, 1, remainArgs, 0, args.length - 1);
      }
    }

    BackupCommand type = BackupCommand.HELP;
    if (BackupCommand.CREATE.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.CREATE;
    } else if (BackupCommand.HELP.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.HELP;
    } else if (BackupCommand.DELETE.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.DELETE;
    } else if (BackupCommand.DESCRIBE.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.DESCRIBE;
    } else if (BackupCommand.HISTORY.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.HISTORY;
    } else if (BackupCommand.PROGRESS.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.PROGRESS;
    } else if (BackupCommand.SET.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.SET;
    } else if (BackupCommand.REPAIR.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.REPAIR;
    } else if (BackupCommand.MERGE.name().equalsIgnoreCase(cmd)) {
      type = BackupCommand.MERGE;
    } else {
      System.out.println("Unsupported command for backup: " + cmd);
      printToolUsage();
      return -1;
    }

    // enable debug logging
    if (this.cmd.hasOption(OPTION_DEBUG)) {
      Log4jUtils.setLogLevel("org.apache.hadoop.hbase.backup", "DEBUG");
    }

    BackupCommands.Command command = BackupCommands.createCommand(getConf(), type, this.cmd);
    if (type == BackupCommand.CREATE && conf != null) {
      ((BackupCommands.CreateCommand) command).setConf(conf);
    }
    try {
      command.execute();
    } catch (IOException e) {
      if (e.getMessage().equals(BackupCommands.INCORRECT_USAGE)) {
        return -1;
      }
      throw e;
    } finally {
      command.finish();
    }
    return 0;
  }
Command-line entry point for backup operation
hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/BackupDriver.java