From 2f5806bb448b3c71d814c2a16cfdda196f952be2 Mon Sep 17 00:00:00 2001 From: Saeed Rasooli Date: Sat, 25 Dec 2021 13:01:08 +0330 Subject: [PATCH] add --name flag for changing glossary name --- help | 1 + pyglossary/ui/main.py | 8 ++++++++ pyglossary/ui/ui_cmd_interactive.py | 1 + 3 files changed, 10 insertions(+) diff --git a/help b/help index da46125fd..fb1699f8a 100644 --- a/help +++ b/help @@ -53,6 +53,7 @@ PyGlossary is a tool for working with dictionary databases (glossaries) [--utf8-check|--no-utf8-check] [--lower|--no-lower] [--read-options=READ_OPTIONS] [--write-options=WRITE_OPTIONS] [--source-lang=LANGUAGE] [--target-lang=LANGUAGE] + ['--name=GLOSSARY NAME'] Direct and indirect modes Indirect mode means the input glossary is completely read and loaded into RAM, then converted diff --git a/pyglossary/ui/main.py b/pyglossary/ui/main.py index 0b64e140d..7c6962223 100644 --- a/pyglossary/ui/main.py +++ b/pyglossary/ui/main.py @@ -368,6 +368,13 @@ def main(): default=None, help="target/definition language", ) + parser.add_argument( + "--name", + action="store", + dest="name", + default=None, + help="glossary name/title", + ) # _______________________________ @@ -514,6 +521,7 @@ def shouldUseCMD(args): infoOverrideSpec = ( ("sourceLang", validateLangStr), ("targetLang", validateLangStr), + ("name", str), ) config = {} diff --git a/pyglossary/ui/ui_cmd_interactive.py b/pyglossary/ui/ui_cmd_interactive.py index 4aa94964b..13c1bcbb8 100644 --- a/pyglossary/ui/ui_cmd_interactive.py +++ b/pyglossary/ui/ui_cmd_interactive.py @@ -166,6 +166,7 @@ def _(event: "E") -> None: infoOverrideFlags = { "sourceLang": "source-lang", "targetLang": "target-lang", + "name": "name", }