Skip to content

Commit

Permalink
Fixed version CLI flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
mde committed Mar 25, 2012
1 parent cafcfdf commit f4c6ed7
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions bin/cli.js
Expand Up @@ -9,6 +9,7 @@ var fs = require('fs')
, parseopts = require('../lib/parseopts')
, utils = require('../lib/utils/index')
, App = require('../lib/app.js').App
, pkg = JSON.parse(fs.readFileSync(__dirname + '/../package.json').toString())
, parser
, args = process.argv.slice(2)
, optsReg
Expand All @@ -18,6 +19,8 @@ var fs = require('fs')
, cmd
, filepath;

geddy.version = pkg.version;

usage = ''
+ 'Geddy web framework for Node.js\n'
+ '*********************************************************************************************\n'
Expand All @@ -26,12 +29,12 @@ usage = ''
+ '{Usage}: geddy [options]\n'
+ '\n'
+ '{Options}:\n'
+ ' -e, --environment Evironment config to use\n'
+ ' -p, --port NUM Port number, defaults to 4000\n'
+ ' -n, --workers NUM Number of worker processes to use, defaults to 2\n'
+ ' -V, --version Outputs the version of geddy that you have installed\n'
+ ' -d, --debug sets the log level to output debug messages to the console\n'
+ ' -h, --help Outputs help information\n'
+ ' -e, --environment Evironment config to use\n'
+ ' -p, --port NUM Port number, defaults to 4000\n'
+ ' -n, --workers NUM Number of worker processes to use, defaults to 2\n'
+ ' -V/v, --version Outputs the version of geddy that you have installed\n'
+ ' -d, --debug Sets the log level to output debug messages to the console\n'
+ ' -h, --help Outputs help information\n'
+ '';

optsReg = [
Expand All @@ -47,6 +50,9 @@ optsReg = [
, { full: 'version'
, abbr: 'V'
}
, { full: 'version'
, abbr: 'v'
}
, { full: 'help'
, abbr: 'h'
}
Expand Down Expand Up @@ -122,6 +128,9 @@ var start = function () {
if (typeof opts.help != 'undefined') {
die(usage);
}
else if (typeof opts.version != 'undefined') {
die(geddy.version);
}
else {
// `geddy app foo` or `geddy resource bar` etc. -- run generators
if (cmds.length) {
Expand Down

0 comments on commit f4c6ed7

Please sign in to comment.