Add --version flag to print atom-shell's version.

This commit is contained in:
Cheng Zhao 2013-10-03 11:36:17 +08:00
parent 7f7e13edc3
commit 0483871388

View file

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