From c6c9f4f5a837bea16609b1d430e6c20687f3742b Mon Sep 17 00:00:00 2001 From: "Alex Lam S.L" Date: Sun, 28 May 2017 18:21:44 +0800 Subject: implement `--help options` (#2017) --- bin/uglifyjs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bin') diff --git a/bin/uglifyjs b/bin/uglifyjs index 158dc571..b9406e1c 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -25,6 +25,18 @@ program.version(info.name + ' ' + info.version); program.parseArgv = program.parse; program.parse = undefined; if (process.argv.indexOf("ast") >= 0) program.helpInformation = UglifyJS.describe_ast; +else if (process.argv.indexOf("options") >= 0) program.helpInformation = function() { + var text = []; + var options = UglifyJS.default_options(); + for (var option in options) { + text.push("--" + (option == "output" ? "beautify" : option == "sourceMap" ? "source-map" : option) + " options:"); + Object.keys(options[option]).forEach(function(name) { + text.push(" " + name); + }); + text.push(""); + } + return text.join("\n"); +}; program.option("-p, --parse ", "Specify parser options.", parse_js("parse", true)); program.option("-c, --compress [options]", "Enable compressor/specify compressor options.", parse_js("compress", true)); program.option("-m, --mangle [options]", "Mangle names/specify mangler options.", parse_js("mangle", true)); -- cgit v1.2.3