File: expand.py

package info (click to toggle)
python-inquirerpy 0.3.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,088 kB
  • sloc: python: 9,463; makefile: 15
file content (36 lines) | stat: -rw-r--r-- 1,177 bytes parent folder | download
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
from InquirerPy import inquirer
from InquirerPy.prompts.expand import ExpandChoice
from InquirerPy.separator import Separator

question1_choice = [
    ExpandChoice(key="a", name="Apple", value="Apple"),
    ExpandChoice(key="c", name="Cherry", value="Cherry"),
    ExpandChoice(key="o", name="Orange", value="Orange"),
    ExpandChoice(key="p", name="Peach", value="Peach"),
    ExpandChoice(key="m", name="Melon", value="Melon"),
    ExpandChoice(key="s", name="Strawberry", value="Strawberry"),
    ExpandChoice(key="g", name="Grapes", value="Grapes"),
]


def question2_choice(_):
    return [
        ExpandChoice(key="d", name="Delivery", value="dl"),
        ExpandChoice(key="p", name="Pick Up", value="pk"),
        Separator(line=15 * "*"),
        ExpandChoice(key="c", name="Car Park", value="cp"),
        ExpandChoice(key="t", name="Third Party", value="tp"),
    ]


def main():
    fruit = inquirer.expand(
        message="Pick your favourite:", choices=question1_choice, default="o"
    ).execute()
    method = inquirer.expand(
        message="Select your preferred method:", choices=question2_choice
    ).execute()


if __name__ == "__main__":
    main()