From 9240f1aea7575212c95596561b093698c37a3e00 Mon Sep 17 00:00:00 2001 From: drew Date: Thu, 31 Jul 2025 12:05:23 +0400 Subject: [PATCH] fix: format everything [skip ci] --- config/config.go | 3 ++- fetcher/fetcher.go | 34 +++++++++++++++++----------------- main.go | 2 +- sender/sender.go | 2 +- tui/choice.go | 2 +- tui/composer.go | 2 +- tui/composer_test.go | 2 +- tui/email_view.go | 2 +- tui/filepicker.go | 2 +- tui/inbox.go | 6 +++--- tui/login.go | 2 +- tui/messages.go | 2 +- tui/styles.go | 28 ++++++++++++++-------------- view/html.go | 2 +- 14 files changed, 46 insertions(+), 45 deletions(-) diff --git a/config/config.go b/config/config.go index 1b1029215da8a465152fb0c8730616e0c4dd6502..5e66880e22c037e7755d7fa9e031280efc2e0dec 100644 --- a/config/config.go +++ b/config/config.go @@ -64,6 +64,7 @@ func LoadConfig() (*Config, error) { } return &config, nil } + // IMAPServer returns the IMAP server address based on the service provider. // This is used to connect to the email provider's IMAP server. // It returns an empty string if the service provider is not supported. @@ -77,4 +78,4 @@ func (c *Config) IMAPServer() string { default: return "" } -} \ No newline at end of file +} diff --git a/fetcher/fetcher.go b/fetcher/fetcher.go index fe1900081112d55a2631021ac737b1442823dbb4..279c1866b62e3860a38a972ba4628c84c18b2b53 100644 --- a/fetcher/fetcher.go +++ b/fetcher/fetcher.go @@ -266,27 +266,27 @@ func moveEmail(cfg *config.Config, uid uint32, destMailbox string) error { } func DeleteEmail(cfg *config.Config, uid uint32) error { - c, err := connect(cfg) - if err != nil { - return err - } - defer c.Logout() + c, err := connect(cfg) + if err != nil { + return err + } + defer c.Logout() - if _, err := c.Select("INBOX", false); err != nil { - return err - } + if _, err := c.Select("INBOX", false); err != nil { + return err + } - seqSet := new(imap.SeqSet) - seqSet.AddNum(uid) + seqSet := new(imap.SeqSet) + seqSet.AddNum(uid) - item := imap.FormatFlagsOp(imap.AddFlags, true) - flags := []interface{}{imap.DeletedFlag} + item := imap.FormatFlagsOp(imap.AddFlags, true) + flags := []interface{}{imap.DeletedFlag} - if err := c.UidStore(seqSet, item, flags, nil); err != nil { - return err - } + if err := c.UidStore(seqSet, item, flags, nil); err != nil { + return err + } - return c.Expunge(nil) + return c.Expunge(nil) } func ArchiveEmail(cfg *config.Config, uid uint32) error { @@ -298,4 +298,4 @@ func ArchiveEmail(cfg *config.Config, uid uint32) error { archiveMailbox = "Archive" } return moveEmail(cfg, uid, archiveMailbox) -} \ No newline at end of file +} diff --git a/main.go b/main.go index 066c2d37cb3804a2f1c55b87b3871189f46d85df..48bd81d061375d7aa031ea8c9eef2a8ae2b8f302 100644 --- a/main.go +++ b/main.go @@ -360,4 +360,4 @@ func main() { fmt.Printf("Alas, there's been an error: %v", err) os.Exit(1) } -} \ No newline at end of file +} diff --git a/sender/sender.go b/sender/sender.go index d45df8d66f48fe8271ed6d001425dcf4d6d96a4c..c1a6e85c74aabfd5b38133596a7fa98b2aa12628 100644 --- a/sender/sender.go +++ b/sender/sender.go @@ -163,4 +163,4 @@ func SendEmail(cfg *config.Config, to []string, subject, plainBody, htmlBody str addr := fmt.Sprintf("%s:%d", smtpServer, smtpPort) return smtp.SendMail(addr, auth, cfg.Email, to, msg.Bytes()) -} \ No newline at end of file +} diff --git a/tui/choice.go b/tui/choice.go index f071226446677ebd36088ec7644448fea641826a..616d9f8412e6c306ffa30e34438a19eaf563d877 100644 --- a/tui/choice.go +++ b/tui/choice.go @@ -87,4 +87,4 @@ func (m Choice) View() string { b.WriteString(helpStyle.Render("Use ↑/↓ to navigate, enter to select, and ctrl+c to quit.")) return docStyle.Render(b.String()) -} \ No newline at end of file +} diff --git a/tui/composer.go b/tui/composer.go index 0f8b14993164ebeb9b0701424b51135010128a21..9d88861afdce8e2ba4db5995ccb0972989b06845 100644 --- a/tui/composer.go +++ b/tui/composer.go @@ -220,4 +220,4 @@ func (m *Composer) View() string { } return composerView.String() -} \ No newline at end of file +} diff --git a/tui/composer_test.go b/tui/composer_test.go index 922dcaa5154eacfdab7e1475910598bf3f15f10b..7f07cab353fc07f131b0621c83473d50aaf4a5ab 100644 --- a/tui/composer_test.go +++ b/tui/composer_test.go @@ -86,4 +86,4 @@ func TestComposerUpdate(t *testing.T) { t.Errorf("Mismatched SendEmailMsg.\nGot: %+v\nWant: %+v", sendMsg, expectedMsg) } }) -} \ No newline at end of file +} diff --git a/tui/email_view.go b/tui/email_view.go index 97834e25bcbc0967350a8ae6c677135edfd83ec4..c0dbeaa9a33cf053dc1548c6438ab6e43df7233a 100644 --- a/tui/email_view.go +++ b/tui/email_view.go @@ -142,4 +142,4 @@ func (m *EmailView) View() string { } return fmt.Sprintf("%s\n%s\n%s\n%s", styledHeader, m.viewport.View(), attachmentView, help) -} \ No newline at end of file +} diff --git a/tui/filepicker.go b/tui/filepicker.go index a950337443ee4b8f481e168e2f54f38abaf00e81..6756942fcf0231b046b111ed576f2787497be9cc 100644 --- a/tui/filepicker.go +++ b/tui/filepicker.go @@ -122,4 +122,4 @@ func (m *FilePicker) View() string { b.WriteString("\n" + helpStyle.Render("↑/↓: navigate • enter: select • backspace: up • esc: cancel")) return docStyle.Render(b.String()) -} \ No newline at end of file +} diff --git a/tui/inbox.go b/tui/inbox.go index 74b5f0d91aa443cca23757921ca68e78d5a52769..d874b28b3b852468ac126a31cee34cb72d3a3bcd 100644 --- a/tui/inbox.go +++ b/tui/inbox.go @@ -28,8 +28,8 @@ func (i item) FilterValue() string { return i.title + " " + i.desc } type itemDelegate struct{} -func (d itemDelegate) Height() int { return 1 } -func (d itemDelegate) Spacing() int { return 0 } +func (d itemDelegate) Height() int { return 1 } +func (d itemDelegate) Spacing() int { return 0 } func (d itemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { return nil } func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) { i, ok := listItem.(item) @@ -169,4 +169,4 @@ func (m *Inbox) Update(msg tea.Msg) (tea.Model, tea.Cmd) { func (m *Inbox) View() string { return "\n" + m.list.View() -} \ No newline at end of file +} diff --git a/tui/login.go b/tui/login.go index f7ca80e3399c7afc8adee7fd6808f8ec1a164d4b..eb205347a4557f43902afc5b191b4d1cb1c6b619 100644 --- a/tui/login.go +++ b/tui/login.go @@ -121,4 +121,4 @@ func (m *Login) View() string { m.inputs[3].View(), helpStyle.Render("\nenter: save • tab: next field • esc: back to menu"), ) -} \ No newline at end of file +} diff --git a/tui/messages.go b/tui/messages.go index 8da7fe7fe192e56d6e5b41ff3d4f5070a001332f..1af8dbbf410211eb2235103d6367542d0d96f066 100644 --- a/tui/messages.go +++ b/tui/messages.go @@ -109,4 +109,4 @@ type DiscardDraftMsg struct { } // RestoreDraftMsg signals that the cached draft should be restored. -type RestoreDraftMsg struct{} \ No newline at end of file +type RestoreDraftMsg struct{} diff --git a/tui/styles.go b/tui/styles.go index 1fc90a2aeea7e7fe2dce73279d04cbbe9e36db22..238733d8dea332272655f8bce1315157f089e978 100644 --- a/tui/styles.go +++ b/tui/styles.go @@ -10,13 +10,13 @@ import ( var ( DialogBoxStyle = lipgloss.NewStyle(). - Border(lipgloss.RoundedBorder()). - BorderForeground(lipgloss.Color("#874BFD")). - Padding(1, 0). - BorderTop(true). - BorderLeft(true). - BorderRight(true). - BorderBottom(true) + Border(lipgloss.RoundedBorder()). + BorderForeground(lipgloss.Color("#874BFD")). + Padding(1, 0). + BorderTop(true). + BorderLeft(true). + BorderRight(true). + BorderBottom(true) HelpStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("240")) SuccessStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("42")).Bold(true) @@ -27,15 +27,15 @@ var DocStyle = lipgloss.NewStyle().Margin(1, 2) // A simple model for showing a status message type Status struct { - spinner spinner.Model - message string + spinner spinner.Model + message string } func NewStatus(msg string) Status { - s := spinner.New() - s.Spinner = spinner.Dot - s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205")) - return Status{spinner: s, message: msg} + s := spinner.New() + s.Spinner = spinner.Dot + s.Style = lipgloss.NewStyle().Foreground(lipgloss.Color("205")) + return Status{spinner: s, message: msg} } func (m Status) Init() tea.Cmd { return m.spinner.Tick } @@ -48,4 +48,4 @@ func (m Status) Update(msg tea.Msg) (tea.Model, tea.Cmd) { func (m Status) View() string { return fmt.Sprintf("\n\n %s %s\n\n", m.spinner.View(), m.message) -} \ No newline at end of file +} diff --git a/view/html.go b/view/html.go index 76ff2157ab30131ad6605ee06986c8f1cfaea483..ceb31c611de94d365ece0e5f4d9ad53011a416d4 100644 --- a/view/html.go +++ b/view/html.go @@ -105,4 +105,4 @@ func ProcessBody(rawBody string) (string, error) { text = re.ReplaceAllString(text, "\n\n") return text, nil -} \ No newline at end of file +}