From 3bc9beb11387f33d1bdefb56e27e3be93574fefd Mon Sep 17 00:00:00 2001 From: Carlo Strub Date: Sun, 12 Mar 2017 22:50:43 +0000 Subject: [PATCH] Store sisyphus.db in Maildir --- database.go | 4 ++-- main.go | 13 ++----------- 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/database.go b/database.go index 3318680..65985bd 100644 --- a/database.go +++ b/database.go @@ -5,11 +5,11 @@ import ( ) // openDB creates and opens a new database and its respective buckets (if required) -func openDB(path string) (db *bolt.DB, err error) { +func openDB(maildir string) (db *bolt.DB, err error) { // Open the sisyphus.db data file in your current directory. // It will be created if it doesn't exist. - db, err = bolt.Open(path, 0600, nil) + db, err = bolt.Open(maildir+"/sisyphus.db", 0600, nil) if err != nil { return db, err } diff --git a/main.go b/main.go index a20a0f3..47d638a 100644 --- a/main.go +++ b/main.go @@ -20,7 +20,7 @@ func main() { panic(err) } - var maildir, database *string + var maildir *string // Define App app := cli.NewApp() @@ -46,12 +46,6 @@ func main() { Usage: "Path to the Maildir directory", Destination: maildir, }, - cli.StringFlag{ - Name: "database", - Value: wd + "/sisyphus.db", - Usage: "Path to the sisyphus database", - Destination: database, - }, } app.Commands = []cli.Command{ @@ -60,9 +54,6 @@ func main() { Aliases: []string{"s"}, Usage: "start sisyphus daemon", Action: func(c *cli.Context) error { - if database == nil { - return errors.New("no database selected") - } if maildir == nil { return errors.New("no maildir selected") } @@ -76,7 +67,7 @@ func main() { fmt.Println(mails) // Open the database - db, err := openDB(*database) + db, err := openDB(*maildir) if err != nil { return cli.NewExitError(err, 66) }