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
26 lines (23 loc) · 663 Bytes
/
editor.py
File metadata and controls
26 lines (23 loc) · 663 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
# -*- coding: utf-8 -*-
"""
* Editor prompt example
"""
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')) >= 1 or 'Must be at least 3 lines.',
'eargs': {
'editor':'nano',
'ext':'.py'
}
}
]
answers = prompt.prompt(questions, style=custom_style_2)
pprint(answers)