-
-
Notifications
You must be signed in to change notification settings - Fork 328
Expand file tree
/
Copy pathquestion.py
More file actions
33 lines (23 loc) · 624 Bytes
/
question.py
File metadata and controls
33 lines (23 loc) · 624 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from collections.abc import Callable
from typing import Literal, TypedDict
class Choice(TypedDict, total=False):
value: str
name: str
key: str
class ListQuestion(TypedDict, total=False):
type: Literal["list"]
name: str
message: str
choices: list[Choice]
use_shortcuts: bool
class InputQuestion(TypedDict, total=False):
type: Literal["input"]
name: str
message: str
filter: Callable[[str], str]
class ConfirmQuestion(TypedDict):
type: Literal["confirm"]
name: str
message: str
default: bool
CzQuestion = ListQuestion | InputQuestion | ConfirmQuestion