diff --git a/pkgs/clan-cli/clan_cli/vars/check.py b/pkgs/clan-cli/clan_cli/vars/check.py index f9a1bd072..90ff28704 100644 --- a/pkgs/clan-cli/clan_cli/vars/check.py +++ b/pkgs/clan-cli/clan_cli/vars/check.py @@ -4,7 +4,7 @@ from typing import TYPE_CHECKING from clan_cli.completions import add_dynamic_completer, complete_machines from clan_lib.errors import ClanError -from clan_lib.flake import Flake +from clan_lib.flake import Flake, require_flake from clan_lib.machines.machines import Machine if TYPE_CHECKING: @@ -110,7 +110,8 @@ def check_vars( def check_command(args: argparse.Namespace) -> None: - ok = check_vars(args.machine, args.flake, generator_name=args.generator) + flake = require_flake(args.flake) + ok = check_vars(args.machine, flake, generator_name=args.generator) if not ok: raise SystemExit(1) diff --git a/pkgs/clan-cli/clan_cli/vars/check_test.py b/pkgs/clan-cli/clan_cli/vars/check_test.py new file mode 100644 index 000000000..66b200b15 --- /dev/null +++ b/pkgs/clan-cli/clan_cli/vars/check_test.py @@ -0,0 +1,14 @@ +from pathlib import Path + +import pytest +from clan_cli.tests.helpers import cli +from clan_lib.errors import ClanError + + +def test_check_command_no_flake( + tmp_path: Path, monkeypatch: pytest.MonkeyPatch +) -> None: + monkeypatch.chdir(tmp_path) + + with pytest.raises(ClanError): + cli.run(["vars", "check", "machine1"])