forked from CITGuru/PyInquirer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.py
More file actions
28 lines (24 loc) · 716 Bytes
/
editor.py
File metadata and controls
28 lines (24 loc) · 716 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
# -*- coding: utf-8 -*-
"""
* Editor prompt example
"""
from __future__ import print_function, unicode_literals
from PyInquirer import style_from_dict, Token, prompt, print_json
from PyInquirer import Validator, ValidationError
from examples import custom_style_2
from pprint import pprint
questions = [
{
'type': 'editor',
'name': 'bio',
'message': 'Please write a short bio of at least 3 lines.',
'default': 'Hello World',
'validate': lambda text: len(text.split('\n')) >= 3 or 'Must be at least 3 lines.',
'eargs': {
'editor':'default',
'ext':'.py'
}
}
]
answers = prompt(questions, style=custom_style_2)
pprint(answers)