diff options
| author | Arslaan Pathan <[email protected]> | 2026-03-06 07:26:52 +1300 |
|---|---|---|
| committer | Arslaan Pathan <[email protected]> | 2026-03-06 07:26:52 +1300 |
| commit | bc8d25088706ac808eb4c4e337ea02b57413c234 (patch) | |
| tree | 900686ad5b86da5a887f99a7a7ab022fb61b5186 | |
| parent | bd6f6fbe80ef419fdf38c4154add3c4d7a452da0 (diff) | |
| download | kiiro-bc8d25088706ac808eb4c4e337ea02b57413c234.tar.xz kiiro-bc8d25088706ac808eb4c4e337ea02b57413c234.zip | |
say unfinished
| -rw-r--r-- | Makefile | 3 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | internal/manifest/manifest.go | 13 | ||||
| -rw-r--r-- | internal/sources/sources.go | 17 | ||||
| -rwxr-xr-x | kiiro | bin | 8584770 -> 8585534 bytes |
5 files changed, 28 insertions, 7 deletions
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 + @@ -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 } Binary files differ |
