aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--cmd/mbf/main.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go
index 1340d649..b7d6f61a 100644
--- a/cmd/mbf/main.go
+++ b/cmd/mbf/main.go
@@ -195,6 +195,41 @@ func main() {
)
}
+ c.NewCommand(
+ "report",
+ "Generate an artifact cure report for the current cache",
+ func(args []string) (err error) {
+ var w *os.File
+ switch len(args) {
+ case 0:
+ w = os.Stdout
+
+ case 1:
+ if w, err = os.OpenFile(
+ args[0],
+ os.O_CREATE|os.O_EXCL|syscall.O_WRONLY,
+ 0,
+ ); err != nil {
+ return
+ }
+ defer func() {
+ closeErr := w.Close()
+ if err == nil {
+ err = closeErr
+ }
+ }()
+
+ default:
+ return errors.New("report requires 1 argument")
+ }
+
+ if container.Isatty(int(w.Fd())) {
+ return errors.New("output appears to be a terminal")
+ }
+ return rosa.WriteReport(msg, w, cache)
+ },
+ )
+
c.NewCommand("updates", command.UsageInternal, func([]string) error {
var n int
for i := range rosa.PresetEnd {