prompt.questions¶
BaseQuestion
¶
Bases: ABC
, t.Generic[T]
Base Question class
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
err(error)
¶
Inform the user that an error has occured when trying to process their answer
ConfirmQuestion
¶
Bases: MappedInputQuestion[bool]
Question to get a yes / no from the user
Prompt.confirm()
is an alias for asking this question
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
InputQuestion
¶
Bases: Question[T]
Question to request textual input from the user.
Similar to using input()
with add validations.
Prompt.input()
is an alias for asking this question
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
__init__(prompt, convert=None, *, default=constants.MISSING_DEFAULT, echo=True)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prompt |
str
|
String to be displayed before the cursor |
required |
convert |
type[T]
|
A type to attempt converting the user input into. Should be a supported arc type. If conversion fails, an error will be emmited and the user will be prompted to enter a value again. |
None
|
default |
T | constants.Constant
|
A default to return if the user does not enter any input (just hits the enter key). If there is no default provided, the user must give some form of input, or exit the program with Ctrl-C |
constants.MISSING_DEFAULT
|
echo |
bool
|
Whether to echo the user's input out to the screen. |
True
|
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
MultipleChoiceQuestion
¶
Bases: InputQuestion[tuple[int, str]]
Question with multiple possible options
MultipleChoiceQuestion(["Option 1", "Option 2", "Option 3",])
[0] Option 1
[1] Option 2
[3] Option 3
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
RangeQuestion
¶
Bases: InputQuestion[int]
Question for a number in a given range
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
__init__(prompt, min, max, **kwargs)
¶
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min |
int
|
the smallest number possible |
required |
max |
int
|
the largest number possible |
required |
Source code in /home/runner/work/arc/arc/arc/prompt/questions.py
SelectQuestion
¶
Bases: RawQuestion[T]
Presents the user with a menu that they can select an option from
Prompt.select()
is an alias for asking this question