diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index 715ab83..480c90f 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -928,15 +928,20 @@ def main() -> int: if (sys.stdin.isatty() or sys.stdout.isatty()) and not args.quiet: sel = _interactive_menu() if sel == "install": - if not is_in_repo: + # If running via pipe/standalone or not in a repo, ask for installation path + if not is_in_repo or script_path is None: if not shutil.which("git"): print("\nError: 'git' was not found on your PATH.", file=sys.stderr) print("Please install Git (https://git-scm.com/) and try again.", file=sys.stderr) return 1 try: - default_install = Path.cwd() / "Medios-Macina" - print(f"\nNo repository found. Where should Medeos-Macina be installed?") + if is_in_repo: + default_install = repo_root + else: + default_install = Path.cwd() / "Medios-Macina" + + print(f"\nWhere would you like to install Medeos-Macina?") install_dir_raw = input(f"Installation directory [{default_install}]: ").strip() if not install_dir_raw: install_path = default_install @@ -951,7 +956,8 @@ def main() -> int: # Check if it already has a repo (user might have chosen an existing folder) if _is_valid_mm_repo(install_path): - print(f"Found existing repository in {install_path}.") + if not args.quiet: + print(f"Using existing repository in {install_path}.") repo_root = install_path else: print(f"Cloning Medeos-Macina into {install_path} (depth 1)...") @@ -965,8 +971,9 @@ def main() -> int: # Change directory to the newly established repo root os.chdir(str(repo_root)) - print(f"\nSuccessfully set up repository at {repo_root}") - print("Resuming bootstrap...\n") + if not args.quiet: + print(f"\nSuccessfully set up repository at {repo_root}") + print("Resuming bootstrap...\n") # Re-initialize script_dir for the rest of the script # as if we started inside the repo scripts folder.