PyGlossary is a tool for working with dictionary databases (glossaries)
<b>Basic Usage:</b>
    <b>Gtk3</b> Interface:
        To open PyGlossary window:
            <b>${CMD}</b>
        PyGI is the default interface (so you never need to use "--ui=gtk" or --gtk option)
        If PyGI was not found (not installed), then PyGlossary will fallback to Tkinter.
    <b>Gtk4</b> Interface:
        To open PyGlossary window:
            <b>${CMD} --gtk4</b>
        Or
            <b>${CMD} --ui=gtk4</b>
    <b>Tkinter</b> Interface:
        To open PyGlossary window:
            <b>${CMD} --tk</b>
        Or
            <b>${CMD} --ui=tk</b>
        Usually good for Windows and Mac OS X
    <b>Tk Wizard</b> (Tkinter wizard):
            <b>${CMD} --ui=tk_wizard</b> or <b>${CMD} --tkw</b>
    <b>Qt 6 wizard</b> Interface (needs PySide6 or PyQt6):
            <b>${CMD} --ui=qt6</b> or <b>${CMD} --ui=qt</b>
        Or shortcuts:
            <b>${CMD} --qt6</b> or <b>${CMD} --qt</b>
    <b>Web</b> Interface:
        To open PyGlossary window:
            <b>${CMD} --web</b>
        Or
            <b>${CMD} --ui=web</b>
        For OS's with a modern web browser
    <b>Command-line</b> interface:
        To show this help:
            ${CMD} --help
        To show program version:
            ${CMD} --version
        To Convert:
            ${CMD} <u>INPUT_FILE</u> <u>OUTPUT_FILE</u>
        To Reverse:
            ${CMD} <u>INPUT_FILE</u> <u>OUTPUT_FILE</u>.txt --reverse
        Input and output formats will be detected from extensions if possible.
        If not, you need to specify input or output format, for example:
            ${CMD} test.utf8 test.ifo --read-format=tabfile
            ${CMD} test.utf8 test.ifo --read-format tabfile
            ${CMD} test.ifo test.utf8 --write-format=tabfile
            ${CMD} test.ifo test.utf8 --write-format tabfile

    <b>Interactive command-line</b> interface:
        Minimal command:
            <b>${CMD} --cmd</b>
        Or
            <b>${CMD} --ui=cmd</b>
        Additionally you can pass any flag to act as default
        To force interactive mode (when stdin is a TTY):
            <b>${CMD} --interactive</b> or <b>${CMD} --inter</b>
        To disable automatic switch to interactive mode (for scripts):
            <b>${CMD} --no-interactive</b> or <b>${CMD} --no-inter</b>


<b>General Options:</b>
    Verbosity:
        <b>-v0</b> or '--verbosity 0' for critical errors only
        <b>-v1</b> or '--verbosity 1' for errors only
        <b>-v2</b> or '--verbosity 2' for errors and warnings
        <b>-v3</b> or '--verbosity 3' for errors, warnings and info
        <b>-v4</b> or '--verbosity 4' for debug mode
        <b>-v5</b> or '--verbosity 5' for trace mode
    Appearance:
        --no-progress-bar and --no-color, useful for scripts
    Logging:
        --log-time and --no-log-time to show or hide date and time in logs

<b>Full Convert Usage</b>:
    ${CMD} <u>INPUT_FILE</u> <u>OUTPUT_FILE</u> [-v<u>N</u>] [--read-format=<u>FORMAT</u>] [--write-format=<u>FORMAT</u>]
        [--direct|--indirect] [--sqlite|--no-sqlite] [--alts|--no-alts]
        [--sort|--no-sort] [--sort-key=<u>NAME</u>] [--sort-encoding=<u>ENCODING</u>]
        [--utf8-check|--no-utf8-check] [--lower|--no-lower]
        [--skip-resources] [--skip-duplicate-headword]
        [--skip-term-regex=<u>REGEX</u>] [--trim-arabic-diacritics]
        [--rtl] [--remove-html=<u>TAGS</u>] [--remove-html-all] [--normalize-html]
        [--unescape-word-links]
        [-r <u>READ_OPTIONS</u>] [-w <u>WRITE_OPTIONS</u>]
        [--json-read-options=<u>JSON</u>] [--json-write-options=<u>JSON</u>]
        [--source-lang=<u>LANGUAGE</u>] [--target-lang=<u>LANGUAGE</u>]
        ['--name=<u>GLOSSARY NAME</u>'] ['--license=LICENSE NAME'] ['--copyright=COPYRIGHT MESSAGE']
        [--info] [--cleanup|--no-cleanup] [--reverse]

