diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index c6c648f..b2f8ad5 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -780,44 +780,47 @@ def main() -> int: print() print("✅ Installation check complete!") return 0 - if sys.stdin.isatty() and not args.quiet: - sel = _interactive_menu() - if sel == "install": - # user chose to install/reinstall; set defaults and continue - args.skip_deps = False - args.install_editable = True - args.no_playwright = False - elif sel == "extras_hydrus": - # Special case: run the hydrusnetwork.py script and then exit - hydrus_script = repo_root / "scripts" / "hydrusnetwork.py" - if hydrus_script.exists(): - try: - subprocess.check_call([sys.executable, str(hydrus_script)]) - except subprocess.CalledProcessError: - print("\nHydrusNetwork setup exited with an error.") - except Exception as e: - print(f"\nFailed to run HydrusNetwork setup: {e}") - else: - print(f"\nError: {hydrus_script} not found.") - return 0 - elif sel == "uninstall": - return _do_uninstall() - elif sel == "delegate": - rc = run_platform_bootstrap(repo_root) - if rc != 0: - return rc - if not args.quiet: - print("Platform bootstrap completed successfully.") - return 0 + + # If no specific action flag is passed and we're in a terminal, show the menu + if sys.stdin.isatty() and not args.quiet: + sel = _interactive_menu() + if sel == "install": + # user chose to install/reinstall; set defaults and continue + args.skip_deps = False + args.install_editable = True + args.no_playwright = False + elif sel == "extras_hydrus": + # Special case: run the hydrusnetwork.py script and then exit + hydrus_script = repo_root / "scripts" / "hydrusnetwork.py" + if hydrus_script.exists(): + try: + subprocess.check_call([sys.executable, str(hydrus_script)]) + except subprocess.CalledProcessError: + print("\nHydrusNetwork setup exited with an error.") + except Exception as e: + print(f"\nFailed to run HydrusNetwork setup: {e}") else: - return int(sel or 0) - else: + print(f"\nError: {hydrus_script} not found.") + return 0 + elif sel == "uninstall": + return _do_uninstall() + elif sel == "delegate": rc = run_platform_bootstrap(repo_root) if rc != 0: return rc if not args.quiet: print("Platform bootstrap completed successfully.") return 0 + elif sel == 0: + return 0 + elif not args.no_delegate: + # Default non-interactive behavior: delegate to platform script + rc = run_platform_bootstrap(repo_root) + if rc != 0: + return rc + if not args.quiet: + print("Platform bootstrap completed successfully.") + return 0 if sys.version_info < (3, 8): print("Warning: Python 3.8+ is recommended.", file=sys.stderr) @@ -1360,7 +1363,7 @@ if (Test-Path (Join-Path $repo 'CLI.py')) { 'if [ -z "${MM_NO_UPDATE:-}" ] && [ -d "$REPO/.git" ] && command -v git >/dev/null 2>&1; then\n' ' AUTO_UPDATE="true"\n' ' if [ -f "$REPO/config.conf" ]; then\n' - ' if grep -qiE \'auto_update\s*=\s*(false|no|off|0)\' "$REPO/config.conf"; then\n' + " if grep -qiE 'auto_update[[:space:]]*=[[:space:]]*(false|no|off|0)' \"$REPO/config.conf\"; then\n" ' AUTO_UPDATE="false"\n' ' fi\n' ' fi\n'