lib.{App,Cmd}: Pass parent= by name to Cmd* constructors #115

Merged
Jan Lindemann merged 1 commit from jan/feature/20260920-lib-app-cmd-pass-parent-by-name-to-cmd-constructors into master 2026-09-20 12:01:58 +02:00 AGit

lib.{App,Cmd}: Pass parent= by name to Cmd* constructors

The framework instantiates command classes in two places: the top-level commands in App and the lazily materialized subcommands in Cmd.add_subcommands(). Both pass the parent parameter positionally.

Change that to passing parent by keyword at both call sites. Every command class names its first init() parameter parent, so the keyword form binds the same slot for all of them regardless of parameter order, and it allows a command class to declare parent as keyword-only.

#### lib.{App,Cmd}: Pass parent= by name to Cmd* constructors The framework instantiates command classes in two places: the top-level commands in App and the lazily materialized subcommands in Cmd.add_subcommands(). Both pass the parent parameter positionally. Change that to passing parent by keyword at both call sites. Every command class names its first __init__() parameter parent, so the keyword form binds the same slot for all of them regardless of parameter order, and it allows a command class to declare parent as keyword-only.
lib.{App,Cmd}: Pass parent= by name to Cmd* constructors
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 5m40s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m45s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 5m12s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m37s
CI / Packaging test (push) Successful in 0s
3602e3ce0d
The framework instantiates command classes in two places: the top-level
commands in App and the lazily materialized subcommands in
Cmd.add_subcommands(). Both pass the parent parameter positionally.

Change that to passing parent by keyword at both call sites. Every command
class names its first __init__() parameter parent, so the keyword form
binds the same slot for all of them regardless of parameter order, and it
allows a command class to declare parent as keyword-only.

Signed-off-by: Jan Lindemann <jan@janware.com>
Jan Lindemann scheduled this pull request to auto merge when all checks succeed 2026-09-20 11:51:27 +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!115
No description provided.