Socket
Socket
Sign inDemoInstall

cac

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cac - npm Package Compare versions

Comparing version 2.0.3 to 2.1.0

32

index.js

@@ -83,2 +83,5 @@ 'use strict';

this.pkg = readPkg.sync().pkg
this.unknownFn = function (arg) {
console.log(("error: unknown option `" + arg + "`"))
}

@@ -126,3 +129,3 @@ this

return this
return this
};

@@ -188,7 +191,28 @@

CAC.prototype.string = function string (value) {
this.string = value
};
CAC.prototype.boolean = function boolean (value) {
this.boolean = value
};
CAC.prototype.unknown = function unknown (fn) {
this.unknownFn = fn
return this
};
CAC.prototype.parse = function parse (argv) {
var this$1 = this;
argv = argv || process.argv.slice(2)
this.argv = parseArgv(argv, {
alias: this.aliasOptions,
default: this.defaultValues
default: this.defaultValues,
string: this.string,
boolean: this.boolean,
unknown: function (arg) {
this$1.unknownFn(arg)
return false
}
})

@@ -205,4 +229,4 @@ if (this.argv.flags.help) {

command = this.commands['*']
}
this.runCommand(command)
}
this.runCommand(command)

@@ -209,0 +233,0 @@ return this

2

package.json
{
"name": "cac",
"version": "2.0.3",
"version": "2.1.0",
"description": "Command & Conquer, the command-line queen.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -63,4 +63,16 @@ # cac [![NPM version](https://img.shields.io/npm/v/cac.svg)](https://npmjs.com/package/cac) [![NPM downloads](https://img.shields.io/npm/dm/cac.svg)](https://npmjs.com/package/cac) [![Build Status](https://img.shields.io/circleci/project/egoist/cac/master.svg)](https://circleci.com/gh/egoist/cac)

## .unknown(fn)
- **fn**: `function`, invoked when an unknow option was provided by user.
## .string(string | array)
a string or array of strings argument names to always treat as strings
## .boolean(boolean | string | array)
a boolean, string or array of strings to always treat as booleans. if true will treat all double hyphenated arguments without equal signs as boolean (e.g. affects --foo, not -f or --foo=bar)
## License
MIT © [egoist](https://github.com/egoist)
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