<b>Direct and indirect modes</b>
    Indirect mode means the input glossary is completely read and loaded into RAM, then converted
    into the output format. This was the only method available in old versions (before 3.0.0).
    Direct mode means entries are one-at-a-time read, processed and written into the output
    glossary. Direct mode was added to limit the memory usage for large glossaries; But it
    may reduce the conversion time for most cases as well.
    Converting glossaries into some formats like StarDict and EPUB-2 requires sorting entries.
    That's why direct mode will not work for these format, and PyGlossary will use indirect
    mode. Otherwise direct mode will be the default. You may override this by --indirect flag.


<b>SQLite mode</b>:
    As mentioned above, converting glossaries into some formats like StarDict will need
    them to loaded into RAM.
    This can be problematic if the glossary is too big to fit into RAM. That's when
    you should try adding --sqlite flag to your command. Then it uses SQLite as intermediate
    storage for sorting then fetching entries. This fixes the memory issue, and may even
    reduce running time of conversion (depending on your home directory storage).
    PyGlossary may also auto-enable SQLite mode when direct mode is not possible (see
    auto_sqlite in config.json). Use --no-sqlite to disable SQLite mode entirely.
    The temporary SQLite file is stored in ~/.cache/pyglossary/ then deleted after
    conversion, unless you pass --no-cleanup flag.
    Currently you can not disable alternates in SQLite mode (--no-alts is ignored).


<b>Read and write options</b>:
    Use -r/--read-options and -w/--write-options to pass format-specific options.
    Options are semicolon-separated key=value pairs, for example:
        ${CMD} in.txt out.ifo -w "enable=true; foo=bar"
    If a value contains semicolons, use --json-read-options or --json-write-options
    with a JSON object instead, for example:
        ${CMD} in.csv out.txt --json-write-options='{"delimiter": ";"}'


<b>Sorting</b>:
    Some output formats require sorted entries. Use --sort to force sorting, or --no-sort
    to disable it. When --sort is used, you may also pass:
        --sort-key=NAME       sort key name (default: headword_lower)
        --sort-encoding=ENC   encoding used for sorting (default: utf-8)
    Supported sort key names include: headword, headword_lower, headword_bytes_lower,
    stardict, ebook, ebook_length3, dicformids, random. Locale-specific sorting is also
    supported with NAME:LOCALE syntax, for example headword_lower:en_US.


<b>Entry filters</b>:
    These flags transform or skip entries during conversion:
        --utf8-check / --no-utf8-check   fix Unicode in terms and definitions
        --lower / --no-lower             lowercase terms
        --skip-resources                 skip resource/data entries (images, audio, css, etc)
        --skip-duplicate-headword        skip entries with a duplicate headword
        --skip-term-regex=REGEX          skip entries whose term fully matches REGEX
        --trim-arabic-diacritics         trim Arabic diacritics from headword
        --rtl                            wrap definition in a right-to-left div
        --remove-html=TAGS               remove comma-separated HTML tags from definition
        --remove-html-all                remove all HTML tags from definition
        --normalize-html                 normalize HTML tags in definition (WIP)
        --unescape-word-links            unescape Term/Entry links in definitions
    --skip-term-regex examples:
        ${CMD} input.txt output.txt --skip-term-regex='skip'
        ${CMD} input.txt output.txt --skip-term-regex='skip-.*'
        ${CMD} input.txt output.txt --skip-term-regex='[0-9]+'
    See doc/entry-filters.md and doc/config.rst for all entry filter options.


<b>Other conversion options</b>:
    --info                   save a .info JSON file alongside output file(s)
    --alts / --no-alts       enable or disable alternate terms (synonyms)
    --cleanup / --no-cleanup delete or keep cache/temporary files after conversion
    --reverse                reverse source and target languages in definitions


Command line arguments and options (and arguments for options) is parsed with GNU getopt method

Compressing with gz, bz2 and zip is supported.
Just append these extension to the file name, for example:
    ${CMD} mydic.ifo mydic.txt.gz
And if the input file has these extensions (gz, bz2, zip), it will be extracted before loading

