mirror of
https://github.com/ivabus/pop
synced 2025-06-08 08:00:27 +03:00
refactor: emailSummary
This commit is contained in:
parent
6e1c758b60
commit
1fdf21c19d
2 changed files with 14 additions and 3 deletions
4
main.go
4
main.go
|
@ -43,7 +43,7 @@ var rootCmd = &cobra.Command{
|
||||||
fmt.Println(errorStyle.Render(err.Error()))
|
fmt.Println(errorStyle.Render(err.Error()))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Printf("\n Email %s sent to %s\n\n", activeTextStyle.Render("\""+subject+"\""), linkStyle.Render(strings.Join(to, ", ")))
|
fmt.Print(emailSummary(to, subject))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +58,7 @@ var rootCmd = &cobra.Command{
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
mm := m.(Model)
|
mm := m.(Model)
|
||||||
fmt.Printf("\n Email %s sent to %s\n\n", activeTextStyle.Render("\""+mm.Subject.Value()+"\""), linkStyle.Render(mm.To.Value()))
|
fmt.Print(emailSummary(strings.Split(mm.To.Value(), TO_SEPARATOR), mm.Subject.Value()))
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
13
style.go
13
style.go
|
@ -1,6 +1,11 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/charmbracelet/lipgloss"
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"github.com/charmbracelet/lipgloss"
|
||||||
|
)
|
||||||
|
|
||||||
const accentColor = lipgloss.Color("99")
|
const accentColor = lipgloss.Color("99")
|
||||||
const whiteColor = lipgloss.Color("255")
|
const whiteColor = lipgloss.Color("255")
|
||||||
|
@ -27,3 +32,9 @@ var (
|
||||||
inlineCodeStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF5F87")).Background(lipgloss.Color("#3A3A3A")).Padding(0, 1)
|
inlineCodeStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#FF5F87")).Background(lipgloss.Color("#3A3A3A")).Padding(0, 1)
|
||||||
linkStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00AF87")).Underline(true)
|
linkStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("#00AF87")).Underline(true)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// emailSummary returns a summary of the email that was sent. It is used when
|
||||||
|
// the user has sent an email successfully.
|
||||||
|
func emailSummary(to []string, subject string) string {
|
||||||
|
return fmt.Sprintf("\n Email %s sent to %s\n\n", activeTextStyle.Render("\""+subject+"\""), linkStyle.Render(strings.Join(to, ", ")))
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue