Skip to content

Commit

Permalink
dur
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Kamat <[email protected]>
  • Loading branch information
ayushkamat committed Aug 6, 2024
1 parent 5d90fd2 commit 7044ed3
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions latch_cli/services/init/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import re
import shutil
import subprocess
import sys
from pathlib import Path
from typing import Callable, Optional

Expand Down Expand Up @@ -330,18 +331,29 @@ def init(
)

if template is None:
template_func = select_tui(
template_choice = select_tui(
title="Select Workflow Template",
options=[
{"display_name": name, "value": fn} for name, fn in option_map.items()
{"display_name": name, "value": (name, fn)}
for name, fn in option_map.items()
],
)
elif template in template_flag_to_option.keys():
choice = template_flag_to_option[template]
template_choice = (choice, option_map[choice])
else:
template_func = option_map[template_flag_to_option[template]]
click.secho(
f"Invalid template choice: {template} - valid choices:"
f" {list(template_flag_to_option.keys())}",
fg="red",
)
raise click.exceptions.Exit(1)

if template_func is None:
if template_choice is None:
return False

(chosen_template, template_func) = template_choice

try:
pkg_root.mkdir(parents=True)
except FileExistsError:
Expand All @@ -359,7 +371,7 @@ def init(

base_image_type = BaseImageOptions[base_image_type_str]

if template_func == "Empty workflow":
if chosen_template == "Empty workflow":
base_image_type = select_tui(
title="Select the base docker image to use for the workflow",
options=[
Expand Down

0 comments on commit 7044ed3

Please sign in to comment.