private ArgsParser addArgs()

in javascript/extractor/src/com/semmle/js/extractor/Main.java [374:452]


  private ArgsParser addArgs(ArgsParser argsParser) {
    argsParser.addDeprecatedFlag(
        P_ECMA_VERSION, 1, "Files are now always extracted as ECMAScript 2017.");
    argsParser.addFlag(
        P_EXCLUDE, 1, "Do not extract files matching the given filename pattern.", true);
    argsParser.addToleratedFlag(P_EXCLUDE_PATH, 1, true);
    argsParser.addFlag(
        P_EXPERIMENTAL,
        0,
        "Enable experimental support for pending ECMAScript proposals "
            + "(public class fields, function.sent, decorators, export extensions, function bind, "
            + "parameter-less catch, dynamic import, numeric separators, bigints, top-level await), "
            + "as well as other language extensions (E4X, JScript, Mozilla and v8-specific extensions) and full HTML extraction.");
    argsParser.addFlag(
        P_EXTERNS, 0, "Extract the given JavaScript files as Closure-style externs.");
    argsParser.addFlag(
        P_EXTRACT_PROGRAM_TEXT,
        0,
        "Extract a representation of the textual content of the program "
            + "(in addition to its syntactic structure).");
    argsParser.addFlag(
        P_FILE_TYPE,
        1,
        "Assume all files to be of the given type, regardless of extension; "
            + "the type must be one of "
            + StringUtil.glue(", ", FileExtractor.FileType.allNames)
            + ".");
    argsParser.addFlag(P_HELP, 0, "Display this help.");
    argsParser.addFlag(
        P_HTML,
        1,
        "Control extraction of HTML files: "
            + "'scripts' extracts JavaScript code embedded inside HTML, but not the HTML itself; "
            + "'elements' additionally extracts HTML elements and their attributes, as well as HTML comments, but not textual content (default); "
            + "'all' extracts elements, embedded scripts, comments and text.");
    argsParser.addFlag(
        P_INCLUDE,
        1,
        "Extract files matching the given filename pattern (in addition to HTML and JavaScript files).",
        true);
    argsParser.addDeprecatedFlag(P_JSCRIPT, 0, "Use '" + P_EXPERIMENTAL + "' instead.");
    argsParser.addDeprecatedFlag(P_MOZ_EXTENSIONS, 0, "Use '" + P_EXPERIMENTAL + "' instead.");
    argsParser.addDeprecatedFlag(P_NODEJS, 0, "Use '" + P_PLATFORM + " node' instead.");
    argsParser.addFlag(
        P_PLATFORM,
        1,
        "Extract the given JavaScript files as code for the given platform: "
            + "'node' extracts them as Node.js modules; "
            + "'web' as plain JavaScript files; "
            + "'auto' uses heuristics to automatically detect "
            + "Node.js modules and extracts everything else as plain JavaScript files. "
            + "The default is 'auto'.");
    argsParser.addFlag(P_QUIET, 0, "Produce less output.");
    argsParser.addFlag(
        P_SOURCE_TYPE,
        1,
        "The source type to use; must be one of 'script', 'module' or 'auto'. "
            + "The default is 'auto'.");
    argsParser.addToleratedFlag(P_TOLERATE_PARSE_ERRORS, 0);
    argsParser.addFlag(
        P_ABORT_ON_PARSE_ERRORS, 0, "Abort extraction if a parse error is encountered.");
    argsParser.addFlag(P_TRAP_CACHE, 1, "Use the given directory as the TRAP cache.");
    argsParser.addFlag(
        P_TRAP_CACHE_BOUND,
        1,
        "A (soft) upper limit on the size of the TRAP cache, "
            + "in standard size units (e.g., 'g' for gigabytes).");
    argsParser.addFlag(P_DEFAULT_ENCODING, 1, "The encoding to use; default is UTF-8.");
    argsParser.addFlag(P_TYPESCRIPT, 0, "Enable basic TypesScript support.");
    argsParser.addFlag(
        P_TYPESCRIPT_FULL, 0, "Enable full TypeScript support with static type information.");
    argsParser.addFlag(
        P_TYPESCRIPT_RAM,
        1,
        "Amount of memory allocated to the TypeScript compiler process. The default is 1G.");
    argsParser.addToleratedFlag(P_DEBUG_EXCLUSIONS, 0);
    argsParser.addTrailingParam("files", "Files and directories to extract.");
    return argsParser;
  }