From 0e14bf4f8fb59c099892ce5d0c197755622d62a7 Mon Sep 17 00:00:00 2001 From: gardenapple Date: Fri, 15 Oct 2021 19:31:01 +0300 Subject: [PATCH] Make --help shorter thanks to man page; remove 'no-op' --- index.js | 25 ++----------------------- locales/en.json | 17 +---------------- locales/fr.json | 18 +----------------- locales/ru.json | 17 +---------------- 4 files changed, 5 insertions(+), 72 deletions(-) diff --git a/index.js b/index.js index 5778dcf..0de1ba0 100755 --- a/index.js +++ b/index.js @@ -210,6 +210,7 @@ let args = yargs alias: 'l', type: "string", desc: __`What to do if Readability.js is uncertain about what the core content actually is`, + choices: ["keep", "force", "exit"] //default: "no-op", //don't set default because completion won't work }) .option("keep-classes", { @@ -262,25 +263,7 @@ let args = yargs type: "boolean", desc: __`Print version` }) - .epilogue(__`The --low-confidence option determines what should be done for documents where Readability can't tell what the core content is:\n` + -__` keep When unsure, don't touch the HTML, output as-is. This is incompatible with the --properties and --json options.\n` + -__` force Process the document even when unsure (may produce really bad output).\n` + -__` exit When unsure, exit with an error.\n` + - '\n' + -__`Default value is "keep".\n` + - '\n' + - '\n' + -__`The --properties option accepts a list of values, separated by spaces. Suitable values are:\n` + -__` title The title of the article.\n` + -__` html-title The title of the article, wrapped in an

tag.\n` + -__` excerpt Article description, or short excerpt from the content.\n` + -__` byline Data about the page's author.\n` + -__` length Length of the article in characters.\n` + -__` dir Text direction, is either "ltr" for left-to-right or "rtl" for right-to-left.\n` + -__` text-content Output the article's main content as plain text.\n` + -__` html-content Output the article's main content as an HTML body.\n` + - '\n' + -__`Properties are printed line by line, in the order specified by the user. Only "text-content" and "html-content" is printed as multiple lines.\n`) + .epilogue(__`See the manual for more info: man readable`) .wrap(Math.min(yargs.terminalWidth(), 100)) .strict() .parse(); @@ -320,10 +303,6 @@ if (args["keep-classes"]) { if (!args["low-confidence"]) { args["low-confidence"] = LowConfidenceMode.keep; args['l'] = LowConfidenceMode.keep; -} else if (args["low-confidence"] == "no-op") { - console.error(__`Note: no-op option is deprecated, please use 'keep' instead.`); - args["low-confidence"] = LowConfidenceMode.keep; - args['l'] = LowConfidenceMode.keep; } else if (!Object.values(LowConfidenceMode).includes(args["low-confidence"])) { console.error(__`Unknown mode: ${args["low-confidence"]}\nPlease use one of: keep, force, exit`); console.error(__`Use --help for more info.`); diff --git a/locales/en.json b/locales/en.json index 024ad47..25160a6 100644 --- a/locales/en.json +++ b/locales/en.json @@ -19,21 +19,6 @@ "(deprecated) Interpret SOURCE as a URL rather than file name": "(deprecated) Interpret SOURCE as a URL rather than file name", "Preserve all CSS classes for input elements, instead of adapting to Firefox's Reader Mode": "Preserve all CSS classes for input elements, instead of adapting to Firefox's Reader Mode", "Output properties as a JSON payload": "Output properties as a JSON payload", - "The --low-confidence option determines what should be done for documents where Readability can't tell what the core content is:\n": "The --low-confidence option determines what should be done for documents where Readability can't tell what the core content is:\n", - " keep When unsure, don't touch the HTML, output as-is. This is incompatible with the --properties and --json options.\n": " keep When unsure, don't touch the HTML, output as-is. This is incompatible with the --properties and --json options.\n", - " force Process the document even when unsure (may produce really bad output).\n": " force Process the document even when unsure (may produce really bad output).\n", - " exit When unsure, exit with an error.\n": " exit When unsure, exit with an error.\n", - "Default value is \"keep\".\n": "Default value is \"keep\".\n", - "The --properties option accepts a list of values, separated by spaces. Suitable values are:\n": "The --properties option accepts a list of values, separated by spaces. Suitable values are:\n", - " title The title of the article.\n": " title The title of the article.\n", - " html-title The title of the article, wrapped in an

