Skip to content

Commit

Permalink
fill out new version notice
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
  • Loading branch information
wagoodman committed Aug 18, 2023
1 parent 4762ba0 commit 7925b01
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/syft/internal/ui/post_ui_event_writer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ui

import (
"fmt"
"github.com/anchore/syft/internal/version"
"io"
"strings"

Expand Down Expand Up @@ -118,12 +119,14 @@ func writeAppUpdate(writer io.Writer, events ...partybus.Event) error {
style := lipgloss.NewStyle().Foreground(lipgloss.Color("13")).Italic(true)

for _, e := range events {
notice, err := parsers.ParseCLIAppUpdateAvailable(e)
newVersion, err := parsers.ParseCLIAppUpdateAvailable(e)
if err != nil {
log.WithFields("error", err).Warn("failed to parse app update notification")
continue
}

notice := fmt.Sprintf("A newer version of syft is available for download: %s (installed version is %s)", newVersion, version.FromBuild().Version)

if _, err := fmt.Fprintln(writer, style.Render(notice)); err != nil {
// don't let this be fatal
log.WithFields("error", err).Warn("failed to write app update notification")
Expand Down

0 comments on commit 7925b01

Please sign in to comment.