clan-cli: Fix clan create throwing a warning if --flake is not defined

This commit is contained in:
Qubasa
2025-02-18 17:40:01 +07:00
parent e3651d0ae0
commit 2d0bcfe6f6

View File

@@ -48,12 +48,15 @@ def git_command(directory: Path, *args: str) -> list[str]:
def create_clan(opts: CreateOptions) -> CreateClanResponse:
dest = opts.dest.resolve()
try:
nix_metadata(str(opts.src_flake))
except ClanError:
log.error(f"Found a repository, but it is not a valid flake: {opts.src_flake}")
log.warning("Setting src_flake to None")
opts.src_flake = None
if opts.src_flake is not None:
try:
nix_metadata(str(opts.src_flake))
except ClanError:
log.error(
f"Found a repository, but it is not a valid flake: {opts.src_flake}"
)
log.warning("Setting src_flake to None")
opts.src_flake = None
template = get_template(
TemplateName(opts.template_name),