Comparing version 2.2.1 to 2.2.2
History | ||
======= | ||
## 2.2.2 | ||
* Fix help to work with `builder help <action|archetype(s)>`. | ||
## 2.2.1 | ||
@@ -5,0 +9,0 @@ |
@@ -102,3 +102,4 @@ "use strict"; | ||
* ```sh | ||
* $ builder help [ARCHETYPE, ARCHETYPE] | ||
* $ builder help <action> | ||
* $ builder help <archetype1> <archetype2> | ||
* ``` | ||
@@ -110,21 +111,25 @@ * | ||
Task.prototype.help = function (callback) { | ||
// Arguments after `help` are archetypes. | ||
// Arguments after `help` are action OR archetypes. | ||
var cmd = this._command; | ||
var flagsDisplay = chalk.green.bold("Flags"); | ||
// One matching command is an action: `builder help run` | ||
var action = _.contains(this.ACTIONS, cmd) ? cmd : null; | ||
var actionDisplay = action ? chalk.red(action) : "<action>"; | ||
var actions = this.ACTIONS.map(function (val) { | ||
return val === cmd ? chalk.red(cmd) : val; | ||
return val === action ? chalk.red(action) : val; | ||
}).join(", "); | ||
var action = cmd ? chalk.red(cmd) : "[action]"; | ||
var actionFlags = ""; | ||
if (cmd) { | ||
actionFlags = "\n\n" + chalk.green.bold("Flags") + ": " + chalk.red(cmd) + "\n\n " + | ||
args.help(cmd); | ||
} | ||
var actionFlags = action ? | ||
"\n\n" + flagsDisplay + ": " + actionDisplay + "\n\n " + args.help(cmd) : | ||
""; | ||
// No matched action means all string are archetypes: `builder help <arch1> <arch2>` | ||
var archetypes = action ? null : this._commands; | ||
log.info("help", | ||
"\n\n" + chalk.green.bold("Usage") + ": \n\n builder " + action + " <action> <task(s)>" + | ||
"\n\n" + chalk.green.bold("Usage") + ": \n\n builder " + actionDisplay + " <task(s)>" + | ||
"\n\n" + chalk.green.bold("Actions") + ": \n\n " + actions + | ||
"\n\n" + chalk.green.bold("Flags") + ": General\n\n " + args.help() + | ||
"\n\n" + flagsDisplay + ": General\n\n " + args.help() + | ||
actionFlags + | ||
"\n\n" + chalk.green.bold("Tasks") + ": \n" + this._config.displayScripts()); | ||
"\n\n" + chalk.green.bold("Tasks") + ": \n" + this._config.displayScripts(archetypes)); | ||
@@ -131,0 +136,0 @@ callback(); |
{ | ||
"name": "builder", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "An NPM-based task runner", | ||
@@ -5,0 +5,0 @@ "repository": { |
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
45790
855