This commit is contained in:
2026-01-22 03:31:36 -08:00
parent a1a68c8c88
commit bdea87a1bc

View File

@@ -865,6 +865,18 @@ def main() -> int:
# Non-interactive, fall back to delegating to platform helper
return "delegate"
def _clone_repo(url: str, dest: Path, depth: int = 1) -> bool:
"""Helper to clone a repository."""
try:
cmd = ["git", "clone", url, str(dest)]
if depth:
cmd.extend(["--depth", str(depth)])
subprocess.check_call(cmd)
return True
except Exception as e:
print(f"Error: Failed to clone repository: {e}", file=sys.stderr)
return False
def _ensure_repo_available() -> bool:
"""Prompt for a clone location when running outside the repository."""
nonlocal repo_root, script_dir, is_in_repo
@@ -919,11 +931,9 @@ def main() -> int:
else:
print(f"Cloning Medios-Macina into {install_path} (depth 1)...")
print(f"Source: {REPO_URL}")
try:
subprocess.check_call(["git", "clone", "--depth", "1", REPO_URL, str(install_path)])
if _clone_repo(REPO_URL, install_path, depth=1):
repo_root = install_path
except Exception as e:
print(f"Error: Failed to clone repository: {e}", file=sys.stderr)
else:
return False
os.chdir(str(repo_root))
@@ -1807,8 +1817,8 @@ if (Test-Path (Join-Path $repo 'CLI.py')) {
if not args.quiet:
os.system('cls' if os.name == 'nt' else 'clear')
print()
print("command: mm")
print(".config")
print("launch command from terminal: mm")
print("inside the app: .config")
print()
return 0