From 2ef1ad0bf61dd206a0da5ddfe5770c1119af9dc5 Mon Sep 17 00:00:00 2001 From: Jeremy Morton Date: Fri, 23 Sep 2016 17:40:36 +0100 Subject: [PATCH] Suppress param data type being output on --help --- cli.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/cli.js b/cli.js index aefaef5..0aa623b 100644 --- a/cli.js +++ b/cli.js @@ -83,12 +83,13 @@ if (process.env.NODE_DISABLE_COLORS || process.env.TERM === 'dumb') { * The 'help' plugin is enabled by default. */ var enable = { - help: true, //Adds -h, --help - version: false, //Adds -v,--version => gets version by parsing a nearby package.json - status: false, //Adds -k,--no-color & --debug => display plain status messages /display debug messages - timeout: false, //Adds -t,--timeout N => timeout the process after N seconds - catchall: false, //Adds -c,--catch => catch and output uncaughtExceptions - glob: false //Adds glob matching => use cli.glob(arg) + help: true, //Adds -h, --help + version: false, //Adds -v,--version => gets version by parsing a nearby package.json + status: false, //Adds -k,--no-color & --debug => display plain status messages /display debug messages + timeout: false, //Adds -t,--timeout N => timeout the process after N seconds + catchall: false, //Adds -c,--catch => catch and output uncaughtExceptions + glob: false, //Adds glob matching => use cli.glob(arg) + suppresshelptype: false //Adds the suppression of type display in --help output } cli.enable = function (/*plugins*/) { Array.prototype.slice.call(arguments).forEach(function (plugin) { @@ -105,6 +106,9 @@ cli.enable = function (/*plugins*/) { case 'glob': cli.glob = require('glob'); break; + case 'suppresshelptype': + cli.suppresshelptype = true; + break; default: cli.fatal('Unknown plugin "' + plugin + '"'); break; @@ -617,7 +621,7 @@ cli.getUsage = function (code) { } line += ' '; - if (type) { + if (!cli.suppresshelptype && type) { if (type instanceof Array) { desc += '. VALUE must be either [' + type.join('|') + ']'; type = 'VALUE';