Skip to content

Commit 2fc5870

Browse files
authored
Merge pull request #40 from jessedp:fix-editor
Fix-editor
2 parents 56f296e + 646205e commit 2fc5870

File tree

4 files changed

+9
-19
lines changed

4 files changed

+9
-19
lines changed

ph5lt/allowlists.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def add(cur):
9696
)
9797

9898
if len(import_list) == 0:
99-
utils.die("No valid urls found, try again")
99+
utils.warn("No valid urls found, try again")
100+
return False
100101

101102
if not prompts.confirm(f"Add {len(import_list)} white lists?"):
102103
return False

ph5lt/banner.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from ph5lt import utils
66

7-
__version__ = "0.6.1"
7+
__version__ = "0.6.2"
88

99

1010
def display():

ph5lt/blocklists.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,8 @@ def add(cur):
9999
import_list = utils.process_lines(import_list, "Pasted content")
100100

101101
if len(import_list) == 0:
102-
utils.die("No valid urls found, try again")
102+
utils.warn("No valid urls found, try again")
103+
return False
103104

104105
if not prompts.confirm(f"Add {len(import_list)} block lists?"):
105106
return False

ph5lt/prompts.py

+4-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import sqlite3
44
from InquirerPy import prompt
55
from InquirerPy.separator import Separator
6-
from prompt_toolkit.validation import ValidationError, Validator
76

87
from ph5lt import constants
98
from ph5lt import utils
@@ -30,16 +29,6 @@ def check_db(path):
3029
return True
3130

3231

33-
class ValidateEditor(Validator):
34-
"""Class to validator "editor" types since that's broken in current PyInquirer"""
35-
36-
def validate(self, document):
37-
if document.text and len(document.text.split("\n")) <= 1:
38-
raise ValidationError(
39-
message="Must be at least 1 line", cursor_position=len(document.text)
40-
)
41-
42-
4332
def key_prompt(questions):
4433
"""prompt wrapper to handle ctrl+c"""
4534
resp = prompt(questions)
@@ -223,11 +212,10 @@ def ask_paste():
223212
questions = [
224213
{
225214
"name": "content",
226-
"type": "editor",
227-
"message": "Opening editor",
228-
# lambda text: len(text.split('\n')) >= 1 or 'Must be at least 1 line',
229-
"validate": ValidateEditor,
230-
"eargs": {"editor": "default", "ext": ".tmp"},
215+
"type": "input",
216+
"message": "Please Paste your of URLS, then:",
217+
"multiline": True,
218+
"instruction": "ESC + Enter to continue",
231219
}
232220
]
233221
result = key_prompt(questions)

0 commit comments

Comments
 (0)