forked from CITGuru/PyInquirer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
list.py
41 lines (35 loc) · 979 Bytes
/
list.py
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
# -*- coding: utf-8 -*-
"""
list prompt example
"""
from __future__ import print_function, unicode_literals
from pprint import pprint
from PyInquirer import style_from_dict, Token, prompt, Separator
from examples import custom_style_2
questions = [
{
'type': 'list',
'name': 'theme',
'message': 'What do you want to do?',
'choices': [
'Order a pizza',
'Make a reservation',
Separator(),
'Ask for opening hours',
{
'name': 'Contact support',
'disabled': 'Unavailable at this time'
},
'Talk to the receptionist'
]
},
{
'type': 'list',
'name': 'size',
'message': 'What size do you need?',
'choices': ['Jumbo', 'Large', 'Standard', 'Medium', 'Small', 'Micro'],
'filter': lambda val: val.lower()
}
]
answers = prompt(questions, style=custom_style_2)
pprint(answers)