Comparing version 1.0.7 to 1.0.8
35
index.js
@@ -173,3 +173,3 @@ var MAX_LINE_WIDTH = process.stdout.columns || 200; | ||
hot: false, | ||
beforeInit: false, | ||
required: false, | ||
@@ -202,4 +202,8 @@ minArgsCount: 0, | ||
key == 'defValue' || | ||
key == 'hot') | ||
key == 'beforeInit') | ||
option[key] = opt_1[key]; | ||
// old name for `beforeInit` setting is `hot` | ||
if (opt_1.hot) | ||
option.beforeInit = true; | ||
} | ||
@@ -705,6 +709,6 @@ else | ||
// apply hot options | ||
// apply beforeInit options | ||
command.setOptions( | ||
item.options.reduce(function(res, entry){ | ||
if (entry.option.hot) | ||
if (entry.option.beforeInit) | ||
res[entry.option.camelName] = entry.value; | ||
@@ -723,3 +727,3 @@ return res; | ||
item.options.reduce(function(res, entry){ | ||
if (!entry.option.hot) | ||
if (!entry.option.beforeInit) | ||
res[entry.option.camelName] = entry.value; | ||
@@ -803,2 +807,10 @@ return res; | ||
function args(command){ | ||
return command.params.args.map(function(arg){ | ||
return arg.required | ||
? '<' + arg.name + '>' | ||
: '[' + arg.name + ']'; | ||
}).join(' '); | ||
} | ||
function commandsHelp(){ | ||
@@ -811,6 +823,8 @@ if (!command.hasCommands()) | ||
var subcommand = command.commands[name]; | ||
var line = { | ||
name: chalk.green(name) + | ||
(subcommand.hasOptions() ? ' [<options>]' : '') + | ||
(subcommand._args && subcommand._args.length ? ' [<args>]' : ''), | ||
name: chalk.green(name) + chalk.gray( | ||
(subcommand.params ? ' ' + args(subcommand) : '') | ||
// (subcommand.hasOptions() ? ' [options]' : '') | ||
), | ||
description: subcommand.description_ || '' | ||
@@ -882,4 +896,5 @@ }; | ||
chalk.cyan(commandsPath ? commandsPath.join(' ') : command.name) + | ||
(command.hasOptions() ? ' [' + chalk.yellow('<options>') + ']' : '') + | ||
(command.hasCommands() ? ' [' + chalk.green('<command>') + ']' : ''), | ||
(command.params ? ' ' + chalk.magenta(args(command)) : '') + | ||
(command.hasOptions() ? ' [' + chalk.yellow('options') + ']' : '') + | ||
(command.hasCommands() ? ' [' + chalk.green('command') + ']' : ''), | ||
commandsHelp() + | ||
@@ -886,0 +901,0 @@ optionsHelp() |
@@ -6,3 +6,3 @@ { | ||
"author": "Roman Dvornov <rdvornov@gmail.com>", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"keywords": [ | ||
@@ -9,0 +9,0 @@ "cli", |
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
22734
758