From 7c89143c709e58f22a4939886ccb15bd639eec17 Mon Sep 17 00:00:00 2001 From: Ben Fiedler Date: Thu, 23 Apr 2020 03:56:28 +0200 Subject: Use aerc.PushError where appropriate Forgot an unused import, to save you the hassle here is v2. --- commands/msg/archive.go | 5 +---- commands/msg/copy.go | 4 +--- commands/msg/delete.go | 5 +---- commands/msg/modify-labels.go | 4 +--- commands/msg/move.go | 4 +--- commands/msg/pipe.go | 3 +-- commands/msg/read.go | 8 ++------ 7 files changed, 8 insertions(+), 25 deletions(-) (limited to 'commands/msg') diff --git a/commands/msg/archive.go b/commands/msg/archive.go index 783ab04..b7a14e7 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -7,8 +7,6 @@ import ( "sync" "time" - "github.com/gdamore/tcell" - "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -88,8 +86,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: wg.Done() case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) success = false wg.Done() } diff --git a/commands/msg/copy.go b/commands/msg/copy.go index 30022f1..c2f79c6 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -6,7 +6,6 @@ import ( "time" "git.sr.ht/~sircmpwn/getopt" - "github.com/gdamore/tcell" "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -61,8 +60,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: aerc.PushStatus("Messages copied.", 10*time.Second) case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) } }) return nil diff --git a/commands/msg/delete.go b/commands/msg/delete.go index fb0d1f8..39a9cc5 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -4,8 +4,6 @@ import ( "errors" "time" - "github.com/gdamore/tcell" - "git.sr.ht/~sircmpwn/aerc/lib" "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -49,8 +47,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: aerc.PushStatus("Messages deleted.", 10*time.Second) case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) } }) diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index a53292e..6fcd6ed 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -7,7 +7,6 @@ import ( "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/widgets" "git.sr.ht/~sircmpwn/aerc/worker/types" - "github.com/gdamore/tcell" ) type ModifyLabels struct{} @@ -59,8 +58,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: aerc.PushStatus("labels updated", 10*time.Second) case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) } }) return nil diff --git a/commands/msg/move.go b/commands/msg/move.go index 37402ef..182817e 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -6,7 +6,6 @@ import ( "time" "git.sr.ht/~sircmpwn/getopt" - "github.com/gdamore/tcell" "git.sr.ht/~sircmpwn/aerc/commands" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -72,8 +71,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second) case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) } }) return nil diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 9491cf5..136d533 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -93,8 +93,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { }() err = ecmd.Run() if err != nil { - aerc.PushStatus(" "+err.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+err.Error()) } else { color := tcell.ColorDefault if ecmd.ProcessState.ExitCode() != 0 { diff --git a/commands/msg/read.go b/commands/msg/read.go index ef07523..8613f3f 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -7,8 +7,6 @@ import ( "git.sr.ht/~sircmpwn/getopt" - "github.com/gdamore/tcell" - "git.sr.ht/~sircmpwn/aerc/lib" "git.sr.ht/~sircmpwn/aerc/models" "git.sr.ht/~sircmpwn/aerc/widgets" @@ -95,8 +93,7 @@ func submitReadChange(aerc *widgets.Aerc, store *lib.MessageStore, case *types.Done: aerc.PushStatus(msg_success, 10*time.Second) case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) } }) } @@ -109,8 +106,7 @@ func submitReadChangeWg(aerc *widgets.Aerc, store *lib.MessageStore, case *types.Done: wg.Done() case *types.Error: - aerc.PushStatus(" "+msg.Error.Error(), 10*time.Second). - Color(tcell.ColorDefault, tcell.ColorRed) + aerc.PushError(" "+msg.Error.Error()) *success = false wg.Done() } -- cgit 1.4.1-2-gfad0