Comparing version 6.3.3 to 6.3.4
@@ -630,5 +630,7 @@ 'use strict'; | ||
/** | ||
* Parse argv and run command action if found. | ||
* Parse argv | ||
*/ | ||
parse(argv = process.argv) { | ||
parse(argv = process.argv, { | ||
/** Whether to run the action for matched command */ | ||
run = true } = {}) { | ||
this.rawArgs = argv; | ||
@@ -675,6 +677,6 @@ this.bin = argv[1] ? path_1.default.basename(argv[1]) : 'cli'; | ||
const parsedArgv = { args: this.args, options: this.options }; | ||
if (this.matchedCommand) { | ||
this.runCommandAction(this.matchedCommand, parsedArgv); | ||
if (run) { | ||
this.runMatchedCommand(); | ||
} | ||
else if (this.args[0]) { | ||
if (!this.matchedCommand && this.args[0]) { | ||
this.emit('command:*'); | ||
@@ -709,4 +711,5 @@ } | ||
} | ||
runCommandAction(command, { args, options }) { | ||
if (!command.commandAction) | ||
runMatchedCommand() { | ||
const { args, options, matchedCommand: command } = this; | ||
if (!command || !command.commandAction) | ||
return; | ||
@@ -713,0 +716,0 @@ command.checkUnknownOptions(); |
{ | ||
"name": "cac", | ||
"version": "6.3.3", | ||
"version": "6.3.4", | ||
"description": "Simple yet powerful framework for building command-line apps.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -233,2 +233,3 @@ <img width="945" alt="2017-07-26 9 27 05" src="https://user-images.githubusercontent.com/8784712/28623641-373450f4-7249-11e7-854d-1b076dab274d.png"> | ||
- [VuePress](https://github.com/vuejs/vuepress): :memo: Minimalistic Vue-powered static site generator. | ||
- [SAO](https://github.com/egoist/sao): โ๏ธ Futuristic scaffolding tool. | ||
@@ -235,0 +236,0 @@ - [DocPad](https://github.com/docpad/docpad): ๐น Powerful Static Site Generator. |
@@ -86,8 +86,12 @@ /// <reference types="node" /> | ||
/** | ||
* Parse argv and run command action if found. | ||
* Parse argv | ||
*/ | ||
parse(argv?: string[]): ParsedArgv; | ||
parse(argv?: string[], { | ||
/** Whether to run the action for matched command */ | ||
run }?: { | ||
run?: boolean | undefined; | ||
}): ParsedArgv; | ||
private mri; | ||
private runCommandAction; | ||
runMatchedCommand(): any; | ||
} | ||
export default CAC; |
44324
910
430