2
0
mirror of https://github.com/carlostrub/sisyphus synced 2024-10-31 09:20:15 +00:00

get lists of mail keys

This commit is contained in:
Carlo Strub 2017-02-20 22:57:33 +00:00
parent f2e326313b
commit 46e554e188
3 changed files with 42 additions and 6 deletions

8
glide.lock generated
View File

@ -1,4 +1,6 @@
hash: e01a94e522ffe651c39d713d40e62bf312605f2504949b92a96797dab5faf2f3
updated: 2017-02-20T22:22:08.238892736Z
imports: []
hash: 0fbdb475136d5d29feb99b15dafd533580a8bbbf4fcfd801ddeeeb24e9a840c0
updated: 2017-02-20T22:35:31.503897743Z
imports:
- name: github.com/luksen/maildir
version: 5297d9c3091c7d4891c9d4f6fa743d500c038d6f
testImports: []

View File

@ -1,2 +1,3 @@
package: github.com/carlostrub/sisyphus
import: []
import:
- package: github.com/luksen/maildir

37
main.go
View File

@ -1,9 +1,42 @@
package main
import (
"github.com/spf13/viper"
"fmt"
"log"
"github.com/luksen/maildir"
)
var (
// Maildirs holds a set of mail directories to handle.
Maildirs []string
)
func main() {
viper.SetConfigName("sisyphus")
Maildirs = []string{"/usr/home/cs/Maildir.TEST"}
var err error
var Bad, Good []string
for _, dir := range Maildirs {
var keysBad, keysGood []string
keysBad, err = maildir.Dir(dir + "/.Junk").Keys()
if err != nil {
log.Fatal(err)
}
Bad = append(Bad, keysBad...)
keysGood, err = maildir.Dir(dir).Keys()
if err != nil {
log.Fatal(err)
}
Good = append(Good, keysGood...)
}
fmt.Println("Bad guys:")
fmt.Println(Bad)
fmt.Println("Good guys:")
fmt.Println(Good)
}