private static void checkShowCommandParameters()

in odps-console-dship/src/main/java/com/aliyun/odps/ship/common/OptionsBuilder.java [466:488]


  private static void checkShowCommandParameters() {

    String cmd = DshipContext.INSTANCE.get(Constants.SHOW_COMMAND);
    String number = DshipContext.INSTANCE.get("number");
    String sid = DshipContext.INSTANCE.get(Constants.SESSION_ID);

    if (!(cmd.equals("log") || cmd.equals("bad") || cmd.equals("history"))) {
      throw new IllegalArgumentException("Unknown command\nType 'tunnel help show' for usage.");
    }
    if ((cmd.equals("log") || cmd.equals("bad")) && (number != null)) {
      throw new IllegalArgumentException("Unknown command\nType 'tunnel help show' for usage.");
    }
    if (cmd.equals("history") && sid != null) {
      throw new IllegalArgumentException("Unknown command\nType 'tunnel help show' for usage.");
    }
    if (number != null) {
      try {
        Integer.valueOf(number);
      } catch (NumberFormatException e) {
        throw new IllegalArgumentException("Illegal number\nType 'tunnel help show' for usage.");
      }
    }
  }