mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
refactor PyInquirer to questionary
This commit is contained in:
parent
47a8db6b60
commit
026fdacb59
@ -17,7 +17,7 @@ from typing import Any, Callable, Union, Optional
|
|||||||
import functools
|
import functools
|
||||||
|
|
||||||
from prompt_toolkit.validation import Validator
|
from prompt_toolkit.validation import Validator
|
||||||
from PyInquirer import prompt
|
from questionary import prompt
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from ..base import app
|
from ..base import app
|
||||||
@ -48,7 +48,7 @@ def command(help: str) -> Callable[[Callable], Callable]:
|
|||||||
pass
|
pass
|
||||||
question_list = list(questions.values())
|
question_list = list(questions.values())
|
||||||
question_list.reverse()
|
question_list.reverse()
|
||||||
resp = prompt(question_list, keyboard_interrupt_msg="Aborted!")
|
resp = prompt(question_list, kbi_msg="Aborted!")
|
||||||
if not resp and question_list:
|
if not resp and question_list:
|
||||||
return
|
return
|
||||||
kwargs = {**kwargs, **resp}
|
kwargs = {**kwargs, **resp}
|
||||||
@ -102,9 +102,9 @@ def option(short: str, long: str, message: str = None, help: str = None,
|
|||||||
if default is not None:
|
if default is not None:
|
||||||
q["default"] = default
|
q["default"] = default
|
||||||
if required or required_unless is not None:
|
if required or required_unless is not None:
|
||||||
q["validator"] = Required(validator)
|
q["validate"] = Required(validator)
|
||||||
elif validator:
|
elif validator:
|
||||||
q["validator"] = validator
|
q["validate"] = validator
|
||||||
func.__inquirer_questions__[long[2:]] = q
|
func.__inquirer_questions__[long[2:]] = q
|
||||||
return func
|
return func
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ import os
|
|||||||
|
|
||||||
from ruamel.yaml import YAML, YAMLError
|
from ruamel.yaml import YAML, YAMLError
|
||||||
from colorama import Fore
|
from colorama import Fore
|
||||||
from PyInquirer import prompt
|
from questionary import prompt
|
||||||
import click
|
import click
|
||||||
|
|
||||||
from mautrix.types import SerializerError
|
from mautrix.types import SerializerError
|
||||||
|
@ -11,5 +11,5 @@ packaging>=10
|
|||||||
|
|
||||||
click>=7,<8
|
click>=7,<8
|
||||||
colorama>=0.4,<0.5
|
colorama>=0.4,<0.5
|
||||||
PyInquirer>=1,<2
|
questionary>=1,<2
|
||||||
jinja2>=2,<4
|
jinja2>=2,<4
|
||||||
|
Loading…
Reference in New Issue
Block a user