mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 07:26:34 +01:00
chore: update CLI to CLIO (#2001)
Signed-off-by: Keith Zantow <kzantow@gmail.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> Co-authored-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
co-authored by
Alex Goodman
parent
b03e9c6868
commit
2b7a9d0be3
+1
-6
@@ -6,12 +6,10 @@ package event
|
||||
|
||||
import (
|
||||
"github.com/wagoodman/go-partybus"
|
||||
|
||||
"github.com/anchore/syft/internal"
|
||||
)
|
||||
|
||||
const (
|
||||
typePrefix = internal.ApplicationName
|
||||
typePrefix = "syft"
|
||||
cliTypePrefix = typePrefix + "-cli"
|
||||
|
||||
// Events from the syft library
|
||||
@@ -48,7 +46,4 @@ const (
|
||||
|
||||
// CLINotification is a partybus event that occurs when auxiliary information is ready for presentation to stderr
|
||||
CLINotification partybus.EventType = cliTypePrefix + "-notification"
|
||||
|
||||
// CLIExit is a partybus event that occurs when an analysis result is ready for final presentation
|
||||
CLIExit partybus.EventType = cliTypePrefix + "-exit-event"
|
||||
)
|
||||
|
||||
@@ -144,30 +144,22 @@ func ParseAttestationStartedEvent(e partybus.Event) (io.Reader, progress.Progres
|
||||
|
||||
// CLI event types
|
||||
|
||||
func ParseCLIExit(e partybus.Event) (func() error, error) {
|
||||
if err := checkEventType(e.Type, event.CLIExit); err != nil {
|
||||
type UpdateCheck struct {
|
||||
New string
|
||||
Current string
|
||||
}
|
||||
|
||||
func ParseCLIAppUpdateAvailable(e partybus.Event) (*UpdateCheck, error) {
|
||||
if err := checkEventType(e.Type, event.CLIAppUpdateAvailable); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fn, ok := e.Value.(func() error)
|
||||
updateCheck, ok := e.Value.(UpdateCheck)
|
||||
if !ok {
|
||||
return nil, newPayloadErr(e.Type, "Value", e.Value)
|
||||
}
|
||||
|
||||
return fn, nil
|
||||
}
|
||||
|
||||
func ParseCLIAppUpdateAvailable(e partybus.Event) (string, error) {
|
||||
if err := checkEventType(e.Type, event.CLIAppUpdateAvailable); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
newVersion, ok := e.Value.(string)
|
||||
if !ok {
|
||||
return "", newPayloadErr(e.Type, "Value", e.Value)
|
||||
}
|
||||
|
||||
return newVersion, nil
|
||||
return &updateCheck, nil
|
||||
}
|
||||
|
||||
func ParseCLIReport(e partybus.Event) (string, string, error) {
|
||||
|
||||
Reference in New Issue
Block a user