Write a default .unity-cli.toml into the current directory (edit to taste). Use --output to pick a different path, --force to overwrite an existing file.
(
ctx: typer.Context,
output: Annotated[
Path | None,
typer.Option("--output", "-o", help="Output path"),
] = None,
force: Annotated[
bool,
typer.Option("--force", "-f", help="Overwrite existing config"),
] = False,
)
| 56 | |
| 57 | @config_app.command("init") |
| 58 | def config_init( |
| 59 | ctx: typer.Context, |
| 60 | output: Annotated[ |
| 61 | Path | None, |
| 62 | typer.Option("--output", "-o", help="Output path"), |
| 63 | ] = None, |
| 64 | force: Annotated[ |
| 65 | bool, |
| 66 | typer.Option("--force", "-f", help="Overwrite existing config"), |
| 67 | ] = False, |
| 68 | ) -> None: |
| 69 | """Write a default .unity-cli.toml into the current directory (edit to taste). |
| 70 | |
| 71 | Use --output to pick a different path, --force to overwrite an existing file. |
| 72 | """ |
| 73 | output_path = output or Path(CONFIG_FILE_NAME) |
| 74 | |
| 75 | if output_path.exists() and not force: |
| 76 | print_error(f"{output_path} already exists. Use --force to overwrite.") |
| 77 | raise typer.Exit(ExitCode.USAGE_ERROR) from None |
| 78 | |
| 79 | default_config = UnityCLIConfig() |
| 80 | output_path.write_text(default_config.to_toml()) |
| 81 | print_success(f"Created {output_path}") |
nothing calls this directly
no test coverage detected