Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Output version with -v

  • Loading branch information...
commit 4f9593e821e0f626daa24e438c8062f810b5d20a 1 parent e44c3c6
@davglass authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 bin/cli.js
View
14 bin/cli.js
@@ -3,14 +3,26 @@
var cli = require('cli'),
local = require('yui-local');
-cli.enable('status', 'help');
+cli.enable('help');
cli.parse({
+ version: ['v', 'Show app version'],
port: ['p', 'The port number to assign: default 3000', 'number', 3000]
});
+var showVersion = function() {
+ var path = require('path');
+ var meta = require(path.join('../package.json'));
+ var v = meta.version;
+ console.log('v' + v);
+ return v;
+};
+
cli.main(function() {
var opts = this.options;
+ if (opts.version) {
+ return showVersion();
+ }
local.start(opts);
});
Please sign in to comment.
Something went wrong with that request. Please try again.