command.ts ×4

Frontier kind: Code frontier

unlabeled · c_ae5c44500d02

13 tests · 2642 LOC · 18 files · introduces 0 tests · 46 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges46 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
488 ranges2642 lines · 18 files · Browse complete extent
All tests (intent)
13 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.

2 files ranked by introduced lines: 46 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

lib/command.ts 41 introduced LOC · 4 ranges

Open complete file

55 }
56 addDirectory(
57 > dir: string, command.ts
58 > req: Function,
59 > callerFile: string,
60 > opts?: RequireDirectoryOptions
61 > ): void {
62 > opts = opts || {};
63 > this.requireCache.add(callerFile);
64 > const fullDirPath = this.shim.path.resolve(
65 > this.shim.path.dirname(callerFile),
66 > dir
67 > );
68 > const files = this.shim.readdirSync(fullDirPath, {
69 > recursive: opts.recurse ? true : false,
70 > });
71 > // exclude 'json', 'coffee' from require-directory defaults
72 > if (!Array.isArray(opts.extensions)) opts.extensions = ['js'];
73 > // allow consumer to define their own visitor function
74 > const visit = typeof opts.visit === 'function' ? opts.visit : (o: any) => o;
75 > for (const fileb of files) {
76 > const file = fileb.toString();
77 >
78 > // Support include / exclude logic from require-directory.
79 > if (opts.exclude) {
80 let exclude = false;
81 if (typeof opts.exclude === 'function') {
86 if (exclude) continue;
87 }
88 > if (opts.include) { command.ts
89 let include = false;
90 if (typeof opts.include === 'function') {
95 if (!include) continue;
96 }
97 > command.ts
98 > let supportedExtension = false;
99 > for (const ext of opts.extensions) {
100 > if (file.endsWith(ext)) supportedExtension = true;
101 > }
102 > if (supportedExtension) {
103 > const joined = this.shim.path.join(fullDirPath, file);
104 > const module = req(joined);
105 > const extendableModule = Object.create(
106 > null,
107 > Object.getOwnPropertyDescriptors({...module})
108 > );
109 > const visited = visit(extendableModule, joined, file);
110 > if (visited) {
111 if (this.requireCache.has(joined)) continue;
112 else this.requireCache.add(joined);
120 this.addHandler(extendableModule);
121 }
122 > } command.ts
123 > }
124 > }
125 addHandler(
126 cmd: string | CommandHandlerDefinition | DefinitionOrCommandName[],
lib/yargs-factory.ts 5 introduced LOC · 1 range

Open complete file

552 }
553 commandDir(dir: string, opts?: RequireDirectoryOptions): YargsInstance {
554 > argsert('<string> [object]', [dir, opts], arguments.length); yargs-factory.ts
555 > const req = this.#parentRequire || this.#shim.require;
556 > this.#command.addDirectory(dir, req, this.#shim.getCallerFile(), opts);
557 > return this;
558 > }
559 count(keys: string | string[]): YargsInstance {
560 argsert('<array|string>', [keys], arguments.length);