private boolean doCommandLine(final String[] args) {
    if (args.length < 1) {
      printUsage(null);
      return false;
    }
    for (int i = 0; i < args.length; i++) {
      String cmd = args[i];
      if (cmd.equals("-h") || cmd.startsWith("--h")) {
        printUsage(null);
        return false;
      }

      final String startRowArgKey = "--startrow=";
      if (cmd.startsWith(startRowArgKey)) {
        startRow = cmd.substring(startRowArgKey.length());
        continue;
      }

      final String stopRowArgKey = "--stoprow=";
      if (cmd.startsWith(stopRowArgKey)) {
        stopRow = cmd.substring(stopRowArgKey.length());
        continue;
      }

      final String startTimeArgKey = "--starttime=";
      if (cmd.startsWith(startTimeArgKey)) {
        startTime = Long.parseLong(cmd.substring(startTimeArgKey.length()));
        continue;
      }

      final String endTimeArgKey = "--endtime=";
      if (cmd.startsWith(endTimeArgKey)) {
        endTime = Long.parseLong(cmd.substring(endTimeArgKey.length()));
        continue;
      }

      final String batchArgKey = "--batch=";
      if (cmd.startsWith(batchArgKey)) {
        batch = Integer.parseInt(cmd.substring(batchArgKey.length()));
        continue;
      }

      final String cacheRowArgKey = "--cacheRow=";
      if (cmd.startsWith(cacheRowArgKey)) {
        cacheRow = Integer.parseInt(cmd.substring(cacheRowArgKey.length()));
        continue;
      }

      final String versionsArgKey = "--versions=";
      if (cmd.startsWith(versionsArgKey)) {
        versions = Integer.parseInt(cmd.substring(versionsArgKey.length()));
        continue;
      }

      final String newNameArgKey = "--new.name=";
      if (cmd.startsWith(newNameArgKey)) {
        dstTableName = cmd.substring(newNameArgKey.length());
        continue;
      }

      final String peerUriArgKey = "--peer.uri=";
      if (cmd.startsWith(peerUriArgKey)) {
        try {
          peerUri = new URI(cmd.substring(peerUriArgKey.length()));
        } catch (URISyntaxException e) {
          LOG.error("Malformed peer uri specified: {}", cmd, e);
          return false;
        }
        continue;
      }

      final String peerAdrArgKey = "--peer.adr=";
      if (cmd.startsWith(peerAdrArgKey)) {
        peerAddress = cmd.substring(peerAdrArgKey.length());
        continue;
      }

      final String familiesArgKey = "--families=";
      if (cmd.startsWith(familiesArgKey)) {
        families = cmd.substring(familiesArgKey.length());
        continue;
      }

      if (cmd.startsWith("--all.cells")) {
        allCells = true;
        continue;
      }

      if (cmd.startsWith("--bulkload")) {
        bulkload = true;
        continue;
      }

      if (cmd.startsWith("--shuffle")) {
        shuffle = true;
        continue;
      }

      if (cmd.startsWith("--snapshot")) {
        readingSnapshot = true;
        continue;
      }

      if (i == args.length - 1) {
        if (readingSnapshot) {
          snapshot = cmd;
        } else {
          tableName = cmd;
        }
      } else {
        printUsage("Invalid argument '" + cmd + "'");
        return false;
      }
    }
    if (dstTableName == null && peerAddress == null) {
      printUsage("At least a new table name or a peer address must be specified");
      return false;
    }
    if ((endTime != 0) && (startTime > endTime)) {
      printUsage("Invalid time range filter: starttime=" + startTime + " >  endtime=" + endTime);
      return false;
    }

    if (bulkload && (peerUri != null || peerAddress != null)) {
      printUsage("Remote bulkload is not supported!");
      return false;
    }

    if (readingSnapshot && (peerUri != null || peerAddress != null)) {
      printUsage("Loading data from snapshot to remote peer cluster is not supported.");
      return false;
    }

    if (readingSnapshot && dstTableName == null) {
      printUsage("The --new.name=<table> for destination table should be "
        + "provided when copying data from snapshot .");
      return false;
    }

    if (readingSnapshot && snapshot == null) {
      printUsage("Snapshot shouldn't be null when --snapshot is enabled.");
      return false;
    }

    // set dstTableName if necessary
    if (dstTableName == null) {
      dstTableName = tableName;
    }
    return true;
  }
Sets up the actual job.
@param args The command line parameters.
@return The newly created job.
@throws IOException When setting up the job fails.
hbase-mapreduce/src/main/java/org/apache/hadoop/hbase/mapreduce/CopyTable.java