tag.\n": " html-title The title of the article, wrapped in an

tag.\n", - " excerpt Article description, or short excerpt from the content.\n": " excerpt Article description, or short excerpt from the content.\n", - " byline Data about the page's author.\n": " byline Data about the page's author.\n", - " length Length of the article in characters.\n": " length Length of the article in characters.\n", - " dir Text direction, is either \"ltr\" for left-to-right or \"rtl\" for right-to-left.\n": " dir Text direction, is either \"ltr\" for left-to-right or \"rtl\" for right-to-left.\n", - " text-content Output the article's main content as plain text.\n": " text-content Output the article's main content as plain text.\n", - " html-content Output the article's main content as an HTML body.\n": " html-content Output the article's main content as an HTML body.\n", - "Properties are printed line by line, in the order specified by the user. Only \"text-content\" and \"html-content\" is printed as multiple lines.\n": "Properties are printed line by line, in the order specified by the user. Only \"text-content\" and \"html-content\" is printed as multiple lines.\n", "No input provided": "No input provided.", "Note: --is-url option is deprecated.": "Note: --is-url option is deprecated.", "Note: --url option is deprecated, please use --base instead.": "Note: --url option is deprecated, please use --base instead.", @@ -49,5 +34,5 @@ "Host not found: '%s'": "Host not found: '%s'", "Unknown mode: %s\nPlease use one of: keep, force, exit": "Unknown mode: %s\nPlease use one of: keep, force, exit", "Use --help for more info.": "Use --help for more info.", - "Note: no-op option is deprecated, please use 'keep' instead.": "Note: no-op option is deprecated, please use 'keep' instead." + "See the manual for more info: man readable": "See the manual for more info: man readable" } diff --git a/locales/fr.json b/locales/fr.json index c1ac175..680fc38 100644 --- a/locales/fr.json +++ b/locales/fr.json @@ -18,21 +18,6 @@ "Interpret SOURCE as a file name rather than a URL": "Interpréter SOURCE comme un nom de fichier plutôt qu'une URL", "(deprecated) Interpret SOURCE as a URL rather than file name": "(obsolète) Interpréter SOURCE comme une URL plutôt que comme un nom de fichier", "Output properties as a JSON payload": "Sort les propriétés en tant que JSON", - "The --low-confidence option determines what should be done for documents where Readability can't tell what the core content is:\n": "L'option --low-confidence détermine ce qui doit être fait pour les documents où Readability ne peut deviner le contenu principal:\n", - " keep When unsure, don't touch the HTML, output as-is. This is incompatible with the --properties and --json options.\n": " keep En cas de doute, ne pas toucher le HTML, sortir tel quel. Ceci est incompatible avec les options --properties et --json.\n", - " force Process the document even when unsure (may produce really bad output).\n": " force Traite le document même en cas de doute (peut produire une sortie vraiment mauvaise).\n", - " exit When unsure, exit with an error.\n": " exit En cas de doute, quitte avec une erreur.\n", - "Default value is \"keep\".\n": "La valeur par défaut est \"keep\".\n", - "The --properties option accepts a list of values, separated by spaces. Suitable values are:\n": "L'option --properties accepte une liste de valeurs, séparées par des espaces. Les valeurs appropriées sont:\n", - " title The title of the article.\n": " title Le titre de l'article.\n", - " html-title The title of the article, wrapped in an

tag.\n": " html-title Le titre de l'article, entouré d'une balise

