aboutsummaryrefslogtreecommitdiff
path: root/internal/manifest/manifest.go
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-05-04 19:07:02 +1200
committerArslaan Pathan <[email protected]>2026-05-04 19:08:06 +1200
commit075bc9a33b0f0df8dd59b55e3f425816448750c7 (patch)
tree053d8cc3a6e2eba00febdcca015ba082f29b2f20 /internal/manifest/manifest.go
parent561574e64dcb778fb38b5fee4c6e53cbaebdaeea (diff)
downloadkiiro-075bc9a33b0f0df8dd59b55e3f425816448750c7.tar.xz
kiiro-075bc9a33b0f0df8dd59b55e3f425816448750c7.zip
Annotate a few things and implement FetchKiiroToml
Diffstat (limited to 'internal/manifest/manifest.go')
-rw-r--r--internal/manifest/manifest.go44
1 files changed, 42 insertions, 2 deletions
diff --git a/internal/manifest/manifest.go b/internal/manifest/manifest.go
index 79642cc..ffb73f8 100644
--- a/internal/manifest/manifest.go
+++ b/internal/manifest/manifest.go
@@ -10,18 +10,58 @@ import (
"log"
"io"
"errors"
+ "github.com/BurntSushi/toml"
)
type KiiroToml struct {
+ // package name
Name string `toml:"pkgname"`
- Version string `toml:"version"`
+ // supported architectures
Architectures string `toml:"archs"`
+ // authors
Authors []string `toml:"authors"`
+ // maintainers of the Kiirofile/kiiro.toml
Maintainers []string `toml:"maintainers"`
+ // Dependencies on other Kiiro packages - you can refer to a package from a specific source by using <source-url>:<package-name>
+ // If no source is provided (just a bare URL), we clone directly from git
Depends []string `toml:"deps"`
+ // Platforms it runs on: e.g. "Windows", "macOS", "Linux", "BSD"
+ Platforms []string `toml:"platforms"`
}
func FetchKiiroToml(url string) (*KiiroToml, error) {
fmt.Println("Fetching kiiro.toml...")
- return nil, errors.New("not implemented")
+
+ res, err := http.Get(url)
+ if err != nil {
+ return nil, err
+ }
+
+ body, err := io.ReadAll(res.Body)
+ res.Body.Close()
+
+ if res.StatusCode > 299 {
+ return nil, err
+ }
+
+ if err != nil {
+ return nil, err
+ }
+
+ kiirotoml, err := ParseKiiroToml(body)
+ if err != nil {
+ return nil, err
+ }
+
+ fmt.Println("Fetched package listing!")
+ return packageListing, nil
+}
+
+func ParseKiiroToml(kiirotomlTOML []byte) (*Kiirotoml, error) {
+ var kiirotoml Kiirotoml
+ err := toml.Unmarshal(kiirotomlTOML, kiirotoml);
+ if err != nil {
+ return nil, err
+ }
+ return &kiirotoml, nil;
}