From 3e49d83aeaf77e6e88108f3dc73f0d1aad95b0d9 Mon Sep 17 00:00:00 2001 From: Braelyn Boynton Date: Sat, 21 Dec 2024 16:41:16 -0500 Subject: [PATCH 1/2] exit on init failure --- agentstack/cli/cli.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/agentstack/cli/cli.py b/agentstack/cli/cli.py index 0c085d5d..77b887af 100644 --- a/agentstack/cli/cli.py +++ b/agentstack/cli/cli.py @@ -46,15 +46,15 @@ def init_project_builder( ): if not slug_name and not use_wizard: print(term_color("Project name is required. Use `agentstack init `", 'red')) - return + sys.exit(1) if slug_name and not is_snake_case(slug_name): print(term_color("Project name must be snake case", 'red')) - return + sys.exit(1) if template is not None and use_wizard: print(term_color("Template and wizard flags cannot be used together", 'red')) - return + sys.exit(1) template_data = None if template is not None: From 1f30ed67d80927d05258902aee357d0ff18d0076 Mon Sep 17 00:00:00 2001 From: Braelyn Boynton Date: Mon, 6 Jan 2025 16:21:04 +0000 Subject: [PATCH 2/2] use exception --- agentstack/cli/cli.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/agentstack/cli/cli.py b/agentstack/cli/cli.py index 77b887af..db37a972 100644 --- a/agentstack/cli/cli.py +++ b/agentstack/cli/cli.py @@ -45,16 +45,13 @@ def init_project_builder( use_wizard: bool = False, ): if not slug_name and not use_wizard: - print(term_color("Project name is required. Use `agentstack init `", 'red')) - sys.exit(1) + raise Exception("Project name is required. Use `agentstack init `") if slug_name and not is_snake_case(slug_name): - print(term_color("Project name must be snake case", 'red')) - sys.exit(1) + raise Exception("Project slug name must be snake_case") if template is not None and use_wizard: - print(term_color("Template and wizard flags cannot be used together", 'red')) - sys.exit(1) + raise Exception("Template and wizard flags cannot be used together") template_data = None if template is not None: