Reorder CLI arguments and fix muti-line description #3

Merged
mdk merged 1 commit from :rffontenelle-fix-help-text into master 2025-10-28 23:00:28 +01:00
Contributor

This PR improves the program's help text. It makes argparse honor the spaces and new-line characters in the program's description, and reorder short/long arguments to match argparse: short, and then long.

Before (description line size depends on the terminal's size:

usage: pomerge [-h] [--fuzzy-matching] [--mark-as-fuzzy] [--no-overwrite] [--from-files FROM_FILES [FROM_FILES ...]] [--to-files TO_FILES [TO_FILES ...]]

Replicate known translations between sets of po files. To propagate known translation in a single set of po files, give it as a source and a destination, like: pomerge --from
*.po --to *.po Translations already existing in the destinations po files will be updated by translations from the source po files. To find po files recursively, use the
globstar option of bash, or your shell equivalent, like: shopt -s globstar pomerge --from **/*.po --to **/*.po Giving only --from or only --to works by using a temporary file,
so: pomerge --from a/*.po --to b/*.po is equivalent to: pomerge --from a/*.po pomerge --to b/*.po

options:
  -h, --help            show this help message and exit
  --fuzzy-matching      Also replicate nearly identical strings, but when doing so, add a fuzzy flag.
  --mark-as-fuzzy       Mark all new translations as fuzzy.
  --no-overwrite, -n    When applying translation, do not overwrite existing translations (apply only to untranslated ones).
  --from-files, -f FROM_FILES [FROM_FILES ...]
                        File in which known translations are searched
  --to-files, -t TO_FILES [TO_FILES ...]
                        File in which translations will be added or updated

After:

$ pomerge --help
usage: pomerge [-h] [--fuzzy-matching] [--mark-as-fuzzy] [-n] [-f FROM_FILES [FROM_FILES ...]] [-t TO_FILES [TO_FILES ...]]

Replicate known translations between sets of po files.
To propagate known translation in a single set of po files,
give it as a source and a destination, like:

    pomerge --from *.po --to *.po

Translations already existing in the destinations po files will be
updated by translations from the source po files.

To find po files recursively, use the globstar option of bash, or your
shell equivalent, like:

    shopt -s globstar
    pomerge --from **/*.po --to **/*.po

Giving only --from or only --to works by using a temporary file, so:

    pomerge --from a/*.po --to b/*.po

is equivalent to:

    pomerge --from a/*.po
    pomerge --to b/*.po

options:
  -h, --help            show this help message and exit
  --fuzzy-matching      Also replicate nearly identical strings, but when doing so, add a fuzzy flag.
  --mark-as-fuzzy       Mark all new translations as fuzzy.
  -n, --no-overwrite    When applying translation, do not overwrite existing translations (apply only to untranslated ones).
  -f, --from-files FROM_FILES [FROM_FILES ...]
                        File in which known translations are searched
  -t, --to-files TO_FILES [TO_FILES ...]
                        File in which translations will be added or updated
This PR improves the program's help text. It makes argparse honor the spaces and new-line characters in the program's description, and reorder short/long arguments to match argparse: short, and then long. Before (description line size depends on the terminal's size: ``` usage: pomerge [-h] [--fuzzy-matching] [--mark-as-fuzzy] [--no-overwrite] [--from-files FROM_FILES [FROM_FILES ...]] [--to-files TO_FILES [TO_FILES ...]] Replicate known translations between sets of po files. To propagate known translation in a single set of po files, give it as a source and a destination, like: pomerge --from *.po --to *.po Translations already existing in the destinations po files will be updated by translations from the source po files. To find po files recursively, use the globstar option of bash, or your shell equivalent, like: shopt -s globstar pomerge --from **/*.po --to **/*.po Giving only --from or only --to works by using a temporary file, so: pomerge --from a/*.po --to b/*.po is equivalent to: pomerge --from a/*.po pomerge --to b/*.po options: -h, --help show this help message and exit --fuzzy-matching Also replicate nearly identical strings, but when doing so, add a fuzzy flag. --mark-as-fuzzy Mark all new translations as fuzzy. --no-overwrite, -n When applying translation, do not overwrite existing translations (apply only to untranslated ones). --from-files, -f FROM_FILES [FROM_FILES ...] File in which known translations are searched --to-files, -t TO_FILES [TO_FILES ...] File in which translations will be added or updated ``` After: ``` $ pomerge --help usage: pomerge [-h] [--fuzzy-matching] [--mark-as-fuzzy] [-n] [-f FROM_FILES [FROM_FILES ...]] [-t TO_FILES [TO_FILES ...]] Replicate known translations between sets of po files. To propagate known translation in a single set of po files, give it as a source and a destination, like: pomerge --from *.po --to *.po Translations already existing in the destinations po files will be updated by translations from the source po files. To find po files recursively, use the globstar option of bash, or your shell equivalent, like: shopt -s globstar pomerge --from **/*.po --to **/*.po Giving only --from or only --to works by using a temporary file, so: pomerge --from a/*.po --to b/*.po is equivalent to: pomerge --from a/*.po pomerge --to b/*.po options: -h, --help show this help message and exit --fuzzy-matching Also replicate nearly identical strings, but when doing so, add a fuzzy flag. --mark-as-fuzzy Mark all new translations as fuzzy. -n, --no-overwrite When applying translation, do not overwrite existing translations (apply only to untranslated ones). -f, --from-files FROM_FILES [FROM_FILES ...] File in which known translations are searched -t, --to-files TO_FILES [TO_FILES ...] File in which translations will be added or updated ```
Signed-off-by: rffontenelle <rffontenelle@gmail.com>
maciek approved these changes 2025-07-16 09:11:50 +02:00
mdk force-pushed rffontenelle-fix-help-text from a58ef1367f to 18981c1f56
Some checks failed
ci/woodpecker/pull_request_closed/woodpecker Pipeline is pending approval
ci/woodpecker/push/woodpecker Pipeline failed
2025-10-28 22:47:25 +01:00
Compare
mdk merged commit 18981c1f56 into master 2025-10-28 23:00:28 +01:00
mdk deleted branch rffontenelle-fix-help-text 2025-10-28 23:00:28 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AFPy/pomerge!3
No description provided.