public static void main(String[] args) throws Exception
  {
    try
    {
      final CommandLineParser parser = new GnuParser();
      CommandLine cl = parser.parse(OPTIONS, args);

      if (cl.hasOption('h'))
      {
        help();
        System.exit(0);
      }

      String sourceFormat = cl.getOptionValue('s', SchemaParser.FILETYPE).trim();
      String destFormat = cl.getOptionValue('d', PdlSchemaParser.FILETYPE).trim();
      boolean keepOriginal = cl.hasOption('o');
      String preserveSourceCmd = cl.getOptionValue('p');
      boolean skipVerification = cl.hasOption('k');
      boolean forcePdscFullyQualifiedNames = cl.hasOption('q');

      String[] cliArgs = cl.getArgs();
      if (cliArgs.length != 3)
      {
        LOGGER.error("Missing arguments, expected 3 ([resolverPath] [sourceRoot] [destinationPath]), got "
            + cliArgs.length);
        help();
        System.exit(1);
      }
      int i = 0;
      String resolverPaths = RestLiToolsUtils.readArgFromFileIfNeeded(cliArgs[i++]);
      String sourcePath = cliArgs[i++];
      String destPath = cliArgs[i++];

      File sourceDir = new File(sourcePath);
      File destDir = new File(destPath);
      if (!sourceDir.exists() || !sourceDir.canRead())
      {
        LOGGER.error("Source directory does not exist or cannot be read: " + sourceDir.getAbsolutePath());
        System.exit(1);
      }
      destDir.mkdirs();
      if (!destDir.exists() || !destDir.canWrite())
      {
        LOGGER.error("Destination directory does not exist or cannot be written to: " + destDir.getAbsolutePath());
        System.exit(1);
      }

      SchemaFormatTranslator translator = new SchemaFormatTranslator(
          resolverPaths,
          sourceDir,
          destDir,
          sourceFormat,
          destFormat,
          keepOriginal,
          preserveSourceCmd,
          skipVerification,
          forcePdscFullyQualifiedNames);

      translator.translateFiles();
    }
    catch (ParseException e)
    {
      LOGGER.error("Invalid arguments: " + e.getMessage());
      help();
      System.exit(1);
    }
  }
@Test(dataProvider = "fullClassName")
  public void testTranslatorWorksWithArgFile(String packageName, String className) throws Exception
  {
    File tempDir = Files.createTempDirectory("restli").toFile();
    File argFile = new File(tempDir, "resolverPath");
    Files.write(argFile.toPath(), Collections.singletonList(RESOLVER_DIR));
    SchemaFormatTranslator.main(
        new String[]{"-o", String.format("@%s", argFile.toPath()), SOURCE_ROOT, tempDir.getAbsolutePath()});
    MultiFormatDataSchemaResolver sourceResolver = MultiFormatDataSchemaResolver.withBuiltinFormats(RESOLVER_DIR);
    MultiFormatDataSchemaResolver translatedResolver =
        MultiFormatDataSchemaResolver.withBuiltinFormats(tempDir.getAbsolutePath() + File.pathSeparator + EXTERNAL_RESOURCES);
    assertSameSchemas(packageName + "." + className, sourceResolver, translatedResolver);
  }