chore: fix templating
This commit is contained in:
+18
-6
@@ -1,24 +1,36 @@
|
||||
import typer
|
||||
|
||||
from core.git import git_push_service_directory
|
||||
from core.models import ServiceRegistry
|
||||
from core.render_templates import render_new_service_templates
|
||||
from core.utils import get_git_root, init_logging
|
||||
|
||||
service = typer.Typer(no_args_is_help=True)
|
||||
|
||||
REPO_ROOT = get_git_root(__file__)
|
||||
|
||||
|
||||
@service.command()
|
||||
def add(
|
||||
name: str = typer.Option(..., "--name", "-n"),
|
||||
):
|
||||
init_logging()
|
||||
# TODO: add restriction on name (maybe: [a-zA-Z0-9-])
|
||||
registry = ServiceRegistry.read_from_config()
|
||||
service_id = registry.add_service(name)
|
||||
service = registry.add_service(name)
|
||||
render_new_service_templates(
|
||||
service_id=service_id,
|
||||
service_name=name,
|
||||
ioc_host="",
|
||||
ioc_port=9999,
|
||||
user="",
|
||||
service_id=service.id_str,
|
||||
service_name_upper=service.name_upper,
|
||||
service_name_lower=service.name_lower,
|
||||
ioc_host="ex-host", # TODO
|
||||
ioc_port=9999, # TODO
|
||||
user="user", # TODO
|
||||
)
|
||||
git_push_service_directory(
|
||||
repo_root=REPO_ROOT,
|
||||
branch_name=f"feature/add-service-{service.name_lower}",
|
||||
service_dir_rel_path=f"services/{service.dir_name}",
|
||||
commit_msg=f"feature: add new service {service.name_lower}",
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user