List installed editors via Hub CLI. Returns: List of installed editor info.
(self)
| 76 | ) from e |
| 77 | |
| 78 | def list_editors(self) -> list[HubEditorInfo]: |
| 79 | """List installed editors via Hub CLI. |
| 80 | |
| 81 | Returns: |
| 82 | List of installed editor info. |
| 83 | """ |
| 84 | result = self._run_command(["editors", "-i"]) |
| 85 | |
| 86 | # Parse Hub CLI output |
| 87 | # Format: version, installed at path |
| 88 | # Example: "2022.3.10f1 , installed at /Applications/Unity/Hub/Editor/2022.3.10f1" |
| 89 | editors: list[HubEditorInfo] = [] |
| 90 | |
| 91 | for line in result.stdout.strip().split("\n"): |
| 92 | line = line.strip() |
| 93 | if not line: |
| 94 | continue |
| 95 | |
| 96 | # Parse "version , installed at path" |
| 97 | if ", installed at " in line: |
| 98 | parts = line.split(", installed at ") |
| 99 | if len(parts) == 2: |
| 100 | version = parts[0].strip() |
| 101 | path = parts[1].strip() |
| 102 | editors.append( |
| 103 | HubEditorInfo( |
| 104 | version=version, |
| 105 | path=path, |
| 106 | modules=[], # Hub CLI doesn't list modules in this command |
| 107 | ) |
| 108 | ) |
| 109 | |
| 110 | return editors |
| 111 | |
| 112 | def install_editor( |
| 113 | self, |
nothing calls this directly
no test coverage detected