Consent#
- class cli_interview_kit.Consent[source]#
Bases:
FrozenModelA confirmation a command may need before it acts.
Declared on the command’s
Interviewso--questionslists it: an assistant describes it to the user first and passes--yesonly once they agree.- Attributes:
- keystr
Stable identifier.
- whenstr
When the command asks for it and what it allows, for
--questions.- safe_defaultbool | None
The answer when nobody can be asked and
--yeswas not given, and the prompt’s default.Nonemeans only--yesor a person can give it.
Methods
ask(console, interaction, message)Return whether the run has this consent.
- ask(console: Console, interaction: Interaction, message: str) bool[source]#
Return whether the run has this consent.
- Parameters:
- consoleConsole
Where to ask.
- interactionInteraction
The run’s interaction.
- messagestr
The question to ask, saying exactly what will happen.
- Returns:
- bool
Whether the run has this consent.
- Raises:
- DeclarationError
The running command does not declare this consent.
- CliError
Nobody can be asked,
--yeswas not given, and the consent has no safe default.