cmds.projects.CmdCreateFile: Fix --format help
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m42s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m30s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m17s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m24s
CI / Packaging test (push) Successful in 0s

The possible values of --format are defined by an Enum which is never
really used as such. Derive them from class introspection instead, i.e.
offer all formats that have a corresponding render_<format>() name.

Also, turn the option into real argparse-backed choices, and make the
argument mandatory, because that reflects the reality of the implementation
- there is no default.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-09-12 17:56:40 +02:00
commit a197e9c50d
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
2 changed files with 19 additions and 13 deletions

View file

@ -332,7 +332,7 @@ List available commands
options:
-h, --help show this help message and exit
============= Running: jw-pkg.py -t ../../../.. --log-level info projects create-file --help
usage: jw-pkg.py projects create-file [-h] [--format FORMAT]
usage: jw-pkg.py projects create-file [-h] --format {pyright,tmpl}
[--search-path SEARCH_PATH]
[--template-name TEMPLATE_NAME]
[--quote] [-f KEY=VALUE]
@ -345,7 +345,8 @@ positional arguments:
options:
-h, --help show this help message and exit
--format FORMAT pyright (default: None)
--format {pyright,tmpl}
Output format, one of: pyright, tmpl
--search-path SEARCH_PATH
Template search path, colon separated (default:
/etc/opt/jw-pkg/templates)