From ee242a3d0ffc4d9cca884a2ad9047cdd16cd713e Mon Sep 17 00:00:00 2001 From: Reto Brunner Date: Tue, 25 Jun 2019 09:23:51 +0200 Subject: add DefaultSavePath config --- config/config.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'config') diff --git a/config/config.go b/config/config.go index 9295a1d..8028224 100644 --- a/config/config.go +++ b/config/config.go @@ -18,6 +18,10 @@ import ( "github.com/kyoh86/xdg" ) +type GeneralConfig struct { + DefaultSavePath string `ini:"default-save-path"` +} + type UIConfig struct { IndexFormat string `ini:"index-format"` TimestampFormat string `ini:"timestamp-format"` @@ -85,6 +89,7 @@ type AercConfig struct { Filters []FilterConfig `ini:"-"` Viewer ViewerConfig `ini:"-"` Ui UIConfig + General GeneralConfig } // Input: TimestampFormat @@ -319,6 +324,11 @@ func LoadConfig(root *string, sharedir string) (*AercConfig, error) { return nil, err } } + if ui, err := file.GetSection("general"); err == nil { + if err := ui.MapTo(&config.General); err != nil { + return nil, err + } + } accountsPath := path.Join(*root, "accounts.conf") if accounts, err := loadAccountConfig(accountsPath); err != nil { return nil, err -- cgit v1.2.3