lib.ExecApp: Add class #79
Loading…
Reference in a new issue
No description provided.
Delete branch "jan/feature/20260822-lib-execapp-add-class"
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?
lib.ExecApp: Add class
ExecApp is a ready-made base class for applications that operate through an ExecContext: it adds the --interactive, --verbose and --target options, exposes interactive, verbose and exec_context properties, and closes the exec context when the async context manager exits.
The code for that has lived in jw.pkg.App code before, which now inherits from ExecApp.
A fix along the way: aexit() closes the exec context and then chains to super().aexit(), so App.close() runs when the async context manager exits. Before the change, exiting the async context left the app unclosed; close() ran only on the run() path. Add a unit test that builds an ExecApp with a root command and asserts that close() runs on context exit and that the exec options are registered.
The exec options are now registered before App's own options, which moves them up in the rendered --help output. Update the golden file of the help integration test to match.