about summary refs log tree commit diff stats
path: root/commands/msg
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-05-27 07:37:02 +0200
committerReto Brunner <reto@labrat.space>2020-05-27 07:57:10 +0200
commit0f78f06610c0e8887aba2ae50e99b86477a384b3 (patch)
treeff4cd6581d3af0911954a37550602366d2bb0e2f /commands/msg
parent6c4ed3cfe2fe66a1e5f26c404ea90e048142db72 (diff)
downloadaerc-0f78f06610c0e8887aba2ae50e99b86477a384b3.tar.gz
Add Style configuration
The following functionalities are added to configure aerc ui styles.
- Read stylesets from file with very basic fnmatch wildcard matching
- Add default styleset
- Support different stylesets as part of UiConfig allowing contextual
  styles.
- Move widgets/ui elements to use the stylesets.
- Add configuration manual for the styleset
Diffstat (limited to 'commands/msg')
-rw-r--r--commands/msg/archive.go2
-rw-r--r--commands/msg/copy.go2
-rw-r--r--commands/msg/delete.go4
-rw-r--r--commands/msg/forward.go3
-rw-r--r--commands/msg/modify-labels.go2
-rw-r--r--commands/msg/move.go2
-rw-r--r--commands/msg/pipe.go18
-rw-r--r--commands/msg/read.go4
-rw-r--r--commands/msg/recall.go3
-rw-r--r--commands/msg/reply.go3
10 files changed, 23 insertions, 20 deletions
diff --git a/commands/msg/archive.go b/commands/msg/archive.go
index 5561674..ba7e1f7 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(), 10*time.Second)
 				success = false
 				wg.Done()
 			}
diff --git a/commands/msg/copy.go b/commands/msg/copy.go
index f3d4030..e822c5c 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(), 10*time.Second)
 			}
 		})
 	return nil
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 4bda8b9..482b60c 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(), 10*time.Second)
 		}
 	})
 
@@ -68,7 +68,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
 			lib.NewMessageStoreView(next, store, aerc.DecryptKeys,
 				func(view lib.MessageView, err error) {
 					if err != nil {
-						aerc.PushError(err.Error())
+						aerc.PushError(err.Error(), 10*time.Second)
 						return
 					}
 					nextMv := widgets.NewMessageViewer(acct, aerc.Config(), view)
diff --git a/commands/msg/forward.go b/commands/msg/forward.go
index 28abbed..5dd51b2 100644
--- a/commands/msg/forward.go
+++ b/commands/msg/forward.go
@@ -9,6 +9,7 @@ import (
 	"os"
 	"path"
 	"strings"
+	"time"
 
 	"git.sr.ht/~sircmpwn/aerc/models"
 	"git.sr.ht/~sircmpwn/aerc/widgets"
@@ -83,7 +84,7 @@ func (forward) Execute(aerc *widgets.Aerc, args []string) error {
 		composer, err := widgets.NewComposer(aerc, acct, aerc.Config(), acct.AccountConfig(),
 			acct.Worker(), template, defaults, original)
 		if err != nil {
-			aerc.PushError("Error: " + err.Error())
+			aerc.PushError("Error: "+err.Error(), 10*time.Second)
 			return nil, err
 		}
 
diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go
index f91075a..d74aece 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(), 10*time.Second)
 		}
 	})
 	return nil
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 830e752..a19194e 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(), 10*time.Second)
 		}
 	})
 	return nil
diff --git a/commands/msg/pipe.go b/commands/msg/pipe.go
index c88d61f..15b8c52 100644
--- a/commands/msg/pipe.go
+++ b/commands/msg/pipe.go
@@ -12,7 +12,6 @@ import (
 	"git.sr.ht/~sircmpwn/aerc/worker/types"
 
 	"git.sr.ht/~sircmpwn/getopt"
-	"github.com/gdamore/tcell"
 )
 
 type Pipe struct{}
@@ -76,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(), 10*time.Second)
 			return
 		}
 		aerc.NewTab(term, name)
@@ -94,16 +93,17 @@ func (Pipe) Execute(aerc *widgets.Aerc, args []string) error {
 		}()
 		err = ecmd.Run()
 		if err != nil {
-			aerc.PushError(" " + err.Error())
+			aerc.PushError(" "+err.Error(), 10*time.Second)
 		} else {
-			color := tcell.ColorDefault
 			if ecmd.ProcessState.ExitCode() != 0 {
-				color = tcell.ColorRed
+				aerc.PushError(fmt.Sprintf(
+					"%s: completed with status %d", cmd[0],
+					ecmd.ProcessState.ExitCode()), 10*time.Second)
+			} else {
+				aerc.PushStatus(fmt.Sprintf(
+					"%s: completed with status %d", cmd[0],
+					ecmd.ProcessState.ExitCode()), 10*time.Second)
 			}
-			aerc.PushStatus(fmt.Sprintf(
-				"%s: completed with status %d", cmd[0],
-				ecmd.ProcessState.ExitCode()), 10*time.Second).
-				Color(tcell.ColorDefault, color)
 		}
 	}
 
diff --git a/commands/msg/read.go b/commands/msg/read.go
index 1e264c2..e27f743 100644
--- a/commands/msg/read.go
+++ b/commands/msg/read.go
@@ -93,7 +93,7 @@ func submitReadChange(aerc *widgets.Aerc, store *lib.MessageStore,
 		case *types.Done:
 			aerc.PushStatus(msg_success, 10*time.Second)
 		case *types.Error:
-			aerc.PushError(" " + msg.Error.Error())
+			aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
 		}
 	})
 }
@@ -106,7 +106,7 @@ func submitReadChangeWg(aerc *widgets.Aerc, store *lib.MessageStore,
 		case *types.Done:
 			wg.Done()
 		case *types.Error:
-			aerc.PushError(" " + msg.Error.Error())
+			aerc.PushError(" "+msg.Error.Error(), 10*time.Second)
 			*success = false
 			wg.Done()
 		}
diff --git a/commands/msg/recall.go b/commands/msg/recall.go
index 7c9ac19..6c5e973 100644
--- a/commands/msg/recall.go
+++ b/commands/msg/recall.go
@@ -2,6 +2,7 @@ package msg
 
 import (
 	"io"
+	"time"
 
 	"github.com/emersion/go-message"
 	_ "github.com/emersion/go-message/charset"
@@ -91,7 +92,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(), 10*time.Second)
 					composer.Close()
 				}
 			})
diff --git a/commands/msg/reply.go b/commands/msg/reply.go
index 28ce245..455c7ca 100644
--- a/commands/msg/reply.go
+++ b/commands/msg/reply.go
@@ -7,6 +7,7 @@ import (
 	"io"
 	gomail "net/mail"
 	"strings"
+	"time"
 
 	"git.sr.ht/~sircmpwn/getopt"
 
@@ -139,7 +140,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
 		composer, err := widgets.NewComposer(aerc, acct, aerc.Config(),
 			acct.AccountConfig(), acct.Worker(), template, defaults, original)
 		if err != nil {
-			aerc.PushError("Error: " + err.Error())
+			aerc.PushError("Error: "+err.Error(), 10*time.Second)
 			return err
 		}