diff options
author | Reto Brunner <reto@labrat.space> | 2021-01-30 13:51:32 +0100 |
---|---|---|
committer | Reto Brunner <reto@labrat.space> | 2021-01-30 14:04:23 +0100 |
commit | 8ea86cea41aa038a25a8fee9cd540a7336869dae (patch) | |
tree | 11970859b928dfa06203962b58941e889295edc0 /commands | |
parent | 949781fa0a5f0654112b4f78558347ca991a89d3 (diff) | |
download | aerc-8ea86cea41aa038a25a8fee9cd540a7336869dae.tar.gz |
Get rid of the aerc.PushError(" " + $string) idiom
The individual callers should not be responsible for padding
Diffstat (limited to 'commands')
-rw-r--r-- | commands/account/mkdir.go | 2 | ||||
-rw-r--r-- | commands/account/rmdir.go | 2 | ||||
-rw-r--r-- | commands/compose/attach.go | 4 | ||||
-rw-r--r-- | commands/compose/postpone.go | 4 | ||||
-rw-r--r-- | commands/exec.go | 2 | ||||
-rw-r--r-- | commands/msg/archive.go | 2 | ||||
-rw-r--r-- | commands/msg/copy.go | 2 | ||||
-rw-r--r-- | commands/msg/delete.go | 2 | ||||
-rw-r--r-- | commands/msg/modify-labels.go | 2 | ||||
-rw-r--r-- | commands/msg/move.go | 2 | ||||
-rw-r--r-- | commands/msg/pipe.go | 4 | ||||
-rw-r--r-- | commands/msg/read.go | 2 | ||||
-rw-r--r-- | commands/msg/recall.go | 2 | ||||
-rw-r--r-- | commands/msgview/open.go | 6 | ||||
-rw-r--r-- | commands/term.go | 2 | ||||
-rw-r--r-- | commands/util.go | 4 |
16 files changed, 22 insertions, 22 deletions
diff --git a/commands/account/mkdir.go b/commands/account/mkdir.go index 4352a420..d3a62269 100644 --- a/commands/account/mkdir.go +++ b/commands/account/mkdir.go @@ -40,7 +40,7 @@ func (MakeDir) Execute(aerc *widgets.Aerc, args []string) error { aerc.PushStatus("Directory created.", 10*time.Second) acct.Directories().Select(name) case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) } }) return nil diff --git a/commands/account/rmdir.go b/commands/account/rmdir.go index ed24ca50..9cd974ff 100644 --- a/commands/account/rmdir.go +++ b/commands/account/rmdir.go @@ -86,7 +86,7 @@ func (RemoveDir) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: aerc.PushStatus("Directory removed.", 10*time.Second) case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) case *types.Unsupported: aerc.PushError(":rmdir is not supported by the backend.") } diff --git a/commands/compose/attach.go b/commands/compose/attach.go index 148442b0..37f49dfa 100644 --- a/commands/compose/attach.go +++ b/commands/compose/attach.go @@ -34,13 +34,13 @@ func (Attach) Execute(aerc *widgets.Aerc, args []string) error { path, err := homedir.Expand(path) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) return err } pathinfo, err := os.Stat(path) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) return err } else if pathinfo.IsDir() { aerc.PushError("Attachment must be a file, not a directory") diff --git a/commands/compose/postpone.go b/commands/compose/postpone.go index 365b683f..6d6c8e78 100644 --- a/commands/compose/postpone.go +++ b/commands/compose/postpone.go @@ -63,7 +63,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error { go func() { errStr := <-errChan if errStr != "" { - aerc.PushError(" " + errStr) + aerc.PushError(errStr) return } @@ -90,7 +90,7 @@ func (Postpone) Execute(aerc *widgets.Aerc, args []string) error { r.Close() composer.Close() case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) r.Close() composer.Close() } diff --git a/commands/exec.go b/commands/exec.go index c9aba68f..b1966c23 100644 --- a/commands/exec.go +++ b/commands/exec.go @@ -47,7 +47,7 @@ func (ExecCmd) Execute(aerc *widgets.Aerc, args []string) error { go func() { err := cmd.Run() if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) } else { if cmd.ProcessState.ExitCode() != 0 { aerc.PushError(fmt.Sprintf( diff --git a/commands/msg/archive.go b/commands/msg/archive.go index 07de13f7..59ca9859 100644 --- a/commands/msg/archive.go +++ b/commands/msg/archive.go @@ -86,7 +86,7 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error { case *types.Done: wg.Done() case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) success = false wg.Done() } diff --git a/commands/msg/copy.go b/commands/msg/copy.go index f3d4030a..8e5bad0d 100644 --- a/commands/msg/copy.go +++ b/commands/msg/copy.go @@ -60,7 +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.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) } }) return nil diff --git a/commands/msg/delete.go b/commands/msg/delete.go index 6eb35eba..baa5011f 100644 --- a/commands/msg/delete.go +++ b/commands/msg/delete.go @@ -47,7 +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.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) case *types.Unsupported: // notmuch doesn't support it, we want the user to know aerc.PushError(" error, unsupported for this worker") diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go index f91075ad..082742b4 100644 --- a/commands/msg/modify-labels.go +++ b/commands/msg/modify-labels.go @@ -58,7 +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.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) } }) return nil diff --git a/commands/msg/move.go b/commands/msg/move.go index 41f61dad..31e243ab 100644 --- a/commands/msg/move.go +++ b/commands/msg/move.go @@ -71,7 +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.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) } }) return nil diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go index 4e4ba67d..0e22fd01 100644 --- a/commands/msg/pipe.go +++ b/commands/msg/pipe.go @@ -75,7 +75,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { doTerm := func(reader io.Reader, name string) { term, err := commands.QuickTerm(aerc, cmd, reader) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) return } aerc.NewTab(term, name) @@ -93,7 +93,7 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error { }() err = ecmd.Run() if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) } else { if ecmd.ProcessState.ExitCode() != 0 { aerc.PushError(fmt.Sprintf( diff --git a/commands/msg/read.go b/commands/msg/read.go index 325b7760..95becf78 100644 --- a/commands/msg/read.go +++ b/commands/msg/read.go @@ -187,7 +187,7 @@ func submitFlagChange(aerc *widgets.Aerc, store *lib.MessageStore, case *types.Done: wg.Done() case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) *success = false wg.Done() } diff --git a/commands/msg/recall.go b/commands/msg/recall.go index b6c7f65d..44f8ddf4 100644 --- a/commands/msg/recall.go +++ b/commands/msg/recall.go @@ -86,7 +86,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error { }, func(msg types.WorkerMessage) { switch msg := msg.(type) { case *types.Error: - aerc.PushError(" " + msg.Error.Error()) + aerc.PushError(msg.Error.Error()) composer.Close() } }) diff --git a/commands/msgview/open.go b/commands/msgview/open.go index 47b43692..57e7227a 100644 --- a/commands/msgview/open.go +++ b/commands/msgview/open.go @@ -44,14 +44,14 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error { tmpFile, err := ioutil.TempFile(os.TempDir(), "aerc-*"+extension) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) return } defer tmpFile.Close() _, err = io.Copy(tmpFile, reader) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) return } @@ -68,7 +68,7 @@ func (Open) Execute(aerc *widgets.Aerc, args []string) error { go func() { err := xdg.Wait() if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) } }() diff --git a/commands/term.go b/commands/term.go index 00f6937b..c28c7d08 100644 --- a/commands/term.go +++ b/commands/term.go @@ -46,7 +46,7 @@ func TermCore(aerc *widgets.Aerc, args []string) error { term.OnClose = func(err error) { aerc.RemoveTab(term) if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) } } return nil diff --git a/commands/util.go b/commands/util.go index b1872bc7..8e2bdbc3 100644 --- a/commands/util.go +++ b/commands/util.go @@ -32,7 +32,7 @@ func QuickTerm(aerc *widgets.Aerc, args []string, stdin io.Reader) (*widgets.Ter term.OnClose = func(err error) { if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) // remove the tab on error, otherwise it gets stuck aerc.RemoveTab(term) } else { @@ -56,7 +56,7 @@ func QuickTerm(aerc *widgets.Aerc, args []string, stdin io.Reader) (*widgets.Ter err := <-status if err != nil { - aerc.PushError(" " + err.Error()) + aerc.PushError(err.Error()) } } |