yargs-factory.ts ×5

Frontier kind: Code frontier

unlabeled · c_4b8444eae977

692 tests · 2060 LOC · 18 files · introduces 0 tests · 66 LOC · 4 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges66 lines · 4 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
365 ranges2060 lines · 18 files · Browse complete extent
All tests (intent)
692 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

4 files ranked by introduced lines: 66 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

lib/yargs-factory.ts 54 introduced LOC · 5 ranges

Open complete file

1080 }
1081 parse(
1082 > args?: string | string[], yargs-factory.ts
1083 > shortCircuit?: object | ParseCallback | boolean,
1084 > _parseFn?: ParseCallback
1085 > ): Arguments | Promise<Arguments> {
1086 > argsert(
1087 > '[string|array] [function|boolean|object] [function]',
1088 > [args, shortCircuit, _parseFn],
1089 > arguments.length
1090 > );
1091 > this[kFreeze](); // Push current state of parser onto stack.
1092 > if (typeof args === 'undefined') {
1093 args = this.#processArgs;
1094 }
1096 > // a context object can optionally be provided, this allows
1097 > // additional information to be passed to a command handler.
1098 > if (typeof shortCircuit === 'object') {
1099 this.#parseContext = shortCircuit;
1100 shortCircuit = _parseFn;
1101 }
1103 > // by providing a function as a second argument to
1104 > // parse you can capture output that would otherwise
1105 > // default to printing to stdout/stderr.
1106 > if (typeof shortCircuit === 'function') {
1107 this.#parseFn = shortCircuit as ParseCallback;
1108 shortCircuit = false;
1109 }
1110 > // completion short-circuits the parsing process, yargs-factory.ts
1111 > // skipping validation, etc.
1112 > if (!shortCircuit) this.#processArgs = args;
1113 >
1114 > if (this.#parseFn) this.#exitProcess = false;
1115 >
1116 > const parsed = this[kRunYargsParserAndExecuteCommands](
1117 > args,
1118 > !!shortCircuit
1119 > );
1120 > const tmpParsed = this.parsed;
1121 > this.#completion!.setParsed(this.parsed as DetailedArguments);
1122 > if (isPromise(parsed)) {
1123 return parsed
1124 .then(argv => {
1527 }
1528 [kFreeze]() {
1529 > this.#frozens.push({ yargs-factory.ts
1530 > options: this.#options,
1531 > configObjects: this.#options.configObjects.slice(0),
1532 > exitProcess: this.#exitProcess,
1533 > groups: this.#groups,
1534 > strict: this.#strict,
1535 > strictCommands: this.#strictCommands,
1536 > strictOptions: this.#strictOptions,
1537 > completionCommand: this.#completionCommand,
1538 > output: this.#output,
1539 > exitError: this.#exitError!,
1540 > hasOutput: this.#hasOutput,
1541 > parsed: this.parsed,
1542 > parseFn: this.#parseFn!,
1543 > parseContext: this.#parseContext,
1544 > });
1545 > this.#usage.freeze();
1546 > this.#validation.freeze();
1547 > this.#command.freeze();
1548 > this.#globalMiddleware.freeze();
1549 > }
1550 [kGetDollarZero](): string {
1551 let $0 = '';
lib/command.ts 6 introduced LOC · 1 range

Open complete file

757 // Push/pop the current command configuration:
758 freeze() {
759 > this.frozens.push({ command.ts
760 > handlers: this.handlers,
761 > aliasMap: this.aliasMap,
762 > defaultCommand: this.defaultCommand,
763 > });
764 > }
765 unfreeze() {
766 const frozen = this.frozens.pop();
lib/validation.ts 4 introduced LOC · 1 range

Open complete file

460 const frozens: FrozenValidationInstance[] = [];
461 self.freeze = function freeze() {
462 > frozens.push({ validation.ts
463 > implied,
464 > conflicting,
465 > });
466 };
467 self.unfreeze = function unfreeze() {
lib/middleware.ts 2 introduced LOC · 1 range

Open complete file

62 }
63 freeze() {
64 > this.frozens.push([...this.globalMiddleware]); middleware.ts
65 > }
66 unfreeze() {
67 const frozen = this.frozens.pop();