Skip to content

Commit 028e98a

Browse files
authored
Merge pull request #269 from dhanushreddy291/main
fix empty template initialization
2 parents 90edd7b + 1f3023c commit 028e98a

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

agentstack/cli/init.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,21 @@ def require_uv():
3838
def select_template(slug_name: str, framework: Optional[str] = None) -> TemplateConfig:
3939
"""Let the user select a template from the ones available."""
4040
templates: list[TemplateConfig] = get_all_templates()
41-
template_names = [shorten(f"⚡️ {t.name} - {t.description}", 80) for t in templates]
4241

43-
empty_msg = "🆕 Empty Project"
44-
template_choice = inquirer.list_input(
42+
EMPTY = 'empty'
43+
choices = [
44+
(EMPTY, "🆕 Empty Project"),
45+
]
46+
for template in templates:
47+
choices.append((template.name, shorten(f"⚡️ {template.name} - {template.description}", 80)))
48+
49+
choice = inquirer.list_input(
4550
message="Do you want to start with a template?",
46-
choices=[empty_msg] + template_names,
51+
choices=[c[1] for c in choices],
4752
)
48-
template_name = template_choice.split("⚡️ ")[1].split(" - ")[0]
53+
template_name = next(c[0] for c in choices if c[1] == choice)
4954

50-
if template_name == empty_msg:
55+
if template_name == EMPTY:
5156
return TemplateConfig(
5257
name=slug_name,
5358
description="",

0 commit comments

Comments
 (0)