Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

clap

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clap - npm Package Compare versions

Comparing version 1.2.3 to 2.0.0

CHANGELOG.md

28

package.json

@@ -6,4 +6,5 @@ {

"author": "Roman Dvornov <rdvornov@gmail.com>",
"repository": "lahmatiy/clap",
"license": "MIT",
"version": "1.2.3",
"version": "2.0.0",
"keywords": [

@@ -16,23 +17,26 @@ "cli",

],
"homepage": "https://github.com/lahmatiy/clap",
"repository": "lahmatiy/clap",
"main": "index.js",
"main": "lib/index.js",
"files": [
"index.js",
"HISTORY.md",
"LICENSE",
"README.md"
"lib"
],
"engines": {
"node": ">=0.10.0"
"node": ">=8.0.0"
},
"dependencies": {
"chalk": "^1.1.3"
"chalk": "^3.0.0"
},
"devDependencies": {
"mocha": "^2.4.5"
"coveralls": "^3.0.7",
"eslint": "^6.5.1",
"mocha": "^6.2.2",
"nyc": "^14.1.0"
},
"scripts": {
"test": "mocha test -R spec"
"lint": "eslint lib test",
"lint-and-test": "npm run lint && npm test",
"test": "mocha -R progress",
"coverage": "nyc npm test",
"travis": "nyc npm run lint-and-test && npm run coveralls",
"coveralls": "nyc report --reporter=text-lcov | coveralls"
}
}
[![NPM version](https://img.shields.io/npm/v/clap.svg)](https://www.npmjs.com/package/clap)
[![Dependency Status](https://img.shields.io/david/lahmatiy/clap.svg)](https://david-dm.org/lahmatiy/clap)
[![Build Status](https://travis-ci.org/lahmatiy/clap.svg?branch=master)](https://travis-ci.org/lahmatiy/clap)
[![Coverage Status](https://coveralls.io/repos/github/lahmatiy/clap/badge.svg?branch=master)](https://coveralls.io/github/lahmatiy/clap?branch=master)

@@ -9,4 +9,44 @@ # Clap.js

Inspired by TJ Holowaychuk [Commander](https://github.com/visionmedia/commander.js).
## Usage
[TODO: Complete readme]
```
npm install clap
```
```js
const cli = require('clap');
const myCommand = cli.command('my-command', '[optional-arg]')
.description('Optional description')
.version('1.2.3')
.option('-b, --bool', 'Bollean option')
.option('--foo <foo>', 'Option with required argument')
.option('--bar [bar]', 'Option with optional argument')
.option('--baz [value]', 'Option with optional argument and normalize function', function(value) {
// calls on init and for any value set
return Number(value);
}, 123) // 123 is default
.action(function(args, literalArgs) {
// args goes before options
// literal args goes after --
// this.values is an object with collected values
});
myCommand.run(); // runs with process.argv.slice(2)
myCommand.run(['--foo', '123', '-b'])
// sub-commands
myCommand
.command('nested')
.option('-q, --quz', 'Some parameter', 'Default value')
// ...
.end()
.command('another-command')
// ...
.command('level3-command')
//...
```
## License
MIT

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc