From 38ce0dbf82732590ef836767d3602db48ae345a9 Mon Sep 17 00:00:00 2001 From: Sebastien Binet Date: Thu, 16 Dec 2010 23:13:09 +0100 Subject: [PATCH] Migrate to goconfig pkg --- bindings/go/cmds/notmuch-addrlookup.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/bindings/go/cmds/notmuch-addrlookup.go b/bindings/go/cmds/notmuch-addrlookup.go index eae4b9a8..a72e5301 100644 --- a/bindings/go/cmds/notmuch-addrlookup.go +++ b/bindings/go/cmds/notmuch-addrlookup.go @@ -11,7 +11,8 @@ import "sort" // 3rd-party imports import "notmuch" -import "github.com/jteeuwen/go-pkg-ini/ini" +//import "github.com/jteeuwen/go-pkg-ini/ini" +import "github.com/kless/goconfig/config" type mail_addr_freq struct { addr string @@ -178,7 +179,7 @@ type address_matcher struct { } func new_address_matcher() *address_matcher { - var cfg *ini.Config + var cfg *config.Config var err os.Error // honor NOTMUCH_CONFIG @@ -187,13 +188,16 @@ func new_address_matcher() *address_matcher { home = os.Getenv("HOME") } - if cfg,err = ini.Load(path.Join(home, ".notmuch-config")); err != nil { + if cfg,err = config.ReadDefault(path.Join(home, ".notmuch-config")); err != nil { log.Exitf("error loading config file:",err) } - db_path := cfg.S("database", "path", "") - primary_email := cfg.S("user", "primary_email", "") - addrbook_tag := cfg.S("user", "addrbook_tag", "addressbook") + db_path,_ := cfg.String("database", "path") + primary_email,_ := cfg.String("user", "primary_email") + addrbook_tag,err := cfg.String("user", "addrbook_tag") + if err != nil { + addrbook_tag = "addressbook" + } self := &address_matcher{db:nil, user_db_path:db_path, -- 2.26.2