diff --git a/src/fprime/common/utils.py b/src/fprime/common/utils.py index 6eeb79ed..6d3917f8 100644 --- a/src/fprime/common/utils.py +++ b/src/fprime/common/utils.py @@ -10,8 +10,9 @@ def confirm(msg): """Ask user for a yes or no input after displaying the given message""" # Loop "forever" intended while True: - confirm_input = input(msg) - if confirm_input.lower() in ["y", "yes"]: + confirm_input = input(msg + " (yes/no) [yes]: ") + # Default to yes when no input + if confirm_input.lower() in ["y", "yes", ""]: return True if confirm_input.lower() in ["n", "no"]: return False diff --git a/src/fprime/fbuild/cli.py b/src/fprime/fbuild/cli.py index e78aa6ed..1f2bfab3 100644 --- a/src/fprime/fbuild/cli.py +++ b/src/fprime/fbuild/cli.py @@ -69,7 +69,7 @@ def run_fbuild_cli( print( f"[INFO] {parsed.command.title()} build directory at: {purge_build.build_dir}" ) - if parsed.force or confirm("Purge this directory (yes/no)?"): + if parsed.force or confirm("Purge this directory?"): purge_build.purge() install_dir = purge_build.install_dest_exists() if ( @@ -81,7 +81,7 @@ def run_fbuild_cli( f"[INFO] {parsed.command.title()} install directory at: {install_dir}" ) if parsed.force or confirm( - f"Purge installation directory at {install_dir} (yes/no)?" + f"Purge installation directory at {install_dir} ?" ): purge_build.purge_install() else: diff --git a/src/fprime/util/cookiecutter_wrapper.py b/src/fprime/util/cookiecutter_wrapper.py index 6fa129fe..a672b99c 100644 --- a/src/fprime/util/cookiecutter_wrapper.py +++ b/src/fprime/util/cookiecutter_wrapper.py @@ -36,7 +36,7 @@ def run_impl(build: Build, source_path: Path): hpp_dest = hpp_files[0] cpp_dest = common[0] if common else cpp_files[0] - if not confirm("Generate implementation files (yes/no)? "): + if not confirm("Generate implementation files?"): return False print( "Refreshing cache and generating implementation files (ignore 'Stop' CMake warning)..." @@ -96,7 +96,7 @@ def add_to_cmake(list_file: Path, comp_path: Path, project_root: Path = None): return True if not confirm( - f"Add component {comp_path} to {short_display_path} at end of file (yes/no)? " + f"Add component {comp_path} to {short_display_path} at end of file?" ): return False