--version option

This commit is contained in:
Benoît Zugmeyer
2013-01-03 11:06:07 +01:00
parent 83a4ebfedc
commit e82e89d1b0
2 changed files with 9 additions and 0 deletions

View File

@@ -79,6 +79,7 @@ The available options are:
--export-all Only used when --wrap, this tells UglifyJS to add code to --export-all Only used when --wrap, this tells UglifyJS to add code to
automatically export all globals. [boolean] automatically export all globals. [boolean]
-v, --verbose Verbose [boolean] -v, --verbose Verbose [boolean]
-V, --version Print version number and exits. [boolean]
Specify `--output` (`-o`) to declare the output file. Otherwise the output Specify `--output` (`-o`) to declare the output file. Otherwise the output
goes to STDOUT. goes to STDOUT.

View File

@@ -49,6 +49,7 @@ You need to pass an argument to this option to specify the name that your module
.describe("export-all", "Only used when --wrap, this tells UglifyJS to add code to automatically export all globals.") .describe("export-all", "Only used when --wrap, this tells UglifyJS to add code to automatically export all globals.")
.describe("lint", "Display some scope warnings") .describe("lint", "Display some scope warnings")
.describe("v", "Verbose") .describe("v", "Verbose")
.describe("V", "Print version number and exit.")
.alias("p", "prefix") .alias("p", "prefix")
.alias("o", "output") .alias("o", "output")
@@ -58,6 +59,7 @@ You need to pass an argument to this option to specify the name that your module
.alias("c", "compress") .alias("c", "compress")
.alias("d", "define") .alias("d", "define")
.alias("r", "reserved") .alias("r", "reserved")
.alias("V", "version")
.string("source-map") .string("source-map")
.string("source-map-root") .string("source-map-root")
@@ -82,6 +84,12 @@ You need to pass an argument to this option to specify the name that your module
normalize(ARGS); normalize(ARGS);
if (ARGS.version || ARGS.V) {
var json = require("../package.json");
sys.puts(json.name + ' ' + json.version);
process.exit(0);
}
if (ARGS.ast_help) { if (ARGS.ast_help) {
var desc = UglifyJS.describe_ast(); var desc = UglifyJS.describe_ast();
sys.puts(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2)); sys.puts(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));