Skip to content

Commit

Permalink
fix: improve error output style
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos A Becker <[email protected]>
  • Loading branch information
caarlos0 committed May 11, 2022
1 parent 0ed56f4 commit 43ce3d6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion wishlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,17 @@ func (m *ListModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return m, cmd
}

var boldStyle = lipgloss.NewStyle().Bold(true)

// View comply with tea.Model interface.
func (m *ListModel) View() string {
if m.quitting {
return ""
}
if m.err != nil {
return "something went wrong:" + m.err.Error() + "\npress q to quit"
return boldStyle.Render("Something went wrong:") + "\n\n" +
m.err.Error() + "\n\n" +
boldStyle.Render("Press 'q' to quit.") + "\n"
}
return docStyle.Render(m.list.View())
}

0 comments on commit 43ce3d6

Please sign in to comment.