From d11e241131dcc99c895000244ff86c9d7a2e8650 Mon Sep 17 00:00:00 2001 From: Talon Poole Date: Fri, 19 Feb 2021 19:52:02 +0000 Subject: [PATCH] update --help --- README.md | 30 ++++++++++++------------- cli.js | 66 +++++++++++++++++++++++++++---------------------------- 2 files changed, 46 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index c5ff61d..d635d47 100644 --- a/README.md +++ b/README.md @@ -77,8 +77,21 @@ gmi-web [files..] Convert text/gemini to text/html. +Core: + --body [boolean] + --html, --language, --lang [string] + --css + +HTML: + --author [string] + --descriptions + +Media: + --image [array] + --audio [array] + --video [array] + CSS: - --inline [boolean] --foreground [default: "black"] --background [default: "white"] --body-width [default: "48rem"] @@ -115,21 +128,6 @@ CSS: --quote-height [default: "1.25"] --quote-style [default: "italic"] -Core: - --html, --language, --lang [string] - --body [boolean] - -HTML: - --author [string] - --descriptions [number] [default: 0] - --css [default: "full"] - --dir [string] [choices: "rtl", "ltr"] [default: "ltr"] - -Inline Media: - --image [array] - --audio [array] - --video [array] - Options: --version Show version number [boolean] --config Path to JSON config file diff --git a/cli.js b/cli.js index 76d65cd..ec46781 100755 --- a/cli.js +++ b/cli.js @@ -24,10 +24,16 @@ const cli = yargs(process.argv.slice(2)) .options({ body: { type: "boolean", + group: "Core:", }, html: { type: "string", requiresArg: true, + group: "Core:", + }, + css: { + requiresArg: true, + group: "Core:", }, dir: { type: "string", @@ -35,47 +41,45 @@ const cli = yargs(process.argv.slice(2)) choices: ["rtl", "ltr"], default: "ltr", requiresArg: true, + group: "HTML:", }, author: { type: "string", requiresArg: true, + group: "HTML:", }, descriptions: { - coerce: (arg) => { - return typeof arg === "number" ? arg : arg ? Infinity : 0; - }, - }, - css: { - default: "full", - requiresArg: true, - }, - inline: { - type: "boolean", - hidden: true, - group: "CSS:", - }, - image: { - type: "array", - requiresArg: true, - }, - audio: { - type: "array", - requiresArg: true, - }, - video: { - type: "array", - requiresArg: true, + coerce: (arg) => (typeof arg === "number" ? arg : arg ? Infinity : 0), + group: "HTML:", }, charset: { type: "string", hidden: true, default: "utf-8", requiresArg: true, + group: "HTML:", }, - }) - .group(["html", "body"], "Core:") - .group(["author", "descriptions", "css", "dir"], "HTML:") - .group(["image", "audio", "video"], "Inline Media:"); + image: { + type: "array", + requiresArg: true, + group: "Media:", + }, + audio: { + type: "array", + requiresArg: true, + group: "Media:", + }, + video: { + type: "array", + requiresArg: true, + group: "Media:", + }, + inline: { + type: "boolean", + hidden: true, + group: "CSS:", + }, + }); const CSS_VARS = CSS.rootVariables(CSS.FULL); Object.keys(CSS_VARS).map((key) => { @@ -94,12 +98,6 @@ const argv = cli .showHelpOnFail(true) .help().argv; -if (argv.inline && argv.css === "full") { - cli.showHelp(); - console.error(`\n--inline is not compatible with --css full`); - cli.exit(1); -} - if (!argv.html && !argv.body) { cli.showHelp(); console.error(`\nMissing required argument: --html or --body`);