diff options
| author | Michael Williamson <mike@zwobble.org> | 2014-03-18 16:49:36 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2014-03-18 16:49:36 +0000 |
| commit | ccdf6f46ae285469ac5ef75e3590bdd7e2e81ec4 (patch) | |
| tree | abcdc24e2813eaceae55699f11e7fc8a3cfa85c1 | |
| parent | 8c78bde5725c3442f3b5c9a470615a2fde902e5b (diff) | |
Use nomnom instead of optimist
| -rwxr-xr-x | bin/mammoth | 16 | ||||
| -rw-r--r-- | lib/main.js | 6 | ||||
| -rw-r--r-- | package.json | 4 |
3 files changed, 20 insertions, 6 deletions
diff --git a/bin/mammoth b/bin/mammoth index d8bff0e..16515f1 100755 --- a/bin/mammoth +++ b/bin/mammoth @@ -1,6 +1,18 @@ #!/usr/bin/env node -var optimist = require("optimist"); +var args = require("nomnom") + .option("docx-path", { + position: 0, + required: true, + type: "string", + help: "Path to the .docx file to convert." + }) + .option("output-path", { + position: 1, + type: "string", + help: "Output path for the generated HTML. Output is written to stdout if not set." + }) + .parse(); var main = require("../lib/main"); -main(optimist.argv); +main(args); diff --git a/lib/main.js b/lib/main.js index 0ef9c12..3493eba 100644 --- a/lib/main.js +++ b/lib/main.js @@ -3,9 +3,11 @@ var fs = require("fs"); var mammoth = require("./"); function main(argv) { - mammoth.convertToHtml({path: argv._[0]}) + var docxPath = argv["docx-path"]; + var outputPath = argv["output-path"]; + mammoth.convertToHtml({path: docxPath}) .then(function(result) { - var outputStream = argv._[1] ? fs.createWriteStream(argv._[1]) : process.stdout; + var outputStream = outputPath ? fs.createWriteStream(outputPath) : process.stdout; outputStream.write(result.value); }) diff --git a/package.json b/package.json index f9b3021..32a6482 100644 --- a/package.json +++ b/package.json @@ -20,12 +20,12 @@ "underscore": "~1.4.4", "lop": "~0.2.8", "unzip": "~0.1.7", - "optimist": "~0.3.5", "connect": "~2.7.3", "dustjs-linkedin": "~1.2.1", "async": "~0.2.6", "buffers": "~0.1.1", - "stream-buffers": "~0.2.4" + "stream-buffers": "~0.2.4", + "nomnom": "~1.6.2" }, "devDependencies": { "mocha": "~1.8", |