.\n", - " excerpt Article description, or short excerpt from the content.\n": " excerpt Description de l'article ou court extrait du contenu.\n", - " byline Data about the page's author.\n": " byline Données sur l'auteur de la page.\n", - " length Length of the article in characters.\n": " length Longueur de l'article en caractères.\n", - " dir Text direction, is either \"ltr\" for left-to-right or \"rtl\" for right-to-left.\n": " dir La direction du texte, est soit \"ltr\" pour la gauche vers la droite ou \"rtl\" pour la droite vers la gauche.\n", - " text-content Output the article's main content as plain text.\n": " text-content Affiche le contenu principal de l'article sous forme de texte brut.\n", - " html-content Output the article's main content as an HTML body.\n": " html-content Affiche le contenu principal de l'article sous forme de corps HTML.\n", - "Properties are printed line by line, in the order specified by the user. Only \"text-content\" and \"html-content\" is printed as multiple lines.\n": "Les propriétés sont imprimées ligne par ligne, dans l'ordre spécifié par l'utilisateur. Seuls \"text-content\" et \"html-content\" sont imprimés sur plusieurs lignes.\n ", "No input provided": "Aucune entrée fournie.", "Note: --is-url option is deprecated.": "Remarque: l'option --is-url est obsolète.", "Note: --url option is deprecated, please use --base instead.": "Remarque: l'option --is-url est obsolète, veuillez utiliser --base à la place", @@ -47,6 +32,5 @@ "Couldn't process document.": "Impossible de traiter le document.", "Host not found: '%s'": "Hôte introuvable: '%s'", "Unknown mode: %s\nPlease use one of: keep, force, exit": "Mode inconnu: %s\nVeuillez utiliser l'un des éléments suivants: keep (conserver), force (forcer), exit (quitter)", - "Use --help for more info.": "Utilisez --help pour plus d'informations.", - "Note: no-op option is deprecated, please use 'keep' instead.": "Remarque: l'option no-op est obsolète, veuillez utiliser 'keep' à la place." + "Use --help for more info.": "Utilisez --help pour plus d'informations." } diff --git a/locales/ru.json b/locales/ru.json index 083797a..23e45ff 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -19,21 +19,6 @@ "(deprecated) Interpret SOURCE as a URL rather than file name": "(устаревшее) Интерпретировать [source] как URL, а не как файл", "Preserve all CSS classes for input elements, instead of adapting to Firefox's Reader Mode": "Оставить все CSS классы для входных элементов, и не адаптироваться под режим читателя в Firefox", "Output properties as a JSON payload": "Показать характеристики текста в формате JSON", - "The --low-confidence option determines what should be done for documents where Readability can't tell what the core content is:\n": "Параметр --low-confidence определяет, что следует делать, если Readability не может определить целевой контент:\n", - " keep When unsure, don't touch the HTML, output as-is. This is incompatible with the --properties and --json options.\n": " keep В случае неуверенности, не трогать HTML, выдавать как есть. Не совместимо с параметрами --properties и --json.\n", - " force Process the document even when unsure (may produce really bad output).\n": " force Обработать документ даже в случае неуверенности (может выдать плохой результат).\n", - " exit When unsure, exit with an error.\n": " exit В случае неуверенности, выдать ошибку и выйти.\n", - "Default value is \"keep\".\n": "По умолчанию выполняется \"keep\".\n", - "The --properties option accepts a list of values, separated by spaces. Suitable values are:\n": "Параметр --properties принимает список значений (разделённых пробелами):\n", - " title The title of the article.\n": " title Заголовок статьи.\n", - " html-title The title of the article, wrapped in an

tag.\n": " html-title Заголовок статьи в тэге

.\n", - " excerpt Article description, or short excerpt from the content.\n": " excerpt Описание контента, или краткий урывок из статьи.\n", - " byline Data about the page's author.\n": " byline Данные об авторе статьи.\n", - " length Length of the article in characters.\n": " length Длинна статьи (количество символов).\n", - " dir Text direction, is either \"ltr\" for left-to-right or \"rtl\" for right-to-left.\n": " dir Направление текста: \"ltr\" если слева направо\", \"rtl\" если справа налево.\n", - " text-content Output the article's main content as plain text.\n": " text-content Вывести главный контент страницы в виде обычного текста.\n", - " html-content Output the article's main content as an HTML body.\n": " html-content Вывести главный контент страницы в виде HTML .\n", - "Properties are printed line by line, in the order specified by the user. Only \"text-content\" and \"html-content\" is printed as multiple lines.\n": "Эти данные выводятся в том порядке, который указал пользователь. Всё, кроме \"text-content\" и \"html-content\", выводится как одна строка.\n", "No input provided": "Данные не введены.", "Note: --is-url option is deprecated.": "Внимание: параметр --is-url устаревший.", "Note: --url option is deprecated, please use --base instead.": "Внимание: параметр --url устаревший, используйте вместо него --base.", @@ -49,5 +34,5 @@ "Host not found: '%s'": "Сервер не найден: '%s'", "Unknown mode: %s\nPlease use one of: keep, force, exit": "Неизвестный режим: %s\nПожалуйста, используйте один из: keep, force, exit", "Use --help for more info.": "Чтобы узнать больше, воспользуйтесь --help", - "Note: no-op option is deprecated, please use 'keep' instead.": "Внимание: параметр no-op устаревшый, используйте вместо него 'keep'." + "See the manual for more info: man readable": "Чтобы узнать больше, загляните в мануал: man readable" }