forked from CITGuru/PyInquirer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
expand.py
45 lines (41 loc) · 1.06 KB
/
expand.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
42
43
44
45
# -*- coding: utf-8 -*-
"""
* example for expand question type
* run example by typing `python example/checkbox.py` in your console
"""
from PyInquirer import style_from_dict, Token, prompt, print_json, Separator
from examples import custom_style_2
# questions -
questions = [
{
'type': 'expand',
'message': 'Conflict on `file.js`: ',
'name': 'overwrite',
'default': 'a',
'choices': [
{
'key': 'y',
'name': 'Overwrite',
'value': 'overwrite'
},
{
'key': 'a',
'name': 'Overwrite this one and all next',
'value': 'overwrite_all'
},
{
'key': 'd',
'name': 'Show diff',
'value': 'diff'
},
Separator(),
{
'key': 'x',
'name': 'Abort',
'value': 'abort'
}
]
}
]
answers = prompt.prompt(questions, style=custom_style_2)
print_json(answers)