aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMihai Bazon <mihai.bazon@gmail.com>2013-01-03 02:28:35 -0800
committerMihai Bazon <mihai.bazon@gmail.com>2013-01-03 02:28:35 -0800
commit47c9895d591f2b83259302416663cd0ed44b26eb (patch)
tree9b5cd2eda17d3b234123ba486c97cdb1661dea90
parent83a4ebfedcd920871e583ef61151524b2d57b789 (diff)
parentba403331c556598138946185042eb3ea917cf676 (diff)
downloadtracifyjs-47c9895d591f2b83259302416663cd0ed44b26eb.tar.gz
tracifyjs-47c9895d591f2b83259302416663cd0ed44b26eb.zip
Merge pull request #87 from BenoitZugmeyer/master
Add a --version option
-rw-r--r--README.md1
-rwxr-xr-xbin/uglifyjs9
2 files changed, 10 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4840c741..20676bd5 100644
--- a/README.md
+++ b/README.md
@@ -79,6 +79,7 @@ The available options are:
--export-all Only used when --wrap, this tells UglifyJS to add code to
automatically export all globals. [boolean]
-v, --verbose Verbose [boolean]
+ -V, --version Print version number and exits. [boolean]
Specify `--output` (`-o`) to declare the output file. Otherwise the output
goes to STDOUT.
diff --git a/bin/uglifyjs b/bin/uglifyjs
index 1706629c..e6ecb91a 100755
--- a/bin/uglifyjs
+++ b/bin/uglifyjs
@@ -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("lint", "Display some scope warnings")
.describe("v", "Verbose")
+ .describe("V", "Print version number and exit.")
.alias("p", "prefix")
.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("d", "define")
.alias("r", "reserved")
+ .alias("V", "version")
.string("source-map")
.string("source-map-root")
@@ -74,6 +76,7 @@ You need to pass an argument to this option to specify the name that your module
.boolean("acorn")
.boolean("spidermonkey")
.boolean("lint")
+ .boolean("V")
.wrap(80)
@@ -82,6 +85,12 @@ You need to pass an argument to this option to specify the name that your module
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) {
var desc = UglifyJS.describe_ast();
sys.puts(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));