aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/mbf/info.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-05-17 13:07:12 +0900
committerOphestra <cat@gensokyo.uk>2026-05-17 15:56:53 +0900
commit30eb0d6a613ad268f6805ccbcdcabf158e7f526f (patch)
tree07e55baa52748fd139e183017eeb43f5f64cee59 /cmd/mbf/info.go
parentc2ff9c9fa55ea569a5e70ee90d2eb0b2ee2a0540 (diff)
internal/rosa: key metadata by string
For upcoming azalea integration. The API is quite ugly right now to ease migration. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'cmd/mbf/info.go')
-rw-r--r--cmd/mbf/info.go19
1 files changed, 11 insertions, 8 deletions
diff --git a/cmd/mbf/info.go b/cmd/mbf/info.go
index 15357301..4cdea31c 100644
--- a/cmd/mbf/info.go
+++ b/cmd/mbf/info.go
@@ -6,6 +6,7 @@ import (
"io"
"os"
"strings"
+ "unique"
"hakurei.app/internal/pkg"
"hakurei.app/internal/rosa"
@@ -36,16 +37,18 @@ func commandInfo(
}
for i, name := range args {
- if p, ok := rosa.ResolveName(name); !ok {
+ handle := rosa.ArtifactH(unique.Make(name))
+ if meta := rosa.Native().Get(handle); meta == nil {
return fmt.Errorf("unknown artifact %q", name)
} else {
var suffix string
- if version := rosa.Std.Version(p); version != rosa.Unversioned {
+
+ a, version := rosa.Native().MustLoad(rosa.Std, handle)
+ if version != rosa.Unversioned {
suffix += "-" + version
}
mustPrintln("name : " + name + suffix)
- meta := rosa.GetMetadata(p)
mustPrintln("description : " + meta.Description)
if meta.Website != "" {
mustPrintln("website : " +
@@ -54,9 +57,9 @@ func commandInfo(
if len(meta.Dependencies) > 0 {
mustPrint("depends on :")
for _, d := range meta.Dependencies {
- s := rosa.GetMetadata(d).Name
- if version := rosa.Std.Version(d); version != rosa.Unversioned {
- s += "-" + version
+ s := rosa.Native().MustGet(d).Name
+ if _, _version := rosa.Native().Load(rosa.Std, d); _version != rosa.Unversioned {
+ s += "-" + _version
}
mustPrint(" " + s)
}
@@ -68,7 +71,7 @@ func commandInfo(
if r == nil {
var f io.ReadSeekCloser
err = cm.Do(func(cache *pkg.Cache) (err error) {
- f, err = cache.OpenStatus(rosa.Std.Load(p))
+ f, err = cache.OpenStatus(a)
return
})
if err != nil {
@@ -87,7 +90,7 @@ func commandInfo(
}
}
} else if err = cm.Do(func(cache *pkg.Cache) (err error) {
- status, n := r.ArtifactOf(cache.Ident(rosa.Std.Load(p)))
+ status, n := r.ArtifactOf(cache.Ident(a))
if status == nil {
mustPrintln(
statusPrefix + "not in report",