cmds.projects.CmdCreateFile: Fix spurious newline and --format help #99

Merged
Jan Lindemann merged 2 commits from jan/fix/20260913-cmds-projects-cmdcreatefile-fix-spurious-newline-and-format-help into master 2026-09-13 22:27:27 +02:00 AGit

This PR fixes two independent defects in the project template creation commands: a spurious trailing newline that create-file and create-pkg-config append to the rendered output, and a --format option on create-file whose values are not backed by real argparse choices and which are not mandatory:

cmds.projects.CmdCreateFile: Fix spurious trailing newline

create-file and create-pkg-config both print the rendered template with a newline appended over the original template, owed to using print() instead of sys.stdout.write(). Fix that.

cmds.projects.CmdCreateFile: Fix --format help

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_() 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.

This PR fixes two independent defects in the project template creation commands: a spurious trailing newline that create-file and create-pkg-config append to the rendered output, and a --format option on create-file whose values are not backed by real argparse choices and which are not mandatory: #### cmds.projects.CmdCreateFile: Fix spurious trailing newline create-file and create-pkg-config both print the rendered template with a newline appended over the original template, owed to using print() instead of sys.stdout.write(). Fix that. #### cmds.projects.CmdCreateFile: Fix --format help 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.
create-file and create-pkg-config both print the rendered template with a
newline appended over the original template, owed to using print() instead
of sys.stdout.write(). Fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
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
a197e9c50d
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>
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-09-13 22:18:11 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
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
janware/jw-pkg!99
No description provided.