Skip to content

Commit a5c4029

Browse files
committed
Fixed broken logic with interactive prompt when a field doesn't have a default value
1 parent 838720f commit a5c4029

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/murfey/cli/create_config.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -412,10 +412,12 @@ def populate_field(key: str, field: ModelField, debug: bool = False) -> Any:
412412
# Display information on the field to be filled
413413
print_field_info(field)
414414

415-
message = (
416-
"Please provide a value (press Enter to use the default value of "
417-
f"{field.field_info.default!r})."
415+
defaults_prompt = (
416+
f"press Enter to use the default value of {field.field_info.default!r}"
417+
if not isinstance(field.field_info.default, UndefinedType)
418+
else "this field is mandatory"
418419
)
420+
message = f"Please provide a value ({defaults_prompt})."
419421
while True:
420422
# Get value
421423
answer = prompt(message, style="bright_yellow")
@@ -430,6 +432,8 @@ def populate_field(key: str, field: ModelField, debug: bool = False) -> Any:
430432
value = ""
431433
else:
432434
value = answer
435+
else:
436+
value = answer
433437

434438
# Validate and return
435439
try:
@@ -555,6 +559,7 @@ def get_settings_tree_path() -> str:
555559
"""
556560
Start of add_software_packages
557561
"""
562+
console.print()
558563
console.print(
559564
"Acquisition Software (acquisition_software)",
560565
style="bold bright_cyan",
@@ -971,7 +976,6 @@ def add_recipes(key: str, field: ModelField, debug: bool = False) -> dict[str, s
971976
"processed_directory_name",
972977
"processed_extra_directory",
973978
"recipes",
974-
"modular_spa",
975979
"default_model",
976980
"model_search_directory",
977981
"initial_model_search_directory",

0 commit comments

Comments
 (0)