@anycli/command
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -0,1 +1,9 @@ | ||
<a name="0.3.1"></a> | ||
## [0.3.1](https://github.com/anycli/command/compare/087b248216686f4ac50c68782cda61312da26724...v0.3.1) (2018-02-01) | ||
### Bug Fixes | ||
* fixed --help ([d51b5cf](https://github.com/anycli/command/commit/d51b5cf)) | ||
<a name="0.3.0"></a> | ||
@@ -2,0 +10,0 @@ # [0.3.0](https://github.com/anycli/command/compare/ab963a2f557902f2936f4f9c71bdb462ca661c4a...v0.3.0) (2018-02-01) |
@@ -10,2 +10,3 @@ "use strict"; | ||
const g = global; | ||
g.anycli = g.anycli || {}; | ||
const parentModule = module.parent && module.parent.parent && module.parent.parent.filename; | ||
@@ -54,2 +55,3 @@ class Command { | ||
Command.run = async function (argv = process.argv.slice(2), opts = {}) { | ||
g.anycli.command = {}; | ||
let cmd; | ||
@@ -63,11 +65,11 @@ try { | ||
cmd = new this(argv, Object.assign({}, opts, { config })); | ||
if (g.anycli.showVersion) { | ||
if (g.anycli.command.showVersion) { | ||
cli_ux_1.default.info(config.userAgent); | ||
return; | ||
} | ||
if (argv.includes('--help') || g.anycli.showHelp) { | ||
// const Helper: typeof Help = require('@anycli/help').default | ||
// const help = new Helper(config) | ||
// help.co() | ||
// cli.info(help.command(this.convertToCached())) | ||
if (argv.includes('--help') || g.anycli.command.showHelp) { | ||
const Helper = require('@anycli/help').default; | ||
const help = new Helper(config); | ||
help.command(this.convertToCached()); | ||
cli_ux_1.default.info(help.command(this.convertToCached())); | ||
return; | ||
@@ -74,0 +76,0 @@ } |
@@ -26,6 +26,5 @@ "use strict"; | ||
const g = global; | ||
g.anycli = g.anycli || {}; | ||
exports.version = (opts = {}) => { | ||
return Parser.flags.boolean(Object.assign({ char: 'v', description: 'show CLI version' }, opts, { parse: () => { | ||
g.anycli.showVersion = true; | ||
g.anycli.command.showVersion = true; | ||
} })); | ||
@@ -35,4 +34,4 @@ }; | ||
return Parser.flags.boolean(Object.assign({ char: 'h', description: 'show CLI help' }, opts, { parse: () => { | ||
g.anycli.showHelp = true; | ||
g.anycli.command.showHelp = true; | ||
} })); | ||
}; |
{ | ||
"name": "@anycli/command", | ||
"description": "anycli base command", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Jeff Dickey @jdxcode", | ||
@@ -16,3 +16,3 @@ "bugs": "https://github.com/anycli/command/issues", | ||
"@anycli/config": "^0.2.10", | ||
"@anycli/help": "^0.3.3", | ||
"@anycli/help": "^0.3.4", | ||
"@anycli/tslint": "^0.2.1", | ||
@@ -19,0 +19,0 @@ "@commitlint/cli": "^6.0.5", |
26004
280