aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-03-05 16:59:47 +0900
committerOphestra <cat@gensokyo.uk>2026-03-05 16:59:47 +0900
commitebdf9dcecc1046052a06e148b5b289ab2dd95b7e (patch)
tree9aefad0a95b4e7ccd9de151871e45005dda4c416
parent8ea2a56d5b364c7e6bff35c849ecfcb15e52a5d7 (diff)
cmd/mbf: preset status command
This exposes the new OpenStatus cache method. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--cmd/mbf/main.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go
index 004097c7..7a9864b4 100644
--- a/cmd/mbf/main.go
+++ b/cmd/mbf/main.go
@@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
+ "io"
"log"
"os"
"os/signal"
@@ -260,6 +261,30 @@ func main() {
)
}
+ c.NewCommand(
+ "status",
+ "Display the status file of an artifact",
+ func(args []string) error {
+ if len(args) != 1 {
+ return errors.New("status requires 1 argument")
+ }
+ if p, ok := rosa.ResolveName(args[0]); !ok {
+ return fmt.Errorf("unknown artifact %q", args[0])
+ } else {
+ r, err := cache.OpenStatus(rosa.Std.Load(p))
+ if err != nil {
+ if errors.Is(err, os.ErrNotExist) {
+ return errors.New(args[0] + " was never cured")
+ }
+ return err
+ }
+
+ _, err = io.Copy(os.Stdout, r)
+ return errors.Join(err, r.Close())
+ }
+ },
+ )
+
{
var (
flagNet bool