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

Function print_components_table

unity_cli/cli/output.py:498–524  ·  view source on GitHub ↗

Print component list as a formatted table.

(components: list[dict[str, Any]])

Source from the content-addressed store, hash-verified

496
497
498def print_components_table(components: list[dict[str, Any]]) -> None:
499 """Print component list as a formatted table."""
500 if not components:
501 print_line("No components found")
502 return
503
504 if console.no_color:
505 headers = ["Type", "ID"]
506 rows: list[list[str]] = []
507 for comp in components:
508 comp_type = comp.get("typeName", comp.get("type", "Unknown"))
509 instance_id = str(comp.get("instanceID", ""))
510 rows.append([comp_type, instance_id])
511 _print_plain_table(headers, rows, f"Components ({len(components)})")
512 return
513
514 table = Table(title=f"Components ({len(components)})")
515 table.add_column("Type", style="cyan")
516 table.add_column("ID", style="dim", justify="right")
517
518 for comp in components:
519 comp_type = escape(comp.get("typeName", comp.get("type", "Unknown")))
520 instance_id = str(comp.get("instanceID", ""))
521
522 table.add_row(comp_type, instance_id)
523
524 console.print(table)
525
526
527def _format_duration(duration: Any) -> str:

Callers 1

component_listFunction · 0.90

Calls 2

print_lineFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected