Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions codeflash/cli_cmds/init_java.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import xml.etree.ElementTree as ET
from dataclasses import dataclass
from enum import Enum, auto
from functools import lru_cache
from pathlib import Path
from typing import Any, Union

Expand Down Expand Up @@ -55,6 +56,7 @@ class JavaSetupInfo:
benchmarks_root: Union[str, None] = None


@lru_cache(maxsize=1)
def _get_theme():
"""Get the CodeflashTheme - imported lazily to avoid circular imports."""
from codeflash.cli_cmds.init_config import CodeflashTheme
Expand Down Expand Up @@ -366,17 +368,15 @@ def _prompt_directory_override(dir_type: str, detected: str, curdir: Path) -> st

def _prompt_custom_directory(dir_type: str) -> str:
"""Prompt for a custom directory path."""
# Reuse the question object to avoid reconstructing it on every loop iteration.
custom_question = inquirer.Path(
"custom_path",
message=f"Enter the path to your {dir_type} directory",
path_type=inquirer.Path.DIRECTORY,
exists=True,
)
while True:
custom_questions = [
inquirer.Path(
"custom_path",
message=f"Enter the path to your {dir_type} directory",
path_type=inquirer.Path.DIRECTORY,
exists=True,
)
]

custom_answers = inquirer.prompt(custom_questions, theme=_get_theme())
custom_answers = inquirer.prompt([custom_question], theme=_get_theme())
if not custom_answers:
apologize_and_exit()

Expand Down
Loading