From 6749bdbb9686aad95ff8ea29685c840a4776d96b Mon Sep 17 00:00:00 2001 From: Jan Philipp Timme Date: Tue, 1 Jan 2019 21:23:04 +0100 Subject: [PATCH] Rename QEntrySortConfig to QSortConfig --- mailq/sorting.go | 10 +++++----- main.go | 4 ++-- shell.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mailq/sorting.go b/mailq/sorting.go index 1df4919..ab5c421 100644 --- a/mailq/sorting.go +++ b/mailq/sorting.go @@ -6,7 +6,7 @@ import ( "sort" ) -type QEntrySortConfig struct { +type QSortConfig struct { attributes []qEntryAttributeSortConfig } @@ -15,8 +15,8 @@ type qEntryAttributeSortConfig struct { order string } -func NewSortConfig() QEntrySortConfig { - return QEntrySortConfig{} +func NewSortConfig() QSortConfig { + return QSortConfig{} } func isQEntryAttribute(attributeName string) bool { @@ -30,7 +30,7 @@ func isQEntryAttribute(attributeName string) bool { return isValidAttribute } -func (c QEntrySortConfig) By(attributeName string, order string) (QEntrySortConfig, error) { +func (c QSortConfig) By(attributeName string, order string) (QSortConfig, error) { if !isQEntryAttribute(attributeName) { return c, errors.New(fmt.Sprintf("Invalid sort attribute: '%s' given!", attributeName)) } @@ -42,7 +42,7 @@ func (c QEntrySortConfig) By(attributeName string, order string) (QEntrySortConf return c, nil } -func (queue MailQ) Sort(config QEntrySortConfig) { +func (queue MailQ) Sort(config QSortConfig) { if len(config.attributes) == 0 { return } diff --git a/main.go b/main.go index 153a272..b373090 100644 --- a/main.go +++ b/main.go @@ -39,7 +39,7 @@ func parseArguments() { settings["usePager"] = strconv.FormatBool(*usePagerPtr) } -func defaultSortConfig() mailq.QEntrySortConfig { +func defaultSortConfig() mailq.QSortConfig { sortConfig := mailq.NewSortConfig() sortConfig, _ = sortConfig.By("Status", "ASC") sortConfig, _ = sortConfig.By("Sender", "ASC") @@ -47,7 +47,7 @@ func defaultSortConfig() mailq.QEntrySortConfig { return sortConfig } -func showQueue(sortConfig mailq.QEntrySortConfig) { +func showQueue(sortConfig mailq.QSortConfig) { queue, err := fetchQueue() if err != nil { fmt.Printf("Could not fetch queue entries: %s\n", err.Error()) diff --git a/shell.go b/shell.go index 20f5f79..7032ecf 100644 --- a/shell.go +++ b/shell.go @@ -12,7 +12,7 @@ import ( ) type shellState struct { - SortConfig mailq.QEntrySortConfig + SortConfig mailq.QSortConfig QuitShell bool Queue mailq.MailQ }