Handle `graphify ` dispatch (install/uninstall + every per-platform install target). Returns True if cmd was an install command and was handled, False otherwise so the caller can continue its own dispatch. Moved verbatim from __main__.main().
(cmd: str)
| 2793 | |
| 2794 | |
| 2795 | def dispatch_install_cli(cmd: str) -> bool: |
| 2796 | """Handle `graphify <install-command>` dispatch (install/uninstall + every |
| 2797 | per-platform install target). Returns True if cmd was an install command and |
| 2798 | was handled, False otherwise so the caller can continue its own dispatch. |
| 2799 | Moved verbatim from __main__.main(). |
| 2800 | """ |
| 2801 | if cmd not in _CLI_INSTALL_COMMANDS: |
| 2802 | return False |
| 2803 | if cmd == "install": |
| 2804 | # Default to windows platform on Windows, claude elsewhere |
| 2805 | default_platform = "windows" if platform.system() == "Windows" else "claude" |
| 2806 | selected_platform: str | None = None |
| 2807 | project_scope = False |
| 2808 | strict = False |
| 2809 | args = sys.argv[2:] |
| 2810 | i = 0 |
| 2811 | while i < len(args): |
| 2812 | arg = args[i] |
| 2813 | if arg in ("-h", "--help"): |
| 2814 | _print_install_usage() |
| 2815 | return True |
| 2816 | if arg == "--project": |
| 2817 | project_scope = True |
| 2818 | i += 1 |
| 2819 | elif arg == "--strict": |
| 2820 | strict = True |
| 2821 | i += 1 |
| 2822 | elif arg.startswith("--platform="): |
| 2823 | candidate = arg.split("=", 1)[1] |
| 2824 | if selected_platform and selected_platform != candidate: |
| 2825 | print("error: specify install platform only once", file=sys.stderr) |
| 2826 | sys.exit(1) |
| 2827 | selected_platform = candidate |
| 2828 | i += 1 |
| 2829 | elif arg == "--platform": |
| 2830 | if i + 1 >= len(args): |
| 2831 | print("error: --platform requires a value", file=sys.stderr) |
| 2832 | sys.exit(1) |
| 2833 | candidate = args[i + 1] |
| 2834 | if selected_platform and selected_platform != candidate: |
| 2835 | print("error: specify install platform only once", file=sys.stderr) |
| 2836 | sys.exit(1) |
| 2837 | selected_platform = candidate |
| 2838 | i += 2 |
| 2839 | elif arg.startswith("-"): |
| 2840 | print(f"error: unknown install option '{arg}'", file=sys.stderr) |
| 2841 | sys.exit(1) |
| 2842 | else: |
| 2843 | if selected_platform and selected_platform != arg: |
| 2844 | print("error: specify install platform only once", file=sys.stderr) |
| 2845 | sys.exit(1) |
| 2846 | selected_platform = arg |
| 2847 | i += 1 |
| 2848 | chosen_platform = selected_platform or default_platform |
| 2849 | if project_scope: |
| 2850 | _project_install(chosen_platform, Path("."), strict=strict) |
| 2851 | else: |
| 2852 | if strict: |