feat: pretty print success

This commit is contained in:
Maas Lalani 2023-06-15 10:59:25 -04:00
parent 165699944a
commit 6e1c758b60
No known key found for this signature in database
GPG key ID: 5A6ED5CBF1A0A000
2 changed files with 6 additions and 1 deletions

View file

@ -4,6 +4,7 @@ import (
"fmt"
"io"
"os"
"strings"
tea "github.com/charmbracelet/bubbletea"
"github.com/resendlabs/resend-go"
@ -42,6 +43,7 @@ var rootCmd = &cobra.Command{
fmt.Println(errorStyle.Render(err.Error()))
return err
}
fmt.Printf("\n Email %s sent to %s\n\n", activeTextStyle.Render("\""+subject+"\""), linkStyle.Render(strings.Join(to, ", ")))
return nil
}
@ -51,10 +53,12 @@ var rootCmd = &cobra.Command{
Subject: subject,
Text: body,
}))
_, err := p.Run()
m, err := p.Run()
if err != nil {
return err
}
mm := m.(Model)
fmt.Printf("\n Email %s sent to %s\n\n", activeTextStyle.Render("\""+mm.Subject.Value()+"\""), linkStyle.Render(mm.To.Value()))
return nil
},
}

View file

@ -170,6 +170,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
m.quitting = true
return m, tea.Quit
case sendEmailFailureMsg:
m.blurInputs()
m.state = editingFrom
m.focusActiveInput()
m.err = msg