File: pizza.py

package info (click to toggle)
python-inquirerpy 0.3.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,088 kB
  • sloc: python: 9,463; makefile: 15
file content (63 lines) | stat: -rw-r--r-- 1,587 bytes parent folder | download | duplicates (2)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
from InquirerPy import prompt
from InquirerPy.enum import INQUIRERPY_POINTER_SEQUENCE
from InquirerPy.validator import EmptyInputValidator

questions = [
    {
        "message": "Delivery or Takeaway?",
        "type": "list",
        "choices": ["Takeaway", "Delivery"],
    },
    {
        "message": "What's your name?",
        "type": "input",
        "validate": EmptyInputValidator(),
    },
    {
        "message": "What's your address",
        "type": "input",
        "validate": EmptyInputValidator("Address cannot be empty"),
        "when": lambda x: x[0] == "Delivery",
    },
    {
        "message": "What pizza would you like?",
        "type": "rawlist",
        "choices": [
            "Pepperoni",
            "Hawaii",
            "Simple Cheese",
            "Peri Peri Chicken",
            "Meath Lover",
        ],
        "pointer": INQUIRERPY_POINTER_SEQUENCE,
    },
    {
        "message": "Select toppings:",
        "type": "fuzzy",
        "choices": [
            "Pepperoni",
            "Mushrooms",
            "Sausage",
            "Onions",
            "Bacon",
            "Extra Cheese",
            "Peppers",
            "Black Olives",
            "Chicken",
            "Pineapple",
            "Spinach",
            "Fresh Basil",
            "Ham",
            "Pesto",
            "Beef",
        ],
        "multiselect": True,
    },
    {"message": "Confirm order?", "type": "confirm", "default": False},
]
result = prompt(
    questions,
    style={"questionmark": "#ff9d00 bold"},
    vi_mode=True,
    style_override=False,
)