Better help formatting and autocompletion

yargs
gardenapple 3 years ago
parent d08103e500
commit 921e6fb206
No known key found for this signature in database
GPG Key ID: CAF17E9ABE789268

@ -144,46 +144,46 @@ let args = yargs
type: "boolean", type: "boolean",
desc: "Print script for bash/zsh completion" desc: "Print script for bash/zsh completion"
}) })
.option('V', { .option("version", {
alias: "version", alias: 'V',
type: "boolean", type: "boolean",
desc: "Print version" desc: "Print version"
}) })
.option('h', { .option("help", {
alias: "help", alias: 'h',
desc: "Show help" desc: "Show help"
}) })
.option('o', { .option("output", {
alias: "output", alias: 'o',
type: "string", type: "string",
desc: "The file to which the result should be output" desc: "The file to which the result should be output"
}) })
.option('l', { .option("low-confidence", {
alias: "low-confidence", alias: 'l',
type: "string", type: "string",
desc: "What to do if Readability.js is uncertain about what the core content actually is", desc: "What to do if Readability.js is uncertain about what the core content actually is",
//default: "no-op", //don't set default because completion won't work //default: "no-op", //don't set default because completion won't work
choices: ["no-op", "force", "exit"] choices: ["no-op", "force", "exit"]
}) })
.option('p', { .option("properties", {
alias: "properties", alias: 'p',
type: "array", type: "array",
desc: "Output specific properties of the parsed article", desc: "Output specific properties of the parsed article",
choices: ["html-title", "title", "excerpt", "byline", "length", "dir", "html-content", "text-content"] choices: ["html-title", "title", "excerpt", "byline", "length", "dir", "html-content", "text-content"]
}) })
.option('q', { .option("quiet", {
alias: "quiet", alias: 'q',
type: "boolean", type: "boolean",
desc: "Don't output extra information to stderr", desc: "Don't output extra information to stderr",
default: false default: false
}) })
.option('u', { .option("url", {
alias: "url", alias: 'u',
type: "string", type: "string",
desc: "Set the document URL when parsing standard input or a local file (this affects relative links)" desc: "Set the document URL when parsing standard input or a local file (this affects relative links)"
}) })
.option('U', { .option("is-url", {
alias: "is-url", alias: 'U',
type: "boolean", type: "boolean",
desc: "Interpret SOURCE as a URL rather than file name" desc: "Interpret SOURCE as a URL rather than file name"
}) })
@ -207,7 +207,7 @@ The --properties option accepts a comma-separated list of values (with no spaces
Text-content and Html-content are mutually exclusive, and are always printed last. Text-content and Html-content are mutually exclusive, and are always printed last.
Default value is "html-title,html-content".`) Default value is "html-title,html-content".`)
.wrap(Math.min(yargs.terminalWidth(), 100)) .wrap(Math.min(yargs.terminalWidth(), 110))
.strict() .strict()
.parse(); .parse();

Loading…
Cancel
Save