mirror of
https://github.com/ivabus/pop
synced 2024-12-04 22:15:08 +03:00
feat: --preview
flag
This commit is contained in:
parent
797397fc5e
commit
10c7b1d96a
1 changed files with 3 additions and 1 deletions
4
main.go
4
main.go
|
@ -20,6 +20,7 @@ var (
|
|||
subject string
|
||||
body string
|
||||
attachments []string
|
||||
preview bool
|
||||
)
|
||||
|
||||
var rootCmd = &cobra.Command{
|
||||
|
@ -41,7 +42,7 @@ var rootCmd = &cobra.Command{
|
|||
body = string(b)
|
||||
}
|
||||
|
||||
if len(to) > 0 && from != "" && subject != "" && body != "" {
|
||||
if len(to) > 0 && from != "" && subject != "" && body != "" && !preview {
|
||||
err := sendEmail(to, from, subject, body, attachments)
|
||||
if err != nil {
|
||||
cmd.SilenceUsage = true
|
||||
|
@ -86,6 +87,7 @@ func init() {
|
|||
rootCmd.Flags().StringVarP(&body, "body", "b", "", "Email's contents")
|
||||
rootCmd.Flags().StringVarP(&from, "from", "f", os.Getenv(RESEND_FROM), "Email's sender "+commentStyle.Render("($RESEND_FROM)"))
|
||||
rootCmd.Flags().StringVarP(&subject, "subject", "s", "", "Email's subject")
|
||||
rootCmd.Flags().BoolVarP(&preview, "preview", "p", false, "Whether to preview the email before sending")
|
||||
}
|
||||
|
||||
func main() {
|
||||
|
|
Loading…
Reference in a new issue