remove pointer reference for models
This commit is contained in:
parent
a6bcb9be38
commit
55675e0c1b
4 changed files with 32 additions and 40 deletions
|
|
@ -21,7 +21,7 @@ type Model struct {
|
|||
stderr string
|
||||
}
|
||||
|
||||
func New(client *porkbun.Client) *Model {
|
||||
func New(client *porkbun.Client) Model {
|
||||
p := paginator.New()
|
||||
p.Type = paginator.Dots
|
||||
p.PerPage = 1
|
||||
|
|
@ -32,7 +32,7 @@ func New(client *porkbun.Client) *Model {
|
|||
s.Spinner = spinner.Dot
|
||||
s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205"))
|
||||
|
||||
return &Model{
|
||||
return Model{
|
||||
loading: false,
|
||||
client: client,
|
||||
domains: nil,
|
||||
|
|
@ -41,11 +41,11 @@ func New(client *porkbun.Client) *Model {
|
|||
}
|
||||
}
|
||||
|
||||
func (m *Model) Init() tea.Cmd {
|
||||
func (m Model) Init() tea.Cmd {
|
||||
return m.spinner.Tick
|
||||
}
|
||||
|
||||
func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
var cmd tea.Cmd
|
||||
|
||||
switch msg := msg.(type) {
|
||||
|
|
@ -89,7 +89,7 @@ func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func (m *Model) View() string {
|
||||
func (m Model) View() string {
|
||||
if m.stderr != "" {
|
||||
return fmt.Sprintf("%s\n\n(Press ctrl+c to quit)", m.stderr)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue