fabricatio_question.models.questions

Provide question models for interactive user input.

Classes

SelectionQuestion

Interactive selection question for single or multiple choice prompts.

Module Contents

class fabricatio_question.models.questions.SelectionQuestion(/, **data: Any)

Bases: fabricatio_core.models.generic.SketchedAble

Interactive selection question for single or multiple choice prompts.

q: str

The question text to display to the user.

option: List[str]

List of available options for the user to choose from.

async single() str

Present a single-choice selection question to the user.

Returns:

The selected option as a string.

async multiple(k: int = 0) List[str]

Present a multiple-choice selection question to the user.

Parameters:

k – Number of selections required. If k=0, any number is allowed.

Returns:

List of selected options as strings.