Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Jul 12, 2024 via pnpm

commander 4.1.1

the complete solution for node.js command-line programs
Package summary
Share
0
issues
1
license
1
MIT
Package created
14 Aug 2011
Version published
3 Feb 2020
Maintainers
4
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
commander@4.1.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of commander 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does commander do?

Commander.js is a powerful Node.js package providing a complete solution for creating command-line interfaces. It offers an easy way to define required inputs, optional parameters, flags, and commands, thus empowering developers to build sophisticated, user-friendly command-line tools. Commander.js simplifies the process of handling command-line arguments, managing usage errors, and implementing a help system. It also supports multi-command workflows, where each command can have its own action handler or be a stand-alone executable.

How do you use commander?

To use Commander.js, you'll first need to install it via npm using the command npm install commander. Once installed, you can require it in your Node.js script and start defining commands, options, and action handlers.

Here is a basic usage example:

const { program } = require('commander');

// Version and option setting
program
  .version('1.0.0')
  .option('-t, --type <type>', 'Specify type');

// Default help setup
program.parse();

// Access specified options
const options = program.opts();
console.log(`Type: ${options.type}`);

In this example, we define an option '-t' with a long form '--type'. This option expects a value which we can access via program.opts(). Running the script with -t example will output Type: example.

You can also define custom commands with specific action handlers, handle required and optional command-arguments, and validate inputs. Commander.js supports both synchronous and asynchronous action handlers.

Where are the commander docs?

The Commander.js documentation, which includes a comprehensive guide on how to use the package, is available within its GitHub repository. From Installation setup and Quick Start guide to advanced usage scenarios, the documentation covers everything you need to effectively leverage the power of Commander.js. The documentation also provides numerous examples that cover a wide array of use cases. The Commander.js GitHub repository is located at https://github.com/tj/commander.js.