cmds.projects.CmdCreateFile: Fix spurious newline and --format help #99
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/fix/20260913-cmds-projects-cmdcreatefile-fix-spurious-newline-and-format-help"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.