api/flake/add: init
Adds an endpoint to memoize clans. clan flakes can be added to the history either via the endpoint or by executing `clan flakes add`
This commit is contained in:
@@ -17,7 +17,7 @@ from clan_cli.webui.api_outputs import (
|
||||
)
|
||||
|
||||
from ...async_cmd import run
|
||||
from ...flakes import create
|
||||
from ...flakes import add, create
|
||||
from ...nix import nix_command, nix_flake_show
|
||||
from ..tags import Tags
|
||||
|
||||
@@ -45,6 +45,11 @@ async def get_attrs(url: AnyUrl | Path) -> list[str]:
|
||||
return flake_attrs
|
||||
|
||||
|
||||
@router.put("/api/flake/add", tags=[Tags.flake])
|
||||
async def add_flake(flake_dir: Path) -> None:
|
||||
await add.add_flake(flake_dir)
|
||||
|
||||
|
||||
# TODO: Check for directory traversal
|
||||
@router.get("/api/flake/attrs", tags=[Tags.flake])
|
||||
async def inspect_flake_attrs(url: AnyUrl | Path) -> FlakeAttrResponse:
|
||||
|
||||
Reference in New Issue
Block a user