From 6879387140dff8d619e66b66e10cac7e8a84ef92 Mon Sep 17 00:00:00 2001 From: Maas Lalani Date: Thu, 15 Jun 2023 11:04:38 -0400 Subject: [PATCH] fix: don't print emailSummary when aborting --- main.go | 4 +++- model.go | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index d9d01d7..42f9fee 100644 --- a/main.go +++ b/main.go @@ -58,7 +58,9 @@ var rootCmd = &cobra.Command{ return err } mm := m.(Model) - fmt.Print(emailSummary(strings.Split(mm.To.Value(), TO_SEPARATOR), mm.Subject.Value())) + if !mm.abort { + fmt.Print(emailSummary(strings.Split(mm.To.Value(), TO_SEPARATOR), mm.Subject.Value())) + } return nil }, } diff --git a/model.go b/model.go index 79b95e5..278b95f 100644 --- a/model.go +++ b/model.go @@ -53,6 +53,7 @@ type Model struct { help help.Model keymap KeyMap quitting bool + abort bool err error } @@ -230,6 +231,7 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.Attachments.SetHeight(max(len(m.Attachments.Items()), 1) + 2) case key.Matches(msg, m.keymap.Quit): m.quitting = true + m.abort = true return m, tea.Quit } }