Deprecate NewModel() constructors; use New() instead

This commit is contained in:
Christian Rocha
2022-01-10 18:27:33 -05:00
parent 9401ebbb83
commit b35f96cd2d
6 changed files with 41 additions and 11 deletions

View File

@@ -57,8 +57,8 @@ type Model struct {
Styles Styles
}
// NewModel creates a new help view with some useful defaults.
func NewModel() Model {
// New creates a new help view with some useful defaults.
func New() Model {
keyStyle := lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{
Light: "#909090",
Dark: "#626262",
@@ -90,6 +90,11 @@ func NewModel() Model {
}
}
// NewModel creates a new help view with some useful defaults.
//
// Deprecated. Use New instead.
var NewModel = New
// Update helps satisfy the Bubble Tea Model interface. It's a no-op.
func (m Model) Update(msg tea.Msg) (Model, tea.Cmd) {
return m, nil