API reference#

Generated from the docstrings, type annotations and pydantic models in src/. Every public name is exported by cli_interview_kit.

App and commands#

App

A command-line app built from command declarations.

Command

One command.

Option

A plain option or positional argument; not an interview question.

Invocation

What a command's run function receives.

Interviews#

Interview

A command's questions and consents, and where their dynamic parts come from.

Question

One interview question.

Condition

An answer, option or fact a question depends on.

CustomKind

A question kind an app defines, with its own flag form and prompt.

when

Return a condition: key is one of values.

Console#

Console

Styled output and interactive prompts for a command.

Validators#

non_empty

Reject a blank answer.

whole_number

Accept a whole number, or a blank answer.

byte_size

Accept a size such as 512m or 1g, or a blank answer.

parse_kv

Parse repeated KEY=VALUE flag values into a dict.

Type aliases#

cli_interview_kit.Validator#

alias of Callable[[str], str]

cli_interview_kit.QuestionKind#

alias of Literal[‘text’, ‘select’, ‘multiselect’, ‘confirm’, ‘int’, ‘list’, ‘pairs’, ‘per_item’, ‘custom’]

cli_interview_kit.ChoiceSource#

alias of Callable[[Mapping[str, Any], str | None], Sequence[str]]

cli_interview_kit.DefaultSource#

alias of Callable[[Mapping[str, Any], str | None], str | None]

cli_interview_kit.Facts#

alias of Callable[[Mapping[str, Any]], Mapping[str, Any]]

Errors#

CliError

An expected failure, reported as its message without a traceback.

DeclarationError

A declaration is used in a way it does not allow.