usage.ts ×19
Frontier kind: Code frontier
unlabeled · c_7861ea091a3e
417 tests · 2190 LOC · 18 files · introduces 0 tests · 125 LOC · 2 files
Introduces — evidence that enters the hierarchy at this concept
- Code
- 20 ranges125 lines · 2 files
- Tests
- 0 tests
Contains — complete concept membership
- All code (extent)
- 398 ranges2190 lines · 18 files · Browse complete extent
- All tests (intent)
- 417 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.
- Focus concept
- Ancestors (broader)
- Descendants (narrower)
- Introduced files
- Introduced tests
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.
- usage.ts ×19 — Focused concept Introduced files:
- yargs.mjs|title=yargs dsl tests positional allows an implied argument to be specified|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests positional allows a choices array to be specified|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse commands preserves top-level config when parse is called multiple times|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests positional allows a conflicting argument to be specified|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests parse can be called multiple times with the same behavior|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command async builder allows positionals to be configured asynchronously|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command positional arguments does not overwrite options in argv if variadic|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- yargs.mjs|title=yargs dsl tests command accepts a module with a keys 'command', 'describe', 'builder', and 'handler'|occurrence=1 — Ancestor (broader) Introduced tests:
-
yargs.mjs|title=yargs dsl tests positional allows a default to be set|occurrence=1, yargs.mjs|title=yargs dsl tests positional defaults array with no arguments to []|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/yargs.mjs|title=yargs dsl tests positional allows a default to be set|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/yargs.mjs|title=yargs dsl tests positional defaults array with no arguments to []|occurrence=1
- yargs.mjs|title=yargs dsl tests positional allows a number type to be specified|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command help command displays command help appropriately|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests usage for default command positional should contain the expected output for showHelp|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests positional allows a boolean type to be specified|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command global parsing hints strict does not fire command if validation fails|occurrence=1 — Ancestor (broader) Introduced tests:
- string|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command async displays error and appropriate help message when handler fails|occurrence=1 — Ancestor (broader) Introduced tests:
- validation.mjs|title=validation tests demand should recognize context variables in strict mode, when running sub-commands|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- yargs.mjs|title=yargs dsl tests async argv caches nested help output, so that it can be output by showHelp()|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests async argv returns promise that can be caught if rejected|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command async returns promise that can be caught, when fail(false)|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests when exitProcess is false fail() is invoked with yargs instance as third argument|occurrence=1 — Ancestor (broader) Introduced tests:
-
validation.mjs|title=validation tests choices succeeds when demandOption is false and no choice is provided|occurrence=1, validation.mjs|title=validation tests choices succeeds when demandOption is not provided and no choice is provided|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/validation.mjs|title=validation tests choices succeeds when demandOption is false and no choice is provided|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/validation.mjs|title=validation tests choices succeeds when demandOption is not provided and no choice is provided|occurrence=1
- validation.mjs|title=validation tests conflicts should not fail if conflicting argument is provided, without argument with conflict|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command should allow positional arguments for inner commands in strict mode, when no handler is provided|occurrence=1 — Ancestor (broader) Introduced tests:
- validation.mjs|title=validation tests demand should recognize context variables in strict mode|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command global parsing hints strict does not fail strict check due to positional command arguments|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command global parsing hints validation allows each builder to specify own middleware|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command variadic allows camel-case, variadic arguments, and strict mode to be combined|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests bug #1758 does not drop .0 if flag is configured as string|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- usage.mjs|title=usage tests positional shows that variadic positional arguments are arrays|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests async argv returns deeply nested promise that resolves argv on success|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-test.mjs|title=ESM hierarchy of commands allows array of commands to be registered|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- yargs.mjs|title=yargs dsl tests positional allows a defaultDescription to be set|occurrence=1 — Ancestor (broader) Introduced tests:
-
command.mjs|title=Command allows an array of commands to be provided|occurrence=1, yargs-test.mjs|title=ESM hierarchy of commands allows array of subcommands to be registered|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:esm|file=test/esm/yargs-test.mjs|title=ESM hierarchy of commands allows array of subcommands to be registered|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/command.mjs|title=Command allows an array of commands to be provided|occurrence=1
- usage.mjs|title=usage tests positional indicates that <foo> positional arguments are required|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests async argv returns promise that resolves argv on success|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command async returns promise that resolves arguments once handler succeeds|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
-
command.mjs|title=Command allows builder function to return parsed argv|occurrence=1, command.mjs|title=Command allows builder function to parse argv without returning|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/command.mjs|title=Command allows builder function to parse argv without returning|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/command.mjs|title=Command allows builder function to return parsed argv|occurrence=1
- yargs.mjs|title=yargs dsl tests async parse calls parse callback once async handler has resolved|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command default commands allows command to be run when alias is default command|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command default commands does not execute default command if another command is provided|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command executes a command via alias|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command positional arguments continues to support populate-- for commands, post #1457|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command positional arguments populates inner argv with positional arguments|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command handles positional arguments if command is invoked using .parse()|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command variadic only allows the last argument to be variadic|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests command accepts an object for describing a command's options|occurrence=1 — Ancestor (broader) Introduced tests:
-
command.mjs|title=Command builder helpOrVersionSet cmd|occurrence=1, yargs.mjs|title=yargs dsl tests function passed as second argument to parse commands populates argv appropriately when parse is called multiple times|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/command.mjs|title=Command builder helpOrVersionSet cmd|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/yargs.mjs|title=yargs dsl tests function passed as second argument to parse commands populates argv appropriately when parse is called multiple times|occurrence=1
- usage.mjs|title=usage tests commands allows global option to be disabled|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests positional displays choices array|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests positional displays type information|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse commands invokes command handler normally if no output is populated|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command global parsing hints defaults applies defaults globally|occurrence=1 — Ancestor (broader) Introduced tests:
- command.ts ×1 — Ancestor (broader) Introduced files:
- usage.mjs|title=usage tests positional should display help section for positionals|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command does not require builder function to return|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- command.mjs|title=Command global parsing hints config loads config for command by default|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.mjs|title=usage tests with strict() option set should fail given an option argument without a corresponding description|occurrence=1, usage.mjs|title=usage tests with strict() option set should fail given multiple option arguments without corresponding descriptions|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests with strict() option set should fail given an option argument without a corresponding description|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests with strict() option set should fail given multiple option arguments without corresponding descriptions|occurrence=1
- usage.mjs|title=usage tests async builder positional should contain the expected output for --help|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests default command should display positionals that have been configured|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests usage for default command positional should contain the expected output for --help|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.mjs|title=usage tests demand option with boolean flag with demand option should report missing required arguments|occurrence=1, usage.mjs|title=usage tests demand option with boolean flag with required option should report missing required arguments|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests demand option with boolean flag with demand option should report missing required arguments|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests demand option with boolean flag with required option should report missing required arguments|occurrence=1
- usage.mjs|title=usage tests demand options using .demand() missing argument message given if one command, but an argument not on the list is provided|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests demand options using .demand() missing command message if all the required arguments exist, but not enough commands are provided|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests command skips executing root-level command if builder's help is executed|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests commands does not display $0 twice when default commands are enabled|occurrence=1 — Ancestor (broader) Introduced tests:
- command.ts ×1 — Ancestor (broader) Introduced files:
- usage.mjs|title=usage tests commands displays given command chain with positional args in default usage for subcommand with builder function|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command global parsing hints describe flags an option as global if a description is set|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests commands allows a builder to add more than one usage with multiple usage calls|occurrence=1 — Ancestor (broader) Introduced tests:
- command.ts ×1 — Ancestor (broader) Introduced files:
-
command.mjs|title=Command builder helpOrVersionSet --help|occurrence=1, command.mjs|title=Command async builder helpOrVersionSet --help|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/command.mjs|title=Command async builder helpOrVersionSet --help|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/command.mjs|title=Command builder helpOrVersionSet --help|occurrence=1
- command.mjs|title=Command builder helpOrVersionSet help|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse commands populates output appropriately when parse is called multiple times|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- max demanded count allows a customer error message to be provided|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests required arguments with requiresArg method should show a failure message if a required option is missing|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- command.mjs|title=Command async builder does not print to stdout when parse callback is provided|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.mjs|title=usage tests required arguments with options object should show a failure message if a required option is missing|occurrence=1, usage.mjs|title=usage tests required arguments with options object should show a failure message if more than one required option is missing|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests required arguments with options object should show a failure message if a required option is missing|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests required arguments with options object should show a failure message if more than one required option is missing|occurrence=1
- max demanded count outputs an error if '_' count is below min|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests demand options should not show a custom message if msg is null|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests demand options using .demand() should show an error along with the missing arguments on demand fail|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests usage for default command multiple should contain the expected output for --help|occurrence=1 — Ancestor (broader) Introduced tests:
- validation.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- usage.mjs|title=usage tests should display a failed message when check condition fails|occurrence=1 — Ancestor (broader) Introduced tests:
- validation.ts ×1 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.mjs|title=usage tests wrap should wrap the usage string|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.ts ×2 — Ancestor (broader)
Introduced files:
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests epilogue replaces $0 in epilog string|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests epilogue should display an epilog message at the end of the usage instructions|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests epilogue supports multiple epilogs|occurrence=1
- usage.mjs|title=usage tests should display missing arguments when check fails with a thrown exception|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
-
usage.mjs|title=usage tests wrap should align span columns when ansi colors are used in a description|occurrence=1, usage.mjs|title=usage tests wrap should align span columns when ansi colors are not used in a description|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests wrap should align span columns when ansi colors are not used in a description|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests wrap should align span columns when ansi colors are used in a description|occurrence=1
- yargs.mjs|title=yargs dsl tests showHelpOnFail calling with no arguments should default to displaying help|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×2 — Ancestor (broader) Introduced files: Introduced tests:
- yargs.mjs|title=yargs dsl tests exitProcess should set exit process to true, if no argument provided|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×2 — Ancestor (broader) Introduced files: Introduced tests:
- $0 if it has no aliases|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests accepts an object for implies|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests command does not print command recommendation if help message will be shown|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests allows multiple option calls to not clobber description|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests when exitProcess is false when check fails with a thrown exception should display missing arguments once|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests .help() with .alias() uses multi-char (but not single-char) help alias as command|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests group allows an an option to be placed in an alternative group|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests help option should use 2 dashes for general 1-digit usage|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests usage for default command default only should contain the expected output for --help|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests group allows group to be provided in the options object|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests choices should not output choices when defined for hidden options|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.mjs|title=usage tests hidden options --help should display all options except for hidden ones even in a group|occurrence=1, usage.mjs|title=usage tests hidden options --help should display all groups except for ones with only hidden options|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests hidden options --help should display all groups except for ones with only hidden options|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests hidden options --help should display all options except for hidden ones even in a group|occurrence=1
- usage.mjs|title=usage tests help option should use 2 dashes for multiple-digit alias usage|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.mjs|title=usage tests choices should output choices when defined for non-hidden options|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests help option should use single dashes for 1-digit boolean key usage|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests hidden options --help should display all options except for hidden ones|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests group only displays a duplicated option once per group|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.mjs|title=usage tests array should indicate when an option is an array|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×3 — Ancestor (broader) Introduced files:
- validation.ts ×1 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- usage.mjs|title=usage tests commands displays aliases for commands that have them (with wrap)|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests help option when exitProcess is false should not validate arguments (required argument)|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.mjs|title=usage tests scriptName should display user supplied scriptName|occurrence=1, usage.mjs|title=usage tests scriptName should not alter the user supplied scriptName|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests scriptName should display user supplied scriptName|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests scriptName should not alter the user supplied scriptName|occurrence=1
- usage.ts ×1 — Ancestor (broader) Introduced files:
- yargs.mjs|title=yargs dsl tests parse parses process.parse() if no arguments are provided|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- command.ts ×2 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- yargs.mjs|title=yargs dsl tests getHelp should display top-level help with no command given|occurrence=1 — Ancestor (broader) Introduced tests:
- validation.mjs|title=validation tests config outputs an error if thrown by the parsing function|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests required arguments still requires argument if 'type' hints are given|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests showHelp should call the correct console.log method when specified|occurrence=1 — Ancestor (broader) Introduced tests:
-
usage.mjs|title=usage tests showHelp should show help regardless of whether argv has been called|occurrence=1, usage.mjs|title=usage tests showHelp should print the help using console.error when no arguments were specified|occurrence=1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests showHelp should print the help using console.error when no arguments were specified|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/usage.mjs|title=usage tests showHelp should show help regardless of whether argv has been called|occurrence=1
- usage.mjs|title=usage tests normalizeAliases should display 'description' string in help message if set for alias|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests showHelp should call the callback to print when specified|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests group displays alias keys appropriately within a grouping|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests help option should display usage|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files:
-
validation.mjs|title=validation tests config should be displayed in the help message|occurrence=1, validation.mjs|title=validation tests config should allow help message to be overridden|occurrence=1, +1 — Ancestor (broader)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/validation.mjs|title=validation tests config should allow help message to be overridden|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/validation.mjs|title=validation tests config should be displayed in the help message with its default name|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/validation.mjs|title=validation tests config should be displayed in the help message|occurrence=1
- usage.mjs|title=usage tests should add --help as an option for printing usage text if help() is called without arguments|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse gets passed output as third argument|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.mjs|title=usage tests wrap should not indent usage when no wrap is specified|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.mjs|title=usage tests allows setting help and version with aliases and custom description|occurrence=1 — Ancestor (broader) Introduced tests:
- command.mjs|title=Command commandDir supports a "visit" function option|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests locale uses locale string for help option default desc on .help().locale()|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests locale uses locale string for help option default desc on .locale().help()|occurrence=1 — Ancestor (broader) Introduced tests:
- command.ts ×4 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files: Introduced tests:
- usage.mjs|title=usage tests group allows a group to be provided as the only information about an option|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×3 — Ancestor (broader) Introduced files:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse does not print to stdout|occurrence=1 — Ancestor (broader) Introduced tests:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse does not call callback if subsequently called without callback|occurrence=1 — Ancestor (broader) Introduced tests:
- command.ts ×1 — Ancestor (broader) Introduced files:
- yargs.mjs|title=yargs dsl tests .help() enables `--help` option and `help` command without arguments|occurrence=1 — Ancestor (broader) Introduced tests:
- yargs.mjs|title=yargs dsl tests function passed as second argument to parse reinstates original exitProcess setting after invocation|occurrence=1 — Ancestor (broader) Introduced tests:
- command.ts ×1 — Ancestor (broader) Introduced files:
- command.ts ×3 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×4 — Ancestor (broader) Introduced files:
- usage.ts ×6 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×2 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×2 — Ancestor (broader) Introduced files:
- usage.ts ×2 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×3 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×2 — Ancestor (broader) Introduced files:
- usage.ts ×3 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×2 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×17 — Ancestor (broader) Introduced files:
- usage.ts ×2 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×3 — Ancestor (broader) Introduced files:
- command.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- usage.ts ×1 — Ancestor (broader) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×3 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×5 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×2 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×9 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- usage.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×2 — Descendant (narrower) Introduced files:
- command.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×1 — Descendant (narrower) Introduced files:
- yargs-factory.ts ×35 — Descendant (narrower) Introduced files:
-
yargs-factory.ts ×124 — Descendant (narrower)
Introduced files:
- lib/command.ts
- lib/completion-templates.ts
- lib/completion.ts
- lib/middleware.ts
- lib/usage.ts
- lib/utils/levenshtein.ts
- lib/utils/maybe-async-result.ts
- lib/utils/set-blocking.ts
- lib/validation.ts
- lib/yargs-factory.ts
- argsert.ts ×1 — Descendant (narrower) Introduced files: Introduced tests:
-
argsert.mjs|title=Argsert allows for any type if * is provided|occurrence=1, argsert.mjs|title=Argsert should ignore trailing undefined values|occurrence=1 — Descendant (narrower)
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/argsert.mjs|title=Argsert allows for any type if * is provided|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/argsert.mjs|title=Argsert should ignore trailing undefined values|occurrence=1
- argsert.ts ×1 — Descendant (narrower) Introduced files:
- argsert.ts ×1 — Descendant (narrower) Introduced files:
- argsert.ts ×1 — Descendant (narrower) Introduced files:
- argsert.ts ×1 — Descendant (narrower) Introduced files:
- argsert.ts ×1 — Descendant (narrower) Introduced files: Introduced tests:
- argsert.ts ×2 — Descendant (narrower) Introduced files:
- argsert.ts ×3 — Descendant (narrower) Introduced files:
- parse-command.ts ×1 — Descendant (narrower) Introduced files:
- parse-command.ts ×1 — Descendant (narrower) Introduced files:
- parse-command.ts ×3 — Descendant (narrower) Introduced files:
- process-argv.ts ×1 — Descendant (narrower) Introduced files:
- process-argv.ts ×3 — Descendant (narrower) Introduced files:
- argsert.ts ×1 — Descendant (narrower) Introduced files:
-
apply-extends.ts ×4 — Descendant (narrower)
Introduced files:
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:esm|file=test/esm/helpers.mjs|title=helpers Parser exposes functional argument parser|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/parser.mjs|title=should expose yargs-parser as Parser|occurrence=1
- argsert.ts ×4 — Descendant (narrower) Introduced files:
- obj-filter.ts ×2 — Descendant (narrower) Introduced files:
- argsert.ts ×3 — Descendant (narrower) Introduced files:
- common-types.ts ×4 — Descendant (narrower) Introduced files:
-
process-argv.ts ×5 — Descendant (narrower)
Introduced files:
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:esm|file=test/esm/platform-shim-test.mjs|title=platform-shim y18n __ behaves like sprintf|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:esm|file=test/esm/platform-shim-test.mjs|title=platform-shim y18n __n uses first string if singular|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:esm|file=test/esm/platform-shim-test.mjs|title=platform-shim y18n __n uses second string if plural|occurrence=1
-
is-promise.ts ×2 — Descendant (narrower)
Introduced files:
Introduced tests:
mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/is-promise.mjs|title=isPromise returns `false` if passed object has no `then` property|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/is-promise.mjs|title=isPromise returns `false` if some falsy value is passed|occurrence=1mocha:v1|namespace=yargs@4153e0f097aeaf43a71a2530db6dda51dff2c544:main|file=test/is-promise.mjs|title=isPromise returns `false` on non promise value|occurrence=1
- parse-command.ts ×1 — Descendant (narrower) Introduced files: Introduced tests:
- parse-command.ts ×2 — Descendant (narrower) Introduced files:
- yerror.ts ×2 — Descendant (narrower) Introduced files:
- is-promise.ts ×1 — Descendant (narrower) Introduced files:
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: 125 introduced LOC across 20 ranges. Expand a file to inspect source; the > gutter marks introduced lines.
lib/usage.ts 122 introduced LOC · 19 ranges
self.help = function help() {
normalizeAliases();
// handle old demanded API
const base$0 = yargs.customScriptName
? yargs.$0
: shim.path.basename(yargs.$0);
const demandedOptions = yargs.getDemandedOptions();
const demandedCommands = yargs.getDemandedCommands();
const deprecatedOptions = yargs.getDeprecatedOptions();
const groups = yargs.getGroups();
const options = yargs.getOptions();
let keys: string[] = [];
keys = keys.concat(Object.keys(descriptions));
keys = keys.concat(Object.keys(demandedOptions));
keys = keys.concat(Object.keys(demandedCommands));
keys = keys.concat(Object.keys(options.default));
keys = keys.filter(filterHiddenOptions);
keys = Object.keys(
keys.reduce((acc, key) => {
if (key !== '_') acc[key] = true;
return acc;
}, {} as Dictionary<boolean>)
);
const theWrap = self.getWrap();
const ui = shim.cliui({
width: theWrap,
wrap: !!theWrap,
});
// the usage string.
if (!usageDisabled) {
if (usages.length) {
// user-defined usage.
}
}
// your application's commands, i.e., non-option
// arguments populated in '_'.
//
// If there's only a single command, and it's the default command
// (represented by commands[0][2]) don't show command stanza:
//
// TODO(@bcoe): why isn't commands[0][2] an object with a named property?
if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) {
ui.div(__('Commands:'));
ui.div();
}
// perform some cleanup on the keys array, making it
// only include top-level keys not their aliases.
const aliasKeys = (Object.keys(options.alias) || []).concat(
Object.keys((yargs.parsed as DetailedArguments).newAliases) || []
);
keys = keys.filter(
key =>
!(yargs.parsed as DetailedArguments).newAliases[key] &&
aliasKeys.every(
alias => (options.alias[alias] || []).indexOf(key) === -1
);
// populate 'Options:' group with any keys that have not
// explicitly had a group set.
const defaultGroup = __('Options:');
if (!groups[defaultGroup]) groups[defaultGroup] = [];
addUngroupedKeys(keys, options.alias, groups, defaultGroup);
const isLongSwitch = (sw: string | IndentedText) => /^--/.test(getText(sw));
// prepare 'Options:' tables display
const displayedGroups = Object.keys(groups)
.filter(groupName => groups[groupName].length > 0)
.map(groupName => {
// if we've grouped the key 'f', but 'f' aliases 'foobar',
// normalizedKeys should contain only 'foobar'.
return {groupName, normalizedKeys};
.filter(({normalizedKeys}) => normalizedKeys.length > 0)
.map(({groupName, normalizedKeys}) => {
// actually generate the switches string --foo, -f, --bar.
const switches: Dictionary<string | IndentedText> =
return {groupName, normalizedKeys, switches};
// if some options use short switches, indent long-switches only options (see #1403)
const shortSwitchesUsed = displayedGroups
.filter(({groupName}) => groupName !== self.getPositionalGroupName())
.some(
({normalizedKeys, switches}) =>
!normalizedKeys.every(key => isLongSwitch(switches[key]))
if (shortSwitchesUsed) {
displayedGroups
.filter(({groupName}) => groupName !== self.getPositionalGroupName())
});
}
// display 'Options:' table along with any custom tables:
displayedGroups.forEach(({groupName, normalizedKeys, switches}) => {
ui.div(groupName);
ui.div();
// describe some common use-cases for your application.
if (examples.length) {
ui.div(__('Examples:'));
ui.div();
}
// the usage string.
if (epilogs.length > 0) {
const e = epilogs
.map(epilog => epilog.replace(/\$0/g, base$0))
ui.div(`${e}\n`);
}
// Remove the trailing white spaces
return ui.toString().replace(/\s*$/, '');
};
// are copied to the keys being aliased.
function normalizeAliases() {
const demandedOptions = yargs.getDemandedOptions();
const options = yargs.getOptions();
(Object.keys(options.alias) || []).forEach(key => {
options.alias[key].forEach(alias => {
// copy descriptions.
if (options.number.includes(alias)) yargs.number(key);
});
}
// if yargs is executing an async handler, we take a snapshot of the
// ungrouped under the 'Options:' grouping.
function addUngroupedKeys(
aliases: Dictionary<string[]>,
groups: Dictionary<string[]>,
defaultGroup: string
) {
let groupedKeys = [] as string[];
let toCheck = null;
Object.keys(groups).forEach(group => {
groupedKeys = groupedKeys.concat(groups[group]);
});
keys.forEach(key => {
toCheck = [key].concat(aliases[key]);
if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) {
groups[defaultGroup].push(key);
}
return groupedKeys;
}
function filterHiddenOptions(key: string) {
yargs.getOptions().hiddenOptions.indexOf(key) < 0 ||
(yargs.parsed as DetailedArguments).argv[yargs.getOptions().showHiddenOpt]
}
self.showHelp = (level: 'error' | 'log' | ((message: string) => void)) => {
lib/yargs-factory.ts 3 introduced LOC · 1 range
}
getDeprecatedOptions() {
return this.#options.deprecatedOptions;
}
getDetectLocale(): boolean {
return this.#detectLocale;