forked from clan/clan-core
nix fmt
This commit is contained in:
parent
3db73d3396
commit
583311fcda
@ -8,9 +8,8 @@ from typing import Any
|
|||||||
|
|
||||||
from . import config, flakes, machines, secrets, vms, webui
|
from . import config, flakes, machines, secrets, vms, webui
|
||||||
from .custom_logger import setup_logging
|
from .custom_logger import setup_logging
|
||||||
from .dirs import get_clan_flake_toplevel
|
from .dirs import get_clan_flake_toplevel, is_clan_flake
|
||||||
from .ssh import cli as ssh_cli
|
from .ssh import cli as ssh_cli
|
||||||
from .dirs import is_clan_flake
|
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -57,14 +56,20 @@ def create_parser(prog: str | None = None) -> argparse.ArgumentParser:
|
|||||||
default=[],
|
default=[],
|
||||||
)
|
)
|
||||||
|
|
||||||
def flake_path(arg:str) -> Path:
|
def flake_path(arg: str) -> Path:
|
||||||
flake_dir = Path(arg).resolve()
|
flake_dir = Path(arg).resolve()
|
||||||
if not flake_dir.exists():
|
if not flake_dir.exists():
|
||||||
raise argparse.ArgumentTypeError(f"flake directory {flake_dir} does not exist")
|
raise argparse.ArgumentTypeError(
|
||||||
|
f"flake directory {flake_dir} does not exist"
|
||||||
|
)
|
||||||
if not flake_dir.is_dir():
|
if not flake_dir.is_dir():
|
||||||
raise argparse.ArgumentTypeError(f"flake directory {flake_dir} is not a directory")
|
raise argparse.ArgumentTypeError(
|
||||||
|
f"flake directory {flake_dir} is not a directory"
|
||||||
|
)
|
||||||
if not is_clan_flake(flake_dir):
|
if not is_clan_flake(flake_dir):
|
||||||
raise argparse.ArgumentTypeError(f"flake directory {flake_dir} is not a clan flake")
|
raise argparse.ArgumentTypeError(
|
||||||
|
f"flake directory {flake_dir} is not a clan flake"
|
||||||
|
)
|
||||||
return flake_dir
|
return flake_dir
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
|
@ -9,6 +9,7 @@ log = logging.getLogger(__name__)
|
|||||||
def get_clan_flake_toplevel() -> Path | None:
|
def get_clan_flake_toplevel() -> Path | None:
|
||||||
return find_toplevel([".clan-flake", ".git", ".hg", ".svn", "flake.nix"])
|
return find_toplevel([".clan-flake", ".git", ".hg", ".svn", "flake.nix"])
|
||||||
|
|
||||||
|
|
||||||
def is_clan_flake(path: Path) -> bool:
|
def is_clan_flake(path: Path) -> bool:
|
||||||
return (path / ".clan-flake").exists()
|
return (path / ".clan-flake").exists()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user