diff options
author | Alex Lam S.L <alexlamsl@gmail.com> | 2020-04-18 11:03:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-18 18:03:06 +0800 |
commit | 708973e51d418230918a2d0c2fcafb79d1e1c250 (patch) | |
tree | 65f9de4f3a24071e6171494f32438f20c938e980 /bin | |
parent | dac9e69f9efb491c274670f36301fd38b0ef4dd6 (diff) | |
download | tracifyjs-708973e51d418230918a2d0c2fcafb79d1e1c250.tar.gz tracifyjs-708973e51d418230918a2d0c2fcafb79d1e1c250.zip |
report top-level default options (#3797)
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/uglifyjs | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/bin/uglifyjs b/bin/uglifyjs index 4f84d387..2b02df03 100755 --- a/bin/uglifyjs +++ b/bin/uglifyjs @@ -23,12 +23,29 @@ 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 toplevels = []; + var padding = ""; var options = UglifyJS.default_options(); - for (var option in options) { - text.push("--" + (option == "output" ? "beautify" : option == "sourceMap" ? "source-map" : option) + " options:"); - text.push(format_object(options[option])); - text.push(""); + for (var name in options) { + var option = options[name]; + if (option && typeof option == "object") { + text.push("--" + ({ + output: "beautify", + sourceMap: "source-map", + }[name] || name) + " options:"); + text.push(format_object(option)); + text.push(""); + } else { + if (padding.length < name.length) padding = Array(name.length + 1).join(" "); + toplevels.push([ { + keep_fnames: "keep-fnames", + nameCache: "name-cache", + }[name] || name, option ]); + } } + toplevels.forEach(function(tokens) { + text.push("--" + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]); + }); return text.join("\n"); }; program.option("-p, --parse <options>", "Specify parser options.", parse_js()); |