Skip to content
This repository

Added --version flag #73

Merged
merged 2 commits into from about 1 year ago

2 participants

Andrew Pennebaker Jeff Kunkle
Andrew Pennebaker

I kept the current version number, so db-migrate --version currently prints like:

$ db-migrate --version
0.3.2
Jeff Kunkle
Owner

It would be nice to use pkginfo (https://github.com/indexzero/node-pkginfo) instead so we don't have to manually sync the version numbers in package.json with index.js. I guarantee I'll forget to do that at some point.

Andrew Pennebaker

Done. And bookmarked for later, that's very useful.

Jeff Kunkle kunklejr merged commit adb4e8c into from February 27, 2013
Jeff Kunkle kunklejr closed this February 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 2 unique commits by 1 author.

Feb 14, 2013
Andrew Pennebaker added --version flag e5fcf23
Andrew Pennebaker pkginfo 8c86bd0
This page is out of date. Refresh to see the latest.
10  bin/db-migrate
@@ -9,6 +9,7 @@ var optimist = require('optimist');
9 9
 var config = require('../lib/config.js');
10 10
 var index = require('../index');
11 11
 var log = require('../lib/log');
  12
+var pkginfo = require('pkginfo')(module, 'version');
12 13
 
13 14
 process.on('uncaughtException', function(err) {
14 15
   log.error(err.stack);
@@ -45,11 +46,20 @@ var argv = optimist
45 46
     .alias('h', '?')
46 47
     .boolean('h')
47 48
 
  49
+    .describe('version', 'Print version info.')
  50
+    .alias('i', 'version')
  51
+    .boolean('version')
  52
+
48 53
     .describe('config', 'Location of the database.json file.')
49 54
     .string('config')
50 55
 
51 56
     .argv;
52 57
 
  58
+if (argv.version) {
  59
+  console.log(module.exports.version);
  60
+  process.exit(0);
  61
+}
  62
+
53 63
 if (argv.help || argv._.length == 0) {
54 64
   optimist.showHelp();
55 65
   process.exit(1);
3  package.json
@@ -42,7 +42,8 @@
42 42
     "async": "~0.1.15",
43 43
     "semver": "~1.0.14",
44 44
     "mkdirp": "~0.3.4",
45  
-    "moment": "~1.7.2"
  45
+    "moment": "~1.7.2",
  46
+    "pkginfo": "~0.3.0"
46 47
   },
47 48
   "devDependencies": {
48 49
     "vows": "~0.6.2",
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.