github.com/anchore/syft@v1.38.2/cmd/syft/cli/ui/handle_pull_source.go (about) 1 package ui 2 3 import ( 4 tea "github.com/charmbracelet/bubbletea" 5 "github.com/wagoodman/go-partybus" 6 7 "github.com/anchore/bubbly/bubbles/taskprogress" 8 "github.com/anchore/syft/internal/log" 9 syftEventParsers "github.com/anchore/syft/syft/event/parsers" 10 ) 11 12 func (m *Handler) handlePullSourceStarted(e partybus.Event) []tea.Model { 13 prog, info, err := syftEventParsers.ParsePullSourceStarted(e) 14 if err != nil { 15 log.WithFields("error", err).Debug("unable to parse event") 16 return nil 17 } 18 19 tsk := m.newTaskProgress( 20 taskprogress.Title{ 21 Default: info.Title.Default, 22 Running: info.Title.WhileRunning, 23 Success: info.Title.OnSuccess, 24 }, 25 taskprogress.WithStagedProgressable(prog), 26 ) 27 28 tsk.HideOnSuccess = info.HideOnSuccess 29 tsk.HideStageOnSuccess = info.HideStageOnSuccess 30 tsk.HideProgressOnSuccess = true 31 32 if info.Context != "" { 33 tsk.Context = []string{info.Context} 34 } 35 36 return []tea.Model{tsk} 37 }