add --ast-help

displays a rather cruel description of the AST classes, derived
directly from the node definitions.
This commit is contained in:
Mihai Bazon
2012-10-09 13:21:21 +03:00
parent 2c025f23db
commit e1862cd36f
3 changed files with 59 additions and 8 deletions

View File

@@ -78,6 +78,14 @@ You need to pass an argument to this option to specify the name that your module
.argv
;
normalize(ARGS);
if (ARGS.ast_help) {
var desc = UglifyJS.describe_ast();
sys.puts(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));
process.exit(0);
}
if (ARGS.h || ARGS.help) {
sys.puts(optimist.help());
process.exit(0);
@@ -87,8 +95,6 @@ if (ARGS.acorn) {
acorn = require("acorn");
}
normalize(ARGS);
var COMPRESS = getOptions("c");
var MANGLE = getOptions("m");
var BEAUTIFY = getOptions("b");