aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mammoth61
1 files changed, 34 insertions, 27 deletions
diff --git a/bin/mammoth b/bin/mammoth
index 72d2af0..6fddaeb 100755
--- a/bin/mammoth
+++ b/bin/mammoth
@@ -1,31 +1,38 @@
#!/usr/bin/env node
-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 document. Images will be stored inline in the output document. Output is written to stdout if not set."
- })
- .option("output-dir", {
- type: "string",
- help: "Output directory for generated HTML and images. Images will be stored in separate files. Takes precedence over output-path."
- })
- .option("output-format", {
- default: "html",
- choices: ["html", "markdown"],
- help: "Output format."
- })
- .option("style-map", {
- type: "string",
- help: "File containg a style map."
- })
- .parse();
+var ArgumentParser = require("argparse").ArgumentParser;
var main = require("../lib/main");
-main(args);
+var parser = new ArgumentParser({
+ addHelp: true
+});
+
+parser.addArgument(["docx-path"], {
+ type: "string",
+ help: "Path to the .docx file to convert."
+});
+
+var outputGroup = parser.addMutuallyExclusiveGroup();
+outputGroup.addArgument(["output-path"], {
+ type: "string",
+ nargs: "?",
+ help: "Output path for the generated document. Images will be stored inline in the output document. Output is written to stdout if not set."
+});
+outputGroup.addArgument(["--output-dir"], {
+ type: "string",
+ help: "Output directory for generated HTML and images. Images will be stored in separate files. Takes precedence over output-path."
+});
+
+parser.addArgument(["--output-format"], {
+ defaultValue: "html",
+ choices: ["html", "markdown"],
+ help: "Output format."
+});
+
+parser.addArgument(["--style-map"], {
+ type: "string",
+ help: "File containg a style map."
+});
+
+
+main(parser.parseArgs());