From bc8d25088706ac808eb4c4e337ea02b57413c234 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Fri, 6 Mar 2026 07:26:52 +1300 Subject: say unfinished --- Makefile | 3 +++ README.md | 2 ++ internal/manifest/manifest.go | 13 +++++++++++++ internal/sources/sources.go | 17 ++++++++++------- kiiro | Bin 8584770 -> 8585534 bytes 5 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..7132ba6 --- /dev/null +++ b/Makefile @@ -0,0 +1,3 @@ +all: + go build -o kiiro ./cmd/kiiro + diff --git a/README.md b/README.md index 9995efd..54ddfb2 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ # kiiro A lightweight, rootless userland package manager for Linux. + +(unfinished) diff --git a/internal/manifest/manifest.go b/internal/manifest/manifest.go index aea7fbe..79642cc 100644 --- a/internal/manifest/manifest.go +++ b/internal/manifest/manifest.go @@ -3,6 +3,15 @@ package manifest +import ( + "fmt" + "encoding/json" + "net/http" + "log" + "io" + "errors" +) + type KiiroToml struct { Name string `toml:"pkgname"` Version string `toml:"version"` @@ -12,3 +21,7 @@ type KiiroToml struct { Depends []string `toml:"deps"` } +func FetchKiiroToml(url string) (*KiiroToml, error) { + fmt.Println("Fetching kiiro.toml...") + return nil, errors.New("not implemented") +} diff --git a/internal/sources/sources.go b/internal/sources/sources.go index 6a99cb2..434e734 100644 --- a/internal/sources/sources.go +++ b/internal/sources/sources.go @@ -7,7 +7,6 @@ import ( "fmt" "encoding/json" "net/http" - "log" "io" ) @@ -22,7 +21,6 @@ func FetchPackageListing(url string) (*PackageListing, error) { res, err := http.Get(url) if err != nil { - log.Fatal(err) return nil, err } @@ -30,20 +28,25 @@ func FetchPackageListing(url string) (*PackageListing, error) { res.Body.Close() if res.StatusCode > 299 { - log.Fatalf("Response failed with status code: %d", res.StatusCode) return nil, err } if err != nil { - log.Fatal(err) return nil, err } - var packageListing PackageListing - err = json.Unmarshal(body, &packageListing) + packageListing, err := ParsePackageListing(body) if err != nil { - log.Fatal(err) return nil, err } fmt.Println("Fetched package listing!") + return packageListing, nil +} + +func ParsePackageListing(pkgListingJSON []byte) (*PackageListing, error) { + var packageListing PackageListing + err := json.Unmarshal(pkgListingJSON, &packageListing) + if err != nil { + return nil, err + } return &packageListing, nil } diff --git a/kiiro b/kiiro index 3c4156f..9b7570b 100755 Binary files a/kiiro and b/kiiro differ -- cgit v1.2.3