summary refs log tree commit diff stats
path: root/config/config.go
diff options
context:
space:
mode:
authorRobin Jarry <robin@jarry.cc>2021-10-26 17:24:45 +0200
committerRobin Jarry <robin@jarry.cc>2021-10-28 16:30:59 +0200
commit42b4302ba32e503c0a8011baae0ca433c8592dd7 (patch)
treecd29bf74fa404a0fd6e0ce6f1d524d41e7c6ab6f /config/config.go
parentfea57839fbc7154c498a725f777c7fa0ab6a5e2a (diff)
downloadaerc-42b4302ba32e503c0a8011baae0ca433c8592dd7.tar.gz
index: allow dynamic formatting of message dates
When a message has been sent today (or this year) allow formatting the
date differently.

For example, with:

 [ui]
 index-format=%-25.25n   %-25.25D   %s
 timestamp-format=2006 Jan 02, 15:04 GMT-0700
 this-day-time-format=Today at 15:04
 this-year-time-format=Jan 02

The message list would look like this (spaces collapsed):

 Robin Jarry        Today at 16:30             [PATCH 1/2] bindings: prepare for more modifers
 bugzilla@dpdk.org  Oct 26                     [dpdk-dev] [Bug 839] pdump: any subsequent runs of pdump_autotest fail
 Holger Levsen      2020 Mar 15, 13:44 GMT+01  +1 (Re: FTP Team -- call for volunteers)

Signed-off-by: Robin Jarry <robin@jarry.cc>
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/config/config.go b/config/config.go
index af9c63b..dfcbd4d 100644
--- a/config/config.go
+++ b/config/config.go
@@ -29,6 +29,8 @@ type GeneralConfig struct {
 type UIConfig struct {
 	IndexFormat         string        `ini:"index-format"`
 	TimestampFormat     string        `ini:"timestamp-format"`
+	ThisDayTimeFormat   string        `ini:"this-day-time-format"`
+	ThisYearTimeFormat  string        `ini:"this-year-time-format"`
 	ShowHeaders         []string      `delim:","`
 	RenderAccountTabs   string        `ini:"render-account-tabs"`
 	PinnedTabMarker     string        `ini:"pinned-tab-marker"`
@@ -491,8 +493,10 @@ func LoadConfigFromFile(root *string, sharedir string) (*AercConfig, error) {
 		Ini: file,
 
 		Ui: UIConfig{
-			IndexFormat:     "%D %-17.17n %s",
-			TimestampFormat: "2006-01-02 03:04 PM",
+			IndexFormat:        "%D %-17.17n %s",
+			TimestampFormat:    "2006-01-02 03:04 PM",
+			ThisDayTimeFormat:  "",
+			ThisYearTimeFormat: "",
 			ShowHeaders: []string{
 				"From", "To", "Cc", "Bcc", "Subject", "Date",
 			},