34 lines
936 B
Python
34 lines
936 B
Python
import argparse
|
|
import logging
|
|
import typing
|
|
import taiga_pycli.config
|
|
|
|
import taiga_pycli.service
|
|
|
|
_logger = logging.getLogger(__name__)
|
|
|
|
|
|
if typing.TYPE_CHECKING:
|
|
_SubparserType = argparse._SubParsersAction[argparse.ArgumentParser]
|
|
else:
|
|
_SubparserType = typing.Any
|
|
|
|
|
|
def setup_parser(subparsers: _SubparserType) -> None:
|
|
parser = subparsers.add_parser("register")
|
|
|
|
parser.add_argument(
|
|
"--display-name", type=str, help="config file location", default=""
|
|
)
|
|
parser.add_argument("--email", type=str, help="config file location", default="")
|
|
parser.add_argument("--password", type=str, help="config file location", default="")
|
|
parser.set_defaults(func=run)
|
|
|
|
|
|
def run(cfg: taiga_pycli.config.Config, args):
|
|
# clnt = taiga_pycli.client.TryGoAPIClient("http://localhost:8080/")
|
|
|
|
backend = taiga_pycli.service.BackendService(cfg)
|
|
response = backend.register(args.email, args.password, args.display_name)
|
|
_logger.info(response)
|