Show Unity version for project.
(
ctx: typer.Context,
path: Annotated[
Path,
typer.Argument(help="Unity project path"),
] = Path("."),
json_flag: Annotated[
bool,
typer.Option("--json", help="Output as JSON"),
] = False,
)
| 113 | |
| 114 | @project_app.command("version") |
| 115 | def project_version( |
| 116 | ctx: typer.Context, |
| 117 | path: Annotated[ |
| 118 | Path, |
| 119 | typer.Argument(help="Unity project path"), |
| 120 | ] = Path("."), |
| 121 | json_flag: Annotated[ |
| 122 | bool, |
| 123 | typer.Option("--json", help="Output as JSON"), |
| 124 | ] = False, |
| 125 | ) -> None: |
| 126 | """Show Unity version for project.""" |
| 127 | from unity_cli.exceptions import ProjectVersionError |
| 128 | from unity_cli.hub.project import ProjectVersion |
| 129 | |
| 130 | context: CLIContext = ctx.obj |
| 131 | try: |
| 132 | version = ProjectVersion.from_file(path) |
| 133 | |
| 134 | if _should_json(context, json_flag): |
| 135 | print_json({"version": version.version, "revision": version.revision}) |
| 136 | else: |
| 137 | print_line(f"Unity: [cyan]{version.version}[/cyan]") |
| 138 | if version.revision: |
| 139 | print_line(f"Revision: [dim]{version.revision}[/dim]") |
| 140 | |
| 141 | except ProjectVersionError as e: |
| 142 | _handle_error(e) |
| 143 | |
| 144 | |
| 145 | @project_app.command("packages") |
nothing calls this directly
no test coverage detected