From fcbbeccaa80c7e120933682b330272a1490c1cf5 Mon Sep 17 00:00:00 2001 From: hachem Date: Sat, 29 Aug 2026 18:24:42 +0200 Subject: refactor: unify mods command with the search --- internal/config/cache.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'internal/config/cache.go') diff --git a/internal/config/cache.go b/internal/config/cache.go index 825af7f..aaaa97b 100644 --- a/internal/config/cache.go +++ b/internal/config/cache.go @@ -23,6 +23,18 @@ func LoadAPI() (*API, error) { return &a, nil } +func SaveAPI(api *API) error { + if err := os.MkdirAll(Dir, 0o755); err != nil { + return err + } + + data, err := json.MarshalIndent(api, "", " ") + if err != nil { + return err + } + return os.WriteFile(APIPath(), append(data, '\n'), 0o600) +} + type ModState struct { Compatible string `json:"compatible"` Latest string `json:"latest"` -- cgit v1.3