crhuber / kelp

A simple alternative to homebrew for installing binary packages on MacOS written in Go.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

kelp init fails #2

untcha opened this issue Β· comments

It's me again πŸ˜„

kelp init still fails, because it cannot write the kelp.json

I did not dig deeper into it, but found this:

err := os.WriteFile(kc.Path, bs, 0644)

and this:

// var KelpConf = filepath.Join(home, "/.kelp/kelp.json")

I build kelp with the KelpConfig variable and then it works as expected.

it needs to be able to write to ~/.kelp/kelp.json . so maybe theres an issue writing there

The path is writable. That seems not to be the problem.

The string kc.Path is empty and therefor no destination to write to.

I think the problem is here:

kelp/pkg/config/config.go

Lines 274 to 282 in e183abc

if !utils.FileExists(path) {
var kp KelpPackage
kp.Owner = "crhuber"
kp.Repo = "kelp"
kp.Release = "latest"
kp.UpdatedAt = time.Now()
kp.Description = "Simple homebrew alternative"
kc.Packages = append(kc.Packages, kp)
}

When there is no config existing, then you create the KelpPackage and append it to the KelpConfig but the KelpConfig does not have the path set.

I solved it by adding:

kc.Path = path

Fixed with release v.1.12.4