(instances: list[dict[str, Any]], has_duplicates: bool)
| 373 | |
| 374 | |
| 375 | def _print_instances_rich(instances: list[dict[str, Any]], has_duplicates: bool) -> None: |
| 376 | cwd = os.getcwd() |
| 377 | table = Table(title=f"Connected Instances ({len(instances)})") |
| 378 | table.add_column("#", style="dim", justify="right", no_wrap=True) |
| 379 | table.add_column("Project", style="cyan", no_wrap=True) |
| 380 | if has_duplicates: |
| 381 | table.add_column("Path (-i)", style="dim") |
| 382 | table.add_column("Unity Version", style="green") |
| 383 | table.add_column("Status", style="yellow") |
| 384 | table.add_column("Default", justify="center") |
| 385 | |
| 386 | for inst in instances: |
| 387 | status = inst.get("status", "unknown") |
| 388 | display_status = _format_status(inst) |
| 389 | row_items: list[str | Text] = [ |
| 390 | str(inst.get("ref_id", "")), |
| 391 | escape(inst.get("project_name", inst.get("instance_id", "Unknown"))), |
| 392 | ] |
| 393 | if has_duplicates: |
| 394 | row_items.append(escape(os.path.relpath(inst.get("instance_id", ""), cwd))) |
| 395 | row_items.extend( |
| 396 | [ |
| 397 | escape(inst.get("unity_version", "Unknown")), |
| 398 | Text(escape(display_status), style=_STATUS_STYLES.get(status.lower(), "dim")), |
| 399 | "[green]*[/green]" if inst.get("is_default") else "", |
| 400 | ] |
| 401 | ) |
| 402 | table.add_row(*row_items) |
| 403 | |
| 404 | console.print(table) |
| 405 | |
| 406 | |
| 407 | def print_logs_table(logs: list[dict[str, Any]]) -> None: |
no test coverage detected