api/flake/history: implement review requests

This commit is contained in:
DavHau
2023-11-17 18:26:44 +07:00
parent bf2b8b4cca
commit c46638f589
5 changed files with 15 additions and 32 deletions

View File

@@ -2,7 +2,7 @@
import argparse
from clan_cli.flakes.add import register_add_parser
from clan_cli.flakes.list_history import register_list_parser
from clan_cli.flakes.history import register_list_parser
from .create import register_create_parser
@@ -19,5 +19,5 @@ def register_parser(parser: argparse.ArgumentParser) -> None:
register_create_parser(create_parser)
add_parser = subparser.add_parser("add", help="Add a clan flake")
register_add_parser(add_parser)
list_parser = subparser.add_parser("list", help="List clan flakes")
list_parser = subparser.add_parser("list", help="List recently used flakes")
register_list_parser(list_parser)

View File

@@ -3,18 +3,10 @@ import argparse
from pathlib import Path
from typing import Dict
from pydantic import AnyUrl
from pydantic.tools import parse_obj_as
from clan_cli.dirs import user_history_file
from ..async_cmd import CmdOut, runforcli
DEFAULT_URL: AnyUrl = parse_obj_as(
AnyUrl,
"git+https://git.clan.lol/clan/clan-core?new-clan",
)
async def add_flake(path: Path) -> Dict[str, CmdOut]:
user_history_file().parent.mkdir(parents=True, exist_ok=True)

View File

@@ -2,19 +2,10 @@
import argparse
from pathlib import Path
from pydantic import AnyUrl
from pydantic.tools import parse_obj_as
from clan_cli.dirs import user_history_file
DEFAULT_URL: AnyUrl = parse_obj_as(
AnyUrl,
"git+https://git.clan.lol/clan/clan-core?new-clan",
)
def list_history() -> list[Path]:
user_history_file().parent.mkdir(parents=True, exist_ok=True)
if not user_history_file().exists():
return []
# read path lines from history file