Commit 2251e296 authored by Nicolas Lambert's avatar Nicolas Lambert 💬
Browse files

Merge branch 'setup-menu-prompt' into 'main'

setup-menu: adjust prompts to accept short y/n

Closes #174

See merge request CanESM/imsi!115
parents e1e06cfc 91c17317
Loading
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
import click
from pydantic import ValidationError
from rich.prompt import Prompt


from rich.prompt import Confirm

@click.command(
    name="setup-menu",
@@ -49,7 +47,7 @@ def setup_menu(repo_path, execute):
            break  # valid config, exit loop
        except (InvalidSetupConfig, ValidationError) as e:
            print(f"\033[1;31m[✗] Invalid setup options: {e}\033[0m")
            if Prompt.ask("Try again?", choices=["yes", "no"], default="yes") == "no":
            if not Confirm.ask("Try again?", default=True, show_default=True, case_sensitive=False):
                print("\033[2m[Exiting setup]\033[0m")
                return

@@ -58,5 +56,5 @@ def setup_menu(repo_path, execute):
    print_command(setup_cmd)

    # Step 5: Ask if it should be executed
    if execute or Prompt.ask("Execute now?", choices=["yes", "no"], default="yes") == "yes":
    if execute or Confirm.ask("Execute now?", default=True, show_default=True, case_sensitive=False):
        execute_command(setup_cmd)
 No newline at end of file