cmd/mbf: display metadata
All checks were successful
Test / Create distribution (push) Successful in 1m0s
Test / Sandbox (push) Successful in 2m35s
Test / Hakurei (push) Successful in 3m37s
Test / ShareFS (push) Successful in 3m48s
Test / Sandbox (race detector) (push) Successful in 5m0s
Test / Hakurei (race detector) (push) Successful in 5m50s
Test / Flake checks (push) Successful in 1m30s

For viewing package metadata before the website is ready.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2026-03-05 22:11:26 +09:00
parent c93725ac58
commit fbd97b658f

View File

@@ -11,6 +11,7 @@ import (
"path/filepath"
"runtime"
"strconv"
"strings"
"syscall"
"time"
"unique"
@@ -130,6 +131,37 @@ func main() {
)
}
c.NewCommand(
"info",
"Display out-of-band metadata of an artifact",
func(args []string) error {
if len(args) != 1 {
return errors.New("info requires 1 argument")
}
if p, ok := rosa.ResolveName(args[0]); !ok {
return fmt.Errorf("unknown artifact %q", args[0])
} else {
segments := make([]string, 0, 3)
if version := rosa.Std.Version(p); version != rosa.Unversioned {
segments = append(segments, "version:\n\t"+version)
}
meta := rosa.GetMetadata(p)
segments = append(segments, "description:\n\t"+meta.Description)
if meta.Website != "" {
segments = append(segments,
"website:\n\t"+strings.TrimSuffix(meta.Website, "/"),
)
}
fmt.Println(strings.Join(segments, "\n\n"))
return nil
}
},
)
c.NewCommand("updates", command.UsageInternal, func([]string) error {
var n int
for i := range rosa.PresetEnd {