@artus-cli/plugin-help
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -17,14 +17,15 @@ "use strict"; | ||
const { binName: bin } = this.program; | ||
const { fuzzyMatched, matched, args, raw } = ctx; | ||
if (!fuzzyMatched || !args.help) { | ||
if (!matched) { | ||
// can not match any command | ||
console.error(`\n Command not found: '${bin} ${raw.join(' ')}', try '${(fuzzyMatched === null || fuzzyMatched === void 0 ? void 0 : fuzzyMatched.cmds.join(' ')) || bin} --help' for more information.\n`); | ||
process.exit(1); | ||
} | ||
return next(); | ||
if (ctx.fuzzyMatched && ctx.args.help) { | ||
// redirect to help command | ||
const utils = ctx.container.get(artus_cli_1.Utils); | ||
return utils.redirect(['help', ctx.fuzzyMatched.uid]); | ||
} | ||
// redirect to help command | ||
const utils = ctx.container.get(artus_cli_1.Utils); | ||
await utils.redirect(['help', fuzzyMatched.uid]); | ||
try { | ||
await next(); | ||
} | ||
catch (e) { | ||
// can not match any command | ||
console.error(`\n ${e.message}, try '${ctx.fuzzyMatched.cmds.join(' ') || bin} --help' for more information.\n`); | ||
process.exit(1); | ||
} | ||
}); | ||
@@ -31,0 +32,0 @@ } |
{ | ||
"name": "@artus-cli/plugin-help", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "show help information for @artus-cli", | ||
@@ -5,0 +5,0 @@ "homepage": "", |
146
9425