mirror of
https://github.com/ivabus/pop
synced 2024-12-04 22:15:08 +03:00
feat: pretty print success
This commit is contained in:
parent
165699944a
commit
6e1c758b60
2 changed files with 6 additions and 1 deletions
6
main.go
6
main.go
|
@ -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
|
||||
},
|
||||
}
|
||||
|
|
1
model.go
1
model.go
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue