aboutsummaryrefslogtreecommitdiffstats
path: root/config/config.go
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2019-03-15 01:12:06 -0400
committerDrew DeVault <sir@cmpwn.com>2019-03-15 01:31:23 -0400
commit8d20e9218ece5927d786d6e2fac5c50572fb9c81 (patch)
treee4cdf0ba821dccbb510f169c7731ae78ce987830 /config/config.go
parentd274bf926c79ec834afcac00dab3f95f8bd5325f (diff)
downloadaerc-8d20e9218ece5927d786d6e2fac5c50572fb9c81.tar.gz
Implement key bindings subsystem
Which is not yet rigged up
Diffstat (limited to 'config/config.go')
-rw-r--r--config/config.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/config/config.go b/config/config.go
index 142a1e00..ff0e0940 100644
--- a/config/config.go
+++ b/config/config.go
@@ -29,6 +29,7 @@ type AccountConfig struct {
}
type AercConfig struct {
+ Lbinds *KeyBindings
Ini *ini.File `ini:"-"`
Accounts []AccountConfig `ini:"-"`
Ui UIConfig
@@ -94,7 +95,9 @@ func LoadConfig(root *string) (*AercConfig, error) {
}
file.NameMapper = mapName
config := &AercConfig{
- Ini: file,
+ Lbinds: NewKeyBindings(),
+ Ini: file,
+
Ui: UIConfig{
IndexFormat: "%4C %Z %D %-17.17n %s",
TimestampFormat: "%F %l:%M %p",
@@ -110,9 +113,18 @@ func LoadConfig(root *string) (*AercConfig, error) {
EmptyMessage: "(no messages)",
},
}
- if ui, err := file.GetSection("ui"); err != nil {
+ if ui, err := file.GetSection("ui"); err == nil {
ui.MapTo(config.Ui)
}
+ if lbinds, err := file.GetSection("lbinds"); err == nil {
+ for key, value := range lbinds.KeysHash() {
+ binding, err := ParseBinding(key, value)
+ if err != nil {
+ return nil, err
+ }
+ config.Lbinds.Add(binding)
+ }
+ }
accountsPath := path.Join(*root, "accounts.conf")
if accounts, err := loadAccountConfig(accountsPath); err != nil {
return nil, err