Add colors to the help message.
This commit is contained in:
parent
f6b9b4cc19
commit
291570dfd7
@ -44,6 +44,35 @@ var wrap = function (val) {
|
|||||||
|
|
||||||
//====================================================================
|
//====================================================================
|
||||||
|
|
||||||
|
var help = wrap((function (pkg) {
|
||||||
|
return multiline.stripIndent(function () {/*
|
||||||
|
Usage:
|
||||||
|
|
||||||
|
$name --register [<XO-Server URL>] [<username>] [<password>]
|
||||||
|
Registers the XO instance to use.
|
||||||
|
|
||||||
|
$name --list-commands [--json]
|
||||||
|
Returns the list of available commands on the current XO instance.
|
||||||
|
|
||||||
|
$name <command> [<name>=<value>]...
|
||||||
|
Executes a command on the current XO instance.
|
||||||
|
|
||||||
|
$name v$version
|
||||||
|
*/}).replace(/<([^>]+)>|\$(\w+)/g, function (_, arg, key) {
|
||||||
|
if (arg) {
|
||||||
|
return '<'+ chalk.yellow(arg) +'>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if ('name' === key) {
|
||||||
|
return chalk.bold(pkg[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pkg[key];
|
||||||
|
});
|
||||||
|
})(require('../package')));
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
exports = module.exports = function (args) {
|
exports = module.exports = function (args) {
|
||||||
if (!args || !args.length) {
|
if (!args || !args.length) {
|
||||||
return help();
|
return help();
|
||||||
@ -66,20 +95,7 @@ exports = module.exports = function (args) {
|
|||||||
|
|
||||||
//--------------------------------------------------------------------
|
//--------------------------------------------------------------------
|
||||||
|
|
||||||
var help = exports.help = wrap(multiline.stripIndent(function () {/*
|
exports.help = help;
|
||||||
Usage:
|
|
||||||
|
|
||||||
xo-cli --register [<XO-Server URL>] [<username>] [<password>]
|
|
||||||
Registers the XO instance to use.
|
|
||||||
|
|
||||||
xo-cli --list-commands [--json]
|
|
||||||
Returns the list of available commands on the current XO instance.
|
|
||||||
|
|
||||||
xo-cli <command> [<name>=<value>]...
|
|
||||||
Executes a command on the current XO instance.
|
|
||||||
*/}));
|
|
||||||
|
|
||||||
exports.version = wrap('xo-cli v'+ require('../package').version);
|
|
||||||
|
|
||||||
exports.register = function (args) {
|
exports.register = function (args) {
|
||||||
var xo;
|
var xo;
|
||||||
|
Loading…
Reference in New Issue
Block a user