Add --version flag to print atom-shell's version.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 3 Oct 2013 03:36:17 +0000 (11:36 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 3 Oct 2013 03:36:17 +0000 (11:36 +0800)
browser/default_app/main.js

index 4ca183f..1db036e 100644 (file)
@@ -1,5 +1,4 @@
 var app = require('app');
-var argv = require('optimist').argv;
 var dialog = require('dialog');
 var path = require('path');
 
@@ -9,6 +8,9 @@ app.on('window-all-closed', function() {
     app.quit();
 });
 
+process.argv.splice(1, 0, 'dummyScript');
+var argv = require('optimist').argv;
+
 // Start the specified app if there is one specified in command line, otherwise
 // start the default app.
 if (argv._.length > 0) {
@@ -23,6 +25,9 @@ if (argv._.length > 0) {
       throw e;
     }
   }
+} else if (argv.version) {
+  console.log(process.versions['atom-shell']);
+  process.exit(0);
 } else {
   require('./default_app.js');
 }