From 66cea095eb4b3d5f92f7a2131c084dcf8e785e87 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 10 Jan 2022 20:42:10 -0500 Subject: [PATCH] Migrate from NewModel() to New() in examples for Bubbles-related stuff --- examples/help/main.go | 2 +- examples/list-default/main.go | 2 +- examples/list-fancy/main.go | 2 +- examples/list-simple/main.go | 2 +- examples/paginator/main.go | 2 +- examples/pipe/main.go | 2 +- examples/progress-animated/main.go | 2 +- examples/progress-static/main.go | 2 +- examples/realtime/main.go | 2 +- examples/send-msg/main.go | 2 +- examples/spinner/main.go | 2 +- examples/spinners/main.go | 2 +- examples/textinput/main.go | 2 +- examples/textinputs/main.go | 2 +- examples/tui-daemon-combo/main.go | 2 +- 15 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/help/main.go b/examples/help/main.go index 1a3af79..e1ecc01 100644 --- a/examples/help/main.go +++ b/examples/help/main.go @@ -75,7 +75,7 @@ type model struct { func newModel() model { return model{ keys: keys, - help: help.NewModel(), + help: help.New(), inputStyle: lipgloss.NewStyle().Foreground(lipgloss.Color("#FF75B7")), } } diff --git a/examples/list-default/main.go b/examples/list-default/main.go index 2dcaf70..e7b1d6b 100644 --- a/examples/list-default/main.go +++ b/examples/list-default/main.go @@ -74,7 +74,7 @@ func main() { item{title: "Terrycloth", desc: "In other words, towel fabric"}, } - m := model{list: list.NewModel(items, list.NewDefaultDelegate(), 0, 0)} + m := model{list: list.New(items, list.NewDefaultDelegate(), 0, 0)} m.list.Title = "My Fave Things" p := tea.NewProgram(m, tea.WithAltScreen()) diff --git a/examples/list-fancy/main.go b/examples/list-fancy/main.go index 7ae9caf..b3daa39 100644 --- a/examples/list-fancy/main.go +++ b/examples/list-fancy/main.go @@ -95,7 +95,7 @@ func newModel() model { // Setup list delegate := newItemDelegate(delegateKeys) - groceryList := list.NewModel(items, delegate, 0, 0) + groceryList := list.New(items, delegate, 0, 0) groceryList.Title = "Groceries" groceryList.Styles.Title = titleStyle groceryList.AdditionalFullHelpKeys = func() []key.Binding { diff --git a/examples/list-simple/main.go b/examples/list-simple/main.go index 3d0449b..97628db 100644 --- a/examples/list-simple/main.go +++ b/examples/list-simple/main.go @@ -111,7 +111,7 @@ func main() { const defaultWidth = 20 - l := list.NewModel(items, itemDelegate{}, defaultWidth, listHeight) + l := list.New(items, itemDelegate{}, defaultWidth, listHeight) l.Title = "What do you want for dinner?" l.SetShowStatusBar(false) l.SetFilteringEnabled(false) diff --git a/examples/paginator/main.go b/examples/paginator/main.go index 9aa042c..35356d5 100644 --- a/examples/paginator/main.go +++ b/examples/paginator/main.go @@ -21,7 +21,7 @@ func newModel() model { items = append(items, text) } - p := paginator.NewModel() + p := paginator.New() p.Type = paginator.Dots p.PerPage = 10 p.ActiveDot = lipgloss.NewStyle().Foreground(lipgloss.AdaptiveColor{Light: "235", Dark: "252"}).Render("•") diff --git a/examples/pipe/main.go b/examples/pipe/main.go index b44503b..b138f9e 100644 --- a/examples/pipe/main.go +++ b/examples/pipe/main.go @@ -56,7 +56,7 @@ type model struct { } func newModel(initialValue string) (m model) { - i := textinput.NewModel() + i := textinput.New() i.Prompt = "" i.CursorStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("63")) i.Width = 48 diff --git a/examples/progress-animated/main.go b/examples/progress-animated/main.go index 14b367b..ca6b610 100644 --- a/examples/progress-animated/main.go +++ b/examples/progress-animated/main.go @@ -27,7 +27,7 @@ var helpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#626262")).Render func main() { m := model{ - progress: progress.NewModel(progress.WithDefaultGradient()), + progress: progress.New(progress.WithDefaultGradient()), } if err := tea.NewProgram(m).Start(); err != nil { diff --git a/examples/progress-static/main.go b/examples/progress-static/main.go index edcc202..ba74cb6 100644 --- a/examples/progress-static/main.go +++ b/examples/progress-static/main.go @@ -35,7 +35,7 @@ const ( var helpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#626262")).Render func main() { - prog := progress.NewModel(progress.WithScaledGradient("#FF7CCB", "#FDFF8C")) + prog := progress.New(progress.WithScaledGradient("#FF7CCB", "#FDFF8C")) if err := tea.NewProgram(model{progress: prog}).Start(); err != nil { fmt.Println("Oh no!", err) diff --git a/examples/realtime/main.go b/examples/realtime/main.go index 3ab780e..3390d81 100644 --- a/examples/realtime/main.go +++ b/examples/realtime/main.go @@ -82,7 +82,7 @@ func main() { p := tea.NewProgram(model{ sub: make(chan struct{}), - spinner: spinner.NewModel(), + spinner: spinner.New(), }) if p.Start() != nil { diff --git a/examples/send-msg/main.go b/examples/send-msg/main.go index 6e851b1..875f6f8 100644 --- a/examples/send-msg/main.go +++ b/examples/send-msg/main.go @@ -45,7 +45,7 @@ type model struct { func newModel() model { const numLastResults = 5 - s := spinner.NewModel() + s := spinner.New() s.Style = spinnerStyle return model{ spinner: s, diff --git a/examples/spinner/main.go b/examples/spinner/main.go index a65373e..229542d 100644 --- a/examples/spinner/main.go +++ b/examples/spinner/main.go @@ -21,7 +21,7 @@ type model struct { } func initialModel() model { - s := spinner.NewModel() + s := spinner.New() s.Spinner = spinner.Dot s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205")) return model{spinner: s} diff --git a/examples/spinners/main.go b/examples/spinners/main.go index 67d722f..d84e06b 100644 --- a/examples/spinners/main.go +++ b/examples/spinners/main.go @@ -80,7 +80,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { } func (m *model) resetSpinner() { - m.spinner = spinner.NewModel() + m.spinner = spinner.New() m.spinner.Style = spinnerStyle m.spinner.Spinner = spinners[m.index] } diff --git a/examples/textinput/main.go b/examples/textinput/main.go index 25617ae..eac1c8a 100644 --- a/examples/textinput/main.go +++ b/examples/textinput/main.go @@ -28,7 +28,7 @@ type model struct { } func initialModel() model { - ti := textinput.NewModel() + ti := textinput.New() ti.Placeholder = "Pikachu" ti.Focus() ti.CharLimit = 156 diff --git a/examples/textinputs/main.go b/examples/textinputs/main.go index 7e92416..1bd5594 100644 --- a/examples/textinputs/main.go +++ b/examples/textinputs/main.go @@ -38,7 +38,7 @@ func initialModel() model { var t textinput.Model for i := range m.inputs { - t = textinput.NewModel() + t = textinput.New() t.CursorStyle = cursorStyle t.CharLimit = 32 diff --git a/examples/tui-daemon-combo/main.go b/examples/tui-daemon-combo/main.go index 4b22c82..de2d61c 100644 --- a/examples/tui-daemon-combo/main.go +++ b/examples/tui-daemon-combo/main.go @@ -65,7 +65,7 @@ type model struct { func newModel() model { const showLastResults = 5 - sp := spinner.NewModel() + sp := spinner.New() sp.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("206")) return model{