MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / resolve_editor

Method resolve_editor

unity_cli/hub/service.py:81–114  ·  view source on GitHub ↗

Resolve an editor for the required version. If exact version is installed, return it. Otherwise, prompt user to select (or return None in non-interactive mode). Args: required_version: The required Unity version. non_interactive: If True, don't promp

(
        self,
        required_version: str,
        non_interactive: bool = False,
    )

Source from the content-addressed store, hash-verified

79 return True
80
81 def resolve_editor(
82 self,
83 required_version: str,
84 non_interactive: bool = False,
85 ) -> InstalledEditor | None:
86 """Resolve an editor for the required version.
87
88 If exact version is installed, return it.
89 Otherwise, prompt user to select (or return None in non-interactive mode).
90
91 Args:
92 required_version: The required Unity version.
93 non_interactive: If True, don't prompt user.
94
95 Returns:
96 InstalledEditor if resolved, None otherwise.
97 """
98 # Check for exact match
99 exact_match = find_editor_by_version(required_version)
100 if exact_match is not None:
101 return exact_match
102
103 # Get all installed editors
104 installed = get_installed_editors()
105
106 if not installed:
107 return None
108
109 # Non-interactive mode: can't prompt
110 if non_interactive or not is_tty():
111 return None
112
113 # Interactive mode: prompt user
114 return prompt_editor_selection(required_version, installed)
115
116 def list_installed_editors(self) -> list[InstalledEditor]:
117 """List all installed Unity editors."""

Callers 1

open_projectMethod · 0.95

Calls 4

find_editor_by_versionFunction · 0.90
get_installed_editorsFunction · 0.90
is_ttyFunction · 0.90
prompt_editor_selectionFunction · 0.90

Tested by

no test coverage detected