aeat.application.wizard._commands module¶
Typer command factory for wizard flows.
build_wizard_command(flow) returns a Typer-compatible callable
whose signature is composed at construction time from the flow’s
questions plus three fixed mode flags (--profile,
--quiet, --accept-defaults). The closure walks the flow
against a Prompter and persists the typed answers.
Flag derivation per question kind:
TEXT/SECRET/PATH→--<question-id>stroption (PathforPATH);INTEGER→--<question-id>intoption;CONFIRM→--<question-id>/--no-<question-id>boolean pair;SELECT→--<question-id>option withclick.Choice([c.value for c in choices]);CHECKBOX→ repeated--<question-id>option that accumulates alist[str].
The closure accepts a Prompter injection through the keyword-only
_prompter parameter (not exposed as a Typer option) so tests can
drive the flow without questionary interaction.
- build_wizard_command(flow, *, mode)[source]¶
Return a Typer-compatible callable that runs
flow.The returned closure carries one parameter per question in the flow (typed and annotated for Typer to derive a CLI flag) plus the three mode flags. Tests can pass a custom prompter through the keyword-only
_prompterslot (not surfaced as a Typer option).modebinds the closure to a single wizard verb."create"refuses a name that already has a manifest;"edit"refuses a name that has none. Both refusals fire before the wizard prompts, so an operator is never walked through 40-odd questions only to have the persistence step reject the work.- Return type:
- Parameters:
flow (WizardFlow)
mode (Literal['create', 'edit'])