yargs-factory.ts ×28

Frontier kind: Code frontier

unlabeled · c_6e516dbb9300

262 tests · 1977 LOC · 18 files · introduces 0 tests · 76 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
28 ranges76 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
370 ranges1977 lines · 18 files · Browse complete extent
All tests (intent)
262 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: 76 introduced LOC across 28 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

lib/yargs-factory.ts 76 introduced LOC · 28 ranges

Open complete file

925 }
926 option(
927 > key: string | Dictionary<OptionDefinition>, yargs-factory.ts
928 > opt?: OptionDefinition
929 > ): YargsInstance {
930 > argsert('<string|object> [object]', [key, opt], arguments.length);
931 > if (typeof key === 'object') {
932 Object.keys(key).forEach(k => {
933 this.options(k, key[k]);
934 });
935 > } else { yargs-factory.ts
936 > if (typeof opt !== 'object') {
937 opt = {};
938 }
940 > this[kTrackManuallySetKeys](key);
941 >
942 > // Warn about version name collision
943 > // Addresses: https://github.com/yargs/yargs/issues/1979
944 > if (this.#versionOpt && (key === 'version' || opt?.alias === 'version')) {
945 this[kEmitWarning](
946 [
956 );
957 }
959 > this.#options.key[key] = true; // track manually set keys.
960 >
961 > if (opt.alias) this.alias(key, opt.alias);
962 >
963 > const deprecate = opt.deprecate || opt.deprecated;
964 >
965 > if (deprecate) {
966 this.deprecateOption(key, deprecate);
967 }
969 > const demand = opt.demand || opt.required || opt.require;
970 >
971 > // A required option can be specified via "demand: true".
972 > if (demand) {
973 this.demand(key, demand);
974 }
976 > if (opt.demandOption) {
977 this.demandOption(
978 key,
980 );
981 }
983 > if (opt.conflicts) {
984 this.conflicts(key, opt.conflicts);
985 }
987 > if ('default' in opt) {
988 this.default(key, opt.default);
989 }
991 > if (opt.implies !== undefined) {
992 this.implies(key, opt.implies);
993 }
995 > if (opt.nargs !== undefined) {
996 this.nargs(key, opt.nargs);
997 }
999 > if (opt.config) {
1000 this.config(key, opt.configParser);
1001 }
1003 > if (opt.normalize) {
1004 this.normalize(key);
1005 }
1007 > if (opt.choices) {
1008 this.choices(key, opt.choices);
1009 }
1011 > if (opt.coerce) {
1012 this.coerce(key, opt.coerce);
1013 }
1015 > if (opt.group) {
1016 this.group(key, opt.group);
1017 }
1019 > if (opt.boolean || opt.type === 'boolean') {
1020 this.boolean(key);
1021 if (opt.alias) this.boolean(opt.alias);
1022 }
1024 > if (opt.array || opt.type === 'array') {
1025 this.array(key);
1026 if (opt.alias) this.array(opt.alias);
1027 }
1029 > if (opt.number || opt.type === 'number') {
1030 this.number(key);
1031 if (opt.alias) this.number(opt.alias);
1032 }
1034 > if (opt.string || opt.type === 'string') {
1035 this.string(key);
1036 if (opt.alias) this.string(opt.alias);
1037 }
1039 > if (opt.count || opt.type === 'count') {
1040 this.count(key);
1041 }
1043 > if (typeof opt.global === 'boolean') {
1044 this.global(key, opt.global);
1045 }
1047 > if (opt.defaultDescription) {
1048 this.#options.defaultDescription[key] = opt.defaultDescription;
1049 }
1051 > if (opt.skipValidation) {
1052 this.skipValidation(key);
1053 }
1055 > const desc = opt.describe || opt.description || opt.desc;
1056 > const descriptions = this.#usage.getDescriptions();
1057 > if (
1058 > !Object.prototype.hasOwnProperty.call(descriptions, key) ||
1059 typeof desc === 'string'
1060 > ) { yargs-factory.ts
1061 this.describe(key, desc);
1062 }
1064 > if (opt.hidden) {
1065 this.hide(key);
1066 }
1068 > if (opt.requiresArg) {
1069 this.requiresArg(key);
1070 }
1071 > } yargs-factory.ts
1072 >
1073 > return this;
1074 > }
1075 options(
1076 key: string | Dictionary<OptionDefinition>,