display default values in --help options (#2018)
This commit is contained in:
@@ -45,6 +45,7 @@ a double dash to prevent input files being used as option arguments:
|
|||||||
|
|
||||||
```
|
```
|
||||||
-h, --help Print usage information.
|
-h, --help Print usage information.
|
||||||
|
`--help options` for details on available options.
|
||||||
-V, --version Print version number.
|
-V, --version Print version number.
|
||||||
-p, --parse <options> Specify parser options:
|
-p, --parse <options> Specify parser options:
|
||||||
`acorn` Use Acorn for parsing.
|
`acorn` Use Acorn for parsing.
|
||||||
@@ -713,14 +714,14 @@ UglifyJS.minify(code, { mangle: { toplevel: true } }).code;
|
|||||||
|
|
||||||
### Mangle properties options
|
### Mangle properties options
|
||||||
|
|
||||||
- `reserved` (default: `[]`) -- Do not mangle property names listed in the
|
- `reserved` (default: `[]`) -- Do not mangle property names listed in the
|
||||||
`reserved` array.
|
`reserved` array.
|
||||||
- `regex` (default: `null`) -— Pass a RegExp literal to only mangle property
|
- `regex` (default: `null`) -— Pass a RegExp literal to only mangle property
|
||||||
names matching the regular expression.
|
names matching the regular expression.
|
||||||
- `keep_quoted` (default: `false`) -— Only mangle unquoted property names.
|
- `keep_quoted` (default: `false`) -— Only mangle unquoted property names.
|
||||||
- `debug` (default: `false`) -— Mangle names with the original name still present.
|
- `debug` (default: `false`) -— Mangle names with the original name still present.
|
||||||
Pass an empty string `""` to enable, or a non-empty string to set the debug suffix.
|
Pass an empty string `""` to enable, or a non-empty string to set the debug suffix.
|
||||||
- `builtins` (default: `false`) -- Use `true` to allow the mangling of builtin
|
- `builtins` (default: `false`) -- Use `true` to allow the mangling of builtin
|
||||||
DOM properties. Not recommended to override this setting.
|
DOM properties. Not recommended to override this setting.
|
||||||
|
|
||||||
## Output options
|
## Output options
|
||||||
|
|||||||
11
bin/uglifyjs
11
bin/uglifyjs
@@ -21,7 +21,7 @@ var options = {
|
|||||||
compress: false,
|
compress: false,
|
||||||
mangle: false
|
mangle: false
|
||||||
};
|
};
|
||||||
program.version(info.name + ' ' + info.version);
|
program.version(info.name + " " + info.version);
|
||||||
program.parseArgv = program.parse;
|
program.parseArgv = program.parse;
|
||||||
program.parse = undefined;
|
program.parse = undefined;
|
||||||
if (process.argv.indexOf("ast") >= 0) program.helpInformation = UglifyJS.describe_ast;
|
if (process.argv.indexOf("ast") >= 0) program.helpInformation = UglifyJS.describe_ast;
|
||||||
@@ -30,8 +30,13 @@ else if (process.argv.indexOf("options") >= 0) program.helpInformation = functio
|
|||||||
var options = UglifyJS.default_options();
|
var options = UglifyJS.default_options();
|
||||||
for (var option in options) {
|
for (var option in options) {
|
||||||
text.push("--" + (option == "output" ? "beautify" : option == "sourceMap" ? "source-map" : option) + " options:");
|
text.push("--" + (option == "output" ? "beautify" : option == "sourceMap" ? "source-map" : option) + " options:");
|
||||||
Object.keys(options[option]).forEach(function(name) {
|
var defs = options[option];
|
||||||
text.push(" " + name);
|
var padding = "";
|
||||||
|
Object.keys(defs).map(function(name) {
|
||||||
|
if (padding.length < name.length) padding = Array(name.length + 1).join(" ");
|
||||||
|
return [ name, JSON.stringify(defs[name]) ];
|
||||||
|
}).forEach(function(tokens) {
|
||||||
|
text.push(" " + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]);
|
||||||
});
|
});
|
||||||
text.push("");
|
text.push("");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user