Rename clickquiry to cliq and remove util package

This commit is contained in:
Tulir Asokan 2018-12-13 19:12:38 +02:00
parent 1bc51d2de5
commit 54e117c9e7
7 changed files with 21 additions and 19 deletions

View File

@ -0,0 +1,2 @@
from .cliq import command, option
from .validators import SPDXValidator, VersionValidator, PathValidator

View File

@ -16,7 +16,7 @@
import click import click
from ..base import app from ..base import app
from ..util.validators import PathValidator from ..cliq.validators import PathValidator
@app.command(short_help="Build a maubot plugin", @app.command(short_help="Build a maubot plugin",

View File

@ -19,8 +19,8 @@ import os
from packaging.version import Version from packaging.version import Version
from jinja2 import Template from jinja2 import Template
from ..util.validators import SPDXValidator, VersionValidator from .. import cliq
from ..util import clickquiry from ..cliq import SPDXValidator, VersionValidator
loaded: bool = False loaded: bool = False
meta_template: Template meta_template: Template
@ -38,16 +38,16 @@ def load_templates():
loaded = True loaded = True
@clickquiry.command(help="Initialize a new maubot plugin") @cliq.command(help="Initialize a new maubot plugin")
@clickquiry.option("-n", "--name", help="The name of the project", required=True, @cliq.option("-n", "--name", help="The name of the project", required=True,
default=os.path.basename(os.getcwd())) default=os.path.basename(os.getcwd()))
@clickquiry.option("-i", "--id", message="ID", required=True, @cliq.option("-i", "--id", message="ID", required=True,
help="The maubot plugin ID (Java package name format)") help="The maubot plugin ID (Java package name format)")
@clickquiry.option("-v", "--version", help="Initial version for project (PEP-440 format)", @cliq.option("-v", "--version", help="Initial version for project (PEP-440 format)",
default="0.1.0", validator=VersionValidator, required=True) default="0.1.0", validator=VersionValidator, required=True)
@clickquiry.option("-l", "--license", validator=SPDXValidator, default="AGPL-3.0-or-later", @cliq.option("-l", "--license", validator=SPDXValidator, default="AGPL-3.0-or-later",
help="The license for the project (SPDX identifier)", required=False) help="The license for the project (SPDX identifier)", required=False)
@clickquiry.option("-c", "--config", message="Should the plugin include a config?", @cliq.option("-c", "--config", message="Should the plugin include a config?",
help="Include a config in the plugin stub", default=False, is_flag=True) help="Include a config in the plugin stub", default=False, is_flag=True)
def init(name: str, id: str, version: Version, license: str, config: bool) -> None: def init(name: str, id: str, version: Version, license: str, config: bool) -> None:
load_templates() load_templates()

View File

@ -21,13 +21,13 @@ import os
from colorama import Fore, Style from colorama import Fore, Style
from ..config import save_config, config from ..config import save_config, config
from ..util import clickquiry from ..cliq import cliq
@clickquiry.command(help="Log in to a Maubot instance") @cliq.command(help="Log in to a Maubot instance")
@clickquiry.option("-u", "--username", help="The username of your account", default=os.environ.get("USER", None), required=True) @cliq.option("-u", "--username", help="The username of your account", default=os.environ.get("USER", None), required=True)
@clickquiry.option("-p", "--password", help="The password to your account", inq_type="password", required=True) @cliq.option("-p", "--password", help="The password to your account", inq_type="password", required=True)
@clickquiry.option("-s", "--server", help="The server to log in to", default="http://localhost:29316", required=True) @cliq.option("-s", "--server", help="The server to log in to", default="http://localhost:29316", required=True)
def login(server, username, password) -> None: def login(server, username, password) -> None:
data = { data = {
"username": username, "username": username,