Skip to content

Commit

Permalink
Minor tweaks to the CLI options
Browse files Browse the repository at this point in the history
Notably, all options are "global" by default, so there's no need to specify that.
  • Loading branch information
domenic committed Jan 2, 2025
1 parent 030e31f commit 1069ca7
Showing 1 changed file with 16 additions and 21 deletions.
37 changes: 16 additions & 21 deletions lib/worm-scraper.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,49 +14,44 @@ const zip = require("./zip.js");
const OUTPUT_DEFAULT = "(Book name).epub";

const { argv } = yargs
.usage(`${packageJson.description}\n\n${packageJson.name} [<command1> [<command2> [<command3> ...]]]\n\n` +
.usage(`${packageJson.description}\n\n${packageJson.name}[ <command1> [<command2> [<command3> ...]]]\n\n` +
"Each command will fail if the previously-listed one has not yet been run (with matching options).\n\n" +
"Running with no commands is equivalent to running download convert scaffold zip.")
.command("download", "download all chapters into the cache")
.command("convert", "convert the raw HTML into cleaned-up ebook chapters")
.command("scaffold", "assemble the table of contents, etc.")
.command("zip", "zip up the created files into a .epub output")
.command("download", "Download all chapters into the cache")
.command("convert", "Convert the raw HTML into cleaned-up ebook chapters")
.command("scaffold", "Assemble the table of contents, etc.")
.command("zip", "Zip up the created files into a .epub output")
.option("b", {
alias: "book",
default: Object.keys(books)[0],
describe: "the book to operate on",
choices: Object.keys(books),
requiresArg: true,
global: true
default: Object.keys(books)[0],
describe: "The book to operate on",
requiresArg: true
})
.option("c", {
alias: "cache",
default: "cache",
describe: "cache directory for downloaded raw chapters",
requiresArg: true,
global: true
describe: "Cache directory for downloaded raw chapters",
requiresArg: true
})
.option("s", {
alias: "staging",
default: "staging",
describe: "directory in which to assemble the EPUB files",
requiresArg: true,
global: true
describe: "Directory in which to assemble the EPUB files",
requiresArg: true
})
.option("o", {
alias: "out",
default: OUTPUT_DEFAULT,
describe: "output file destination",
requiresArg: true,
global: true
describe: "Output file destination",
requiresArg: true
})
.option("j", {
alias: "jobs",
default: undefined,
defaultDescription: "# of CPU cores - 1",
describe: "number of concurrent read/write conversion jobs",
requiresArg: true,
global: true
describe: "Number of concurrent read/write conversion jobs",
requiresArg: true
})
.recommendCommands()
.help()
Expand Down

0 comments on commit 1069ca7

Please sign in to comment.