Gathering detailed insights and metrics for nested-yargs
Gathering detailed insights and metrics for nested-yargs
Gathering detailed insights and metrics for nested-yargs
Gathering detailed insights and metrics for nested-yargs
An opinionated wrapper around yargs to make building nested command-line interfaces a breeze.
npm install nested-yargs
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
7 Stars
21 Commits
8 Forks
110 Watchers
2 Branches
10 Contributors
Updated on Jun 12, 2024
Latest Version
1.0.7
Package Id
nested-yargs@1.0.7
Size
4.56 kB
NPM Version
2.11.3
Node Version
0.12.7
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
An opinionated wrapper around yargs to make nested command-line structures a breeze.
1npm install nested-yargs
1var Cli = require('nested-yargs');
2var Widgets = require('./widget-service'); // Imaginary api
3
4// The 'root' of our app is an anonymous category
5var app = Cli.createApp();
6
7// You add categories and commands using the `.command()` method.
8app.command(Cli.createCommand('init', 'Initialize the this tool.', {
9 handler: function (argv) {
10 // Initialize the tool
11 }
12});
13
14
15// You can nest categories as deep as you would like
16var widgets = Cli.createCategory('widgets', 'Manage your inventory of widgets.');
17
18widgets.command(Cli.createCommand('ls', 'List your widgets.', {
19 // Options follow the yarg option format
20 options: {
21 color: {
22 alias: 'c'
23 description: 'Only list widgets of the given color.',
24 type: 'string',
25 }
26 }
27 handler: function (argv) {
28 Widgets.list(argv, function (err, widgets) {
29 if (err) throw err; // Thrown errors will print the error in red
30 // and print the help.
31
32 // Pretty-print your list of widgets however you'd like
33 });
34 }
35}));
36// The ls command is now available at `widgets.commands.ls`
37
38// Alias `widgets ls` to the top-level command `widgets ls`
39app.command(Cli.createCommand('ls', widgets.commands.ls.description,
40 widgets.commands.ls.options));
41
42app.command(widgets);
43
44Cli.run(app);
Creates a new nested-yargs
application (actually a Category
with its name
set to '$0'
.
Create and return new Category
object with the given name and description.
Properties
.name
.description
.path
- If the category is attached, this will be an array of ancestor command names.parent
- If the category is attached, this is a reference to its parent categoryMethods
.command(<Category|Command>)
- Register a child Category or CommandCreate and return new Command
object with the given name, description and options.
Here, options supports the following properties:
params:
- A string describing the required and optional parameters (not options)
Example: "<name> [field]"
. Here name is required but field is optional.
These values will be available to handlers as argv.params[paramName]
.setup:
- A function that will be invoked with the yargs instance if this
command is triggered once Cli.run()
has been called.options:
- A hash of options in the yargs format as per
yargs docs.handler:
- A function that will be invoked with the parsed argv
object.Properties
.name
.description
.path
- If the category is attached, this will be an array of ancestor command names.parent
- If the category is attached, this is a reference to its parent category.options
- The options passed in to the Command constructorOnce you have set up your cli application's structure, it is time to run it.
This library is used in wt-cli.
Just clone the repo, run npm install
and then hack away.
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
MIT
Auth0 helps you to:
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
GitHub workflow tokens follow principle of least privilege
Details
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
branch protection is not maximal on development and all release branches
Details
Reason
Found 2/17 approved changesets -- score normalized to 1
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More