command.ts ×8

Frontier kind: Code frontier

unlabeled · c_c4208f5c0fed

102 tests · 2671 LOC · 18 files · introduces 0 tests · 39 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges39 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
495 ranges2671 lines · 18 files · Browse complete extent
All tests (intent)
102 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.

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

lib/command.ts 39 introduced LOC · 8 ranges

Open complete file

673 .fail(parsed.error.message, parsed.error);
674 } else {
675 > // only copy over positional keys (don't overwrite command.ts
676 > // flag arguments that were already parsed).
677 > const positionalKeys = Object.keys(positionalMap);
678 > Object.keys(positionalMap).forEach(key => {
679 > positionalKeys.push(...parsed.aliases[key]);
680 > });
681 >
682 > Object.keys(parsed.argv).forEach(key => {
683 > if (positionalKeys.includes(key)) {
684 > // any new aliases need to be placed in positionalMap, which
685 > // is used for validation.
686 > if (!positionalMap[key]) positionalMap[key] = parsed.argv[key];
687 > // Addresses: https://github.com/yargs/yargs/issues/1637
688 > // If both positionals/options provided,
689 > // and no default or config values were set for that key,
690 > // and if at least one is an array: don't overwrite, combine.
691 > if (
692 > !this.isInConfigs(yargs, key) &&
693 > !this.isDefaulted(yargs, key) &&
694 > Object.prototype.hasOwnProperty.call(argv, key) &&
695 > Object.prototype.hasOwnProperty.call(parsed.argv, key) &&
696 (Array.isArray(argv[key]) || Array.isArray(parsed.argv[key]))
697 > ) { command.ts
698 argv[key] = ([] as string[]).concat(argv[key], parsed.argv[key]);
699 > } else { command.ts
700 argv[key] = parsed.argv[key];
701 }
702 > } command.ts
703 > });
704 > }
705 }
706 // Check defaults for key (and camel case version of key)
707 isDefaulted(yargs: YargsInstance, key: string): boolean {
708 > const {default: defaults} = yargs.getOptions(); command.ts
709 > return (
710 > Object.prototype.hasOwnProperty.call(defaults, key) ||
711 Object.prototype.hasOwnProperty.call(
712 defaults,
713 this.shim.Parser.camelCase(key)
714 > ) command.ts
715 > );
716 > }
717 // Check each config for key (and camel case version of key)
718 isInConfigs(yargs: YargsInstance, key: string): boolean {
719 > const {configObjects} = yargs.getOptions(); command.ts
720 > return (
721 > configObjects.some(c => Object.prototype.hasOwnProperty.call(c, key)) ||
722 > configObjects.some(c =>
723 Object.prototype.hasOwnProperty.call(c, this.shim.Parser.camelCase(key))
724 > ) command.ts
725 > );
726 > }
727 runDefaultBuilderOn(yargs: YargsInstance): unknown | Promise<unknown> {
728 if (!this.defaultCommand) return;