diff --git a/parser/parser.go b/mailq/parser.go similarity index 99% rename from parser/parser.go rename to mailq/parser.go index 1a9ad70..4de87f5 100644 --- a/parser/parser.go +++ b/mailq/parser.go @@ -1,4 +1,4 @@ -package parser +package mailq import ( "bufio" diff --git a/main.go b/main.go index 0980738..463c380 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( ) import ( - "mailq-inspector/parser" + "mailq-inspector/mailq" ) var settings = make(map[string]string) @@ -49,7 +49,7 @@ func showQueue() { fmt.Printf("Could not fetch queue entries: %s\n", err.Error()) os.Exit(1) } - sortConfig := parser.NewSortConfig().By("Status", "ASC").By("Sender", "ASC").By("Recipients", "DESC") + sortConfig := mailq.NewSortConfig().By("Status", "ASC").By("Sender", "ASC").By("Recipients", "DESC") queue.Sort(sortConfig) if settings["usePager"] == "true" { pagerReader, pagerWriter := io.Pipe() @@ -64,7 +64,7 @@ func showQueue() { } } -func printQueue(queue parser.MailQ, writer io.Writer) { +func printQueue(queue mailq.MailQ, writer io.Writer) { if settings["outputFormat"] == "human" { queue.PrintHumanReadable(writer) } else if settings["outputFormat"] == "machine" { @@ -89,7 +89,7 @@ func launchPager(reader *io.PipeReader, pagerDone chan<- bool) { } } -func fetchQueue() (parser.MailQ, error) { +func fetchQueue() (mailq.MailQ, error) { if settings["mailqCommandArgs"] == "" { return readFromCmd(exec.Command(settings["mailqCommand"])) } else { @@ -97,17 +97,17 @@ func fetchQueue() (parser.MailQ, error) { } } -func readFromCmd(cmd *exec.Cmd) (parser.MailQ, error) { +func readFromCmd(cmd *exec.Cmd) (mailq.MailQ, error) { stdout, err := cmd.StdoutPipe() if err != nil { - return parser.MailQ{}, err + return mailq.MailQ{}, err } if err := cmd.Start(); err != nil { - return parser.MailQ{}, err + return mailq.MailQ{}, err } - result, resultError := parser.ParseMailQ(stdout) + result, resultError := mailq.ParseMailQ(stdout) if err := cmd.Wait(); err != nil { - return parser.MailQ{}, err + return mailq.MailQ{}, err } return result, resultError }