Comparing version 6.3.9 to 6.3.10
@@ -583,2 +583,3 @@ 'use strict'; | ||
this.globalCommand.helpCallback = callback; | ||
this.showHelpOnExit = true; | ||
return this; | ||
@@ -592,2 +593,3 @@ } | ||
this.globalCommand.version(version, customFlags); | ||
this.showVersionOnExit = true; | ||
return this; | ||
@@ -673,8 +675,6 @@ } | ||
} | ||
if (this.options.help && this.globalCommand.hasOption('help')) { | ||
if (this.options.help && this.showHelpOnExit) { | ||
this.outputHelp(); | ||
} | ||
if (this.options.version && | ||
this.globalCommand.hasOption('version') && | ||
this.globalCommand.versionNumber) { | ||
if (this.options.version && this.showVersionOnExit) { | ||
this.outputVersion(); | ||
@@ -681,0 +681,0 @@ } |
{ | ||
"name": "cac", | ||
"version": "6.3.9", | ||
"version": "6.3.10", | ||
"description": "Simple yet powerful framework for building command-line apps.", | ||
@@ -18,2 +18,3 @@ "repository": { | ||
"test": "jest", | ||
"test:cov": "jest --coverage", | ||
"build": "tsc && bili", | ||
@@ -20,0 +21,0 @@ "toc": "markdown-toc -i README.md", |
<img width="945" alt="2017-07-26 9 27 05" src="https://user-images.githubusercontent.com/8784712/28623641-373450f4-7249-11e7-854d-1b076dab274d.png"> | ||
[![NPM version](https://img.shields.io/npm/v/cac.svg?style=flat)](https://npmjs.com/package/cac) [![NPM downloads](https://img.shields.io/npm/dm/cac.svg?style=flat)](https://npmjs.com/package/cac) [![CircleCI](https://circleci.com/gh/cacjs/cac/tree/master.svg?style=shield)](https://circleci.com/gh/cacjs/cac/tree/master) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) [![chat](https://img.shields.io/badge/chat-on%20discord-7289DA.svg?style=flat)](https://chat.egoist.moe) [![install size](https://badgen.net/packagephobia/install/cac)](https://packagephobia.now.sh/result?p=cac) | ||
[![NPM version](https://img.shields.io/npm/v/cac.svg?style=flat)](https://npmjs.com/package/cac) [![NPM downloads](https://img.shields.io/npm/dm/cac.svg?style=flat)](https://npmjs.com/package/cac) [![CircleCI](https://circleci.com/gh/cacjs/cac/tree/master.svg?style=shield)](https://circleci.com/gh/cacjs/cac/tree/master) [![Codecov](https://badgen.net/codecov/c/github/cacjs/cac/master)](https://codecov.io/gh/cacjs/cac) [![donate](https://img.shields.io/badge/$-donate-ff69b4.svg?maxAge=2592000&style=flat)](https://github.com/egoist/donate) [![chat](https://img.shields.io/badge/chat-on%20discord-7289DA.svg?style=flat)](https://chat.egoist.moe) [![install size](https://badgen.net/packagephobia/install/cac)](https://packagephobia.now.sh/result?p=cac) | ||
@@ -29,2 +29,3 @@ ## Introduction | ||
- [Default Command](#default-command) | ||
- [Supply an array as option value](#supply-an-array-as-option-value) | ||
- [With TypeScript](#with-typescript) | ||
@@ -215,2 +216,14 @@ - [Projects Using CAC](#projects-using-cac) | ||
### Supply an array as option value | ||
```bash | ||
node cli.js --include project-a | ||
# The parsed options will be: | ||
# { include: 'project-a' } | ||
node cli.js --include project-a --include project-b | ||
# The parsed options will be: | ||
# { include: ['project-a', 'project-b'] } | ||
``` | ||
### With TypeScript | ||
@@ -242,2 +255,3 @@ | ||
- [lass](https://github.com/lassjs/lass): ๐๐ป Scaffold a modern package boilerplate for Node.js. | ||
- [Foy](https://github.com/zaaack/foy): ๐ A lightweight and modern task runner and build tool for general purpose. | ||
- Feel free to add yours here... | ||
@@ -284,3 +298,2 @@ | ||
- `config.default`: Default value for the option. | ||
- `config.coerce`: `(value: any) => newValue` A function to process the option value. | ||
@@ -287,0 +300,0 @@ #### cli.parse(argv?) |
@@ -38,2 +38,4 @@ /// <reference types="node" /> | ||
rawOptions: MriResult['rawOptions']; | ||
private showHelpOnExit; | ||
private showVersionOnExit; | ||
/** | ||
@@ -89,3 +91,3 @@ * @param name The program name to display in help and version message | ||
outputVersion(): void; | ||
setParsedInfo({ args, options, rawOptions }: MriResult, matchedCommand?: Command): this; | ||
private setParsedInfo; | ||
/** | ||
@@ -92,0 +94,0 @@ * Parse argv |
interface OptionConfig { | ||
default?: any; | ||
coerce?: (v: any) => any; | ||
} | ||
@@ -5,0 +4,0 @@ export default class Option { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
46325
951
448