mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
25 lines
576 B
Go
25 lines
576 B
Go
package ui
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/wagoodman/go-partybus"
|
|
|
|
syftEventParsers "github.com/anchore/syft/syft/event/parsers"
|
|
)
|
|
|
|
// handleExit is a UI function for processing the Exit bus event,
|
|
// and calling the given function to output the contents.
|
|
func handleExit(event partybus.Event) error {
|
|
// show the report to stdout
|
|
fn, err := syftEventParsers.ParseExit(event)
|
|
if err != nil {
|
|
return fmt.Errorf("bad CatalogerFinished event: %w", err)
|
|
}
|
|
|
|
if err := fn(); err != nil {
|
|
return fmt.Errorf("unable to show package catalog report: %w", err)
|
|
}
|
|
return nil
|
|
}
|