mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 08:23:15 +01:00
* add bubbletea UI Signed-off-by: Alex Goodman <alex.goodman@anchore.com> * swap pipeline to go 1.20.x and add attest guard for cosign binary Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * update note in developing.md about the required golang version Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * fix merge conflict for windows path handling Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * temp test for attest handler Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * add addtional test iterations for background reader Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <alex.goodman@anchore.com> Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
34 lines
763 B
Go
34 lines
763 B
Go
package ui
|
|
|
|
import (
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"github.com/wagoodman/go-partybus"
|
|
|
|
"github.com/anchore/bubbly/bubbles/taskprogress"
|
|
stereoEventParsers "github.com/anchore/stereoscope/pkg/event/parsers"
|
|
"github.com/anchore/syft/internal/log"
|
|
)
|
|
|
|
func (m *Handler) handleReadImage(e partybus.Event) []tea.Model {
|
|
imgMetadata, prog, err := stereoEventParsers.ParseReadImage(e)
|
|
if err != nil {
|
|
log.WithFields("error", err).Warn("unable to parse event")
|
|
return nil
|
|
}
|
|
|
|
tsk := m.newTaskProgress(
|
|
taskprogress.Title{
|
|
Default: "Parse image",
|
|
Running: "Parsing image",
|
|
Success: "Parsed image",
|
|
},
|
|
taskprogress.WithProgress(prog),
|
|
)
|
|
|
|
if imgMetadata != nil {
|
|
tsk.Context = []string{imgMetadata.ID}
|
|
}
|
|
|
|
return []tea.Model{tsk}
|
|
}
|