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

Function config_init

unity_cli/cli/commands/config.py:58–81  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

56
57@config_app.command("init")
58def 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}")

Callers

nothing calls this directly

Calls 5

to_tomlMethod · 0.95
print_errorFunction · 0.90
UnityCLIConfigClass · 0.90
print_successFunction · 0.90
ExitMethod · 0.80

Tested by

no test coverage detected