don't setup json inventory for cli users

This commit is contained in:
Jörg Thalheim
2024-07-22 06:19:06 +02:00
parent f04ed457db
commit 05a28e596d

View File

@@ -32,6 +32,7 @@ class CreateOptions:
meta: Meta | None = None meta: Meta | None = None
# URL to the template to use. Defaults to the "minimal" template # URL to the template to use. Defaults to the "minimal" template
template: str = "minimal" template: str = "minimal"
setup_json_inventory: bool = True
def git_command(directory: Path, *args: str) -> list[str]: def git_command(directory: Path, *args: str) -> list[str]:
@@ -87,11 +88,12 @@ def create_clan(options: CreateOptions) -> CreateClanResponse:
) )
# Write inventory.json file # Write inventory.json file
inventory = load_inventory(directory) if options.setup_json_inventory:
if options.meta is not None: inventory = load_inventory(directory)
inventory.meta = options.meta if options.meta is not None:
# Persist creates a commit message for each change inventory.meta = options.meta
save_inventory(inventory, directory, "Init inventory") # Persist creates a commit message for each change
save_inventory(inventory, directory, "Init inventory")
flake_update = run( flake_update = run(
nix_shell(["nixpkgs#nix"], ["nix", "flake", "update"]), cwd=directory nix_shell(["nixpkgs#nix"], ["nix", "flake", "update"]), cwd=directory
@@ -133,8 +135,7 @@ def register_create_parser(parser: argparse.ArgumentParser) -> None:
def create_flake_command(args: argparse.Namespace) -> None: def create_flake_command(args: argparse.Namespace) -> None:
create_clan( create_clan(
CreateOptions( CreateOptions(
directory=args.path, directory=args.path, template=args.template, setup_json_inventory=False
template=args.template,
) )
) )