List Unity menu-bar entries (built-in + custom [MenuItem]). Useful for discovering which paths 'u menu exec' can invoke. Examples: u menu list # All menu items u menu list -f Tools # Items containing 'Tools' u menu list -f "Windo
(
ctx: typer.Context,
filter_text: Annotated[
str | None,
typer.Option("--filter", "-f", help="Filter menu items (case-insensitive)"),
] = None,
limit: Annotated[
int,
typer.Option("--limit", "-l", help="Maximum items to return"),
] = 100,
json_flag: Annotated[
bool,
typer.Option("--json", help="Output as JSON"),
] = False,
)
| 58 | |
| 59 | @menu_app.command("list") |
| 60 | def menu_list( |
| 61 | ctx: typer.Context, |
| 62 | filter_text: Annotated[ |
| 63 | str | None, |
| 64 | typer.Option("--filter", "-f", help="Filter menu items (case-insensitive)"), |
| 65 | ] = None, |
| 66 | limit: Annotated[ |
| 67 | int, |
| 68 | typer.Option("--limit", "-l", help="Maximum items to return"), |
| 69 | ] = 100, |
| 70 | json_flag: Annotated[ |
| 71 | bool, |
| 72 | typer.Option("--json", help="Output as JSON"), |
| 73 | ] = False, |
| 74 | ) -> None: |
| 75 | """List Unity menu-bar entries (built-in + custom [MenuItem]). |
| 76 | |
| 77 | Useful for discovering which paths 'u menu exec' can invoke. |
| 78 | |
| 79 | Examples: |
| 80 | u menu list # All menu items |
| 81 | u menu list -f Tools # Items containing 'Tools' |
| 82 | u menu list -f "Window/Analysis" # Narrow to a submenu |
| 83 | """ |
| 84 | context: CLIContext = ctx.obj |
| 85 | try: |
| 86 | result = context.client.menu.list(filter_text=filter_text, limit=limit) |
| 87 | if _should_json(context, json_flag): |
| 88 | print_json(result) |
| 89 | else: |
| 90 | items = result.get("items", []) |
| 91 | if is_no_color(): |
| 92 | for item in items: |
| 93 | path = item.get("path", str(item)) if isinstance(item, dict) else str(item) |
| 94 | print_plain_item(path) |
| 95 | else: |
| 96 | print_line(f"[bold]Menu Items ({len(items)})[/bold]") |
| 97 | for item in items: |
| 98 | path = item.get("path", str(item)) if isinstance(item, dict) else str(item) |
| 99 | print_line(f" {escape(path)}") |
| 100 | except UnityCLIError as e: |
| 101 | _handle_error(e) |
| 102 | |
| 103 | |
| 104 | @menu_app.command("context") |
nothing calls this directly
no test coverage detected