From 0266552d91ff6f2ae6300754c63dee8dad0d7935 Mon Sep 17 00:00:00 2001 From: moos Date: Wed, 30 May 2012 16:39:31 -0700 Subject: [PATCH] adding CLI, upped version to 0.1.6 --- README.md | 3 ++- bin/wordpos-cli.js | 8 +++++--- package.json | 3 ++- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1d38edc..a54b04d 100644 --- a/README.md +++ b/README.md @@ -219,7 +219,8 @@ See blog article [Optimizing WordPos](http://blog.42at.com/optimizing-wordpos). ## CLI -Version 0.1.6 introduces the command-line interface (./bin/wordpos-cli.js), available as 'wordpos' when using npm install. +Version 0.1.6 introduces the command-line interface (./bin/wordpos-cli.js), available as 'wordpos' if installed globally +"npm install wordpos -g", otherwise as 'node_modules/.bin/wordpos' if installed without the -g. ```bash $ wordpos get The angry bear chased the frightened little squirrel diff --git a/bin/wordpos-cli.js b/bin/wordpos-cli.js index 471e3f5..a19e506 100644 --- a/bin/wordpos-cli.js +++ b/bin/wordpos-cli.js @@ -15,11 +15,14 @@ var program = require('commander'), _ = require('underscore')._, + fs = require('fs'), POS = {noun:'Noun', adj:'Adjective', verb:'Verb', adv:'Adverb'}, - nWords; + version = JSON.parse(fs.readFileSync('../package.json', 'utf8')).version + nWords, + ; program - .version('0.1.0') + .version(version) .usage('[options] [word ... | -i | ]') .option('-n, --noun', 'Get nouns') @@ -52,7 +55,6 @@ program.command('parse') var WordPos = require('../src/wordpos'), - fs = require('fs'), util = require('util'), results = {}, cmd = null; diff --git a/package.json b/package.json index 59af5f7..4117d5c 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "dependencies": { "natural": "latest", "underscore": ">=1.3.1", - "WNdb": "latest" + "WNdb": "latest", + "commander": "latest" }, "devDependencies": { "uubench": "git://github.com/moos/uubench.git"