Skip to content

Commit

Permalink
style: color the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
majori committed Jun 18, 2024
1 parent 02f8f18 commit 2d82eaa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/cli/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import (

"github.com/carlmjohnson/versioninfo"
uiutil "github.com/futurice/jalapeno/pkg/ui/util"

"github.com/charmbracelet/lipgloss"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -82,5 +84,8 @@ func errorHandler(cmd *cobra.Command, err error) error {
return nil
}

return err
// Color the error message
color := lipgloss.NewStyle().Foreground(lipgloss.Color("#EF4136"))
cmd.SetErrPrefix(color.Render("Error:"))
return errors.New(color.Render(err.Error()))
}

0 comments on commit 2d82eaa

Please sign in to comment.