code: private static CommandLine parseArgsAndOptions(Options options, String... args)
        throws InvalidArgumentException {
      CommandLineParser parser = new DefaultParser();
      CommandLine cmd;
  
      try {
        cmd = parser.parse(options, args);
      } catch (ParseException e) {
        throw new InvalidArgumentException(
            "Failed to parse args for validateEnv", e);
      }
      return cmd;
    }
docs: Parses the command line arguments and options in {@code args}.
  
  After successful execution of this method, command line arguments can be
  retrieved by invoking {@link CommandLine#getArgs()}, and options can be
  retrieved by calling {@link CommandLine#getOptions()}.
  
  @param args command line arguments to parse
  @return {@link CommandLine} object representing the parsing result
  @throws InvalidArgumentException if command line contains invalid argument(s)