31 lines
834 B
Python
31 lines
834 B
Python
import argparse
|
|
import logging
|
|
import typing
|
|
|
|
import trygo_py_cliclient.client
|
|
|
|
_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(args):
|
|
clnt = trygo_py_cliclient.client.TryGoAPIClient("http://localhost:8080/")
|
|
response = clnt.register(args.email, args.password, args.display_name)
|
|
_logger.info(response)
|