diff --git a/maubot/cli/cliq/__init__.py b/maubot/cli/cliq/__init__.py new file mode 100644 index 0000000..cba14a4 --- /dev/null +++ b/maubot/cli/cliq/__init__.py @@ -0,0 +1,2 @@ +from .cliq import command, option +from .validators import SPDXValidator, VersionValidator, PathValidator diff --git a/maubot/cli/util/clickquiry.py b/maubot/cli/cliq/cliq.py similarity index 100% rename from maubot/cli/util/clickquiry.py rename to maubot/cli/cliq/cliq.py diff --git a/maubot/cli/util/validators.py b/maubot/cli/cliq/validators.py similarity index 100% rename from maubot/cli/util/validators.py rename to maubot/cli/cliq/validators.py diff --git a/maubot/cli/commands/build.py b/maubot/cli/commands/build.py index 295e938..bd4416c 100644 --- a/maubot/cli/commands/build.py +++ b/maubot/cli/commands/build.py @@ -16,7 +16,7 @@ import click from ..base import app -from ..util.validators import PathValidator +from ..cliq.validators import PathValidator @app.command(short_help="Build a maubot plugin", diff --git a/maubot/cli/commands/init.py b/maubot/cli/commands/init.py index d9e3368..a3fb278 100644 --- a/maubot/cli/commands/init.py +++ b/maubot/cli/commands/init.py @@ -19,8 +19,8 @@ import os from packaging.version import Version from jinja2 import Template -from ..util.validators import SPDXValidator, VersionValidator -from ..util import clickquiry +from .. import cliq +from ..cliq import SPDXValidator, VersionValidator loaded: bool = False meta_template: Template @@ -38,17 +38,17 @@ def load_templates(): loaded = True -@clickquiry.command(help="Initialize a new maubot plugin") -@clickquiry.option("-n", "--name", help="The name of the project", required=True, - default=os.path.basename(os.getcwd())) -@clickquiry.option("-i", "--id", message="ID", required=True, - help="The maubot plugin ID (Java package name format)") -@clickquiry.option("-v", "--version", help="Initial version for project (PEP-440 format)", - default="0.1.0", validator=VersionValidator, required=True) -@clickquiry.option("-l", "--license", validator=SPDXValidator, default="AGPL-3.0-or-later", - help="The license for the project (SPDX identifier)", required=False) -@clickquiry.option("-c", "--config", message="Should the plugin include a config?", - help="Include a config in the plugin stub", default=False, is_flag=True) +@cliq.command(help="Initialize a new maubot plugin") +@cliq.option("-n", "--name", help="The name of the project", required=True, + default=os.path.basename(os.getcwd())) +@cliq.option("-i", "--id", message="ID", required=True, + help="The maubot plugin ID (Java package name format)") +@cliq.option("-v", "--version", help="Initial version for project (PEP-440 format)", + default="0.1.0", validator=VersionValidator, required=True) +@cliq.option("-l", "--license", validator=SPDXValidator, default="AGPL-3.0-or-later", + help="The license for the project (SPDX identifier)", required=False) +@cliq.option("-c", "--config", message="Should the plugin include a config?", + 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: load_templates() main_class = name[0].upper() + name[1:] diff --git a/maubot/cli/commands/login.py b/maubot/cli/commands/login.py index 2bbfe4c..7cc85f1 100644 --- a/maubot/cli/commands/login.py +++ b/maubot/cli/commands/login.py @@ -21,13 +21,13 @@ import os from colorama import Fore, Style from ..config import save_config, config -from ..util import clickquiry +from ..cliq import cliq -@clickquiry.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) -@clickquiry.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.command(help="Log in to a Maubot instance") +@cliq.option("-u", "--username", help="The username of your account", default=os.environ.get("USER", None), required=True) +@cliq.option("-p", "--password", help="The password to your account", inq_type="password", 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: data = { "username": username, diff --git a/maubot/cli/util/__init__.py b/maubot/cli/util/__init__.py deleted file mode 100644 index e69de29..0000000