From d85f671bdf90dbdd725db88e5d6970630e36f9f1 Mon Sep 17 00:00:00 2001 From: "Pedro L. Ramos" Date: Sat, 13 Jul 2019 18:42:22 +0100 Subject: [PATCH] 71: Allow user to change config options at runtime There is a LoadConf and a LoadConfFromFile. LoadConfFromFile reads the iniFile into memory and and calls LoadConf, which executes the old parsing commands from LoadConf (old func). The remaining of the LoadConfFromFile is the same as the old OldConf. --- aerc.go | 2 +- commands/set.go | 69 ++++++++++++++++++++++++++++++ config/config.go | 109 +++++++++++++++++++++++++---------------------- 3 files changed, 129 insertions(+), 51 deletions(-) create mode 100644 commands/set.go diff --git a/aerc.go b/aerc.go index a248e18..dafdd22 100644 --- a/aerc.go +++ b/aerc.go @@ -121,7 +121,7 @@ func main() { logger = log.New(logOut, "", log.LstdFlags) logger.Println("Starting up aerc") - conf, err := config.LoadConfig(nil, ShareDir) + conf, err := config.LoadConfigFromFile(nil, ShareDir) if err != nil { fmt.Printf("Failed to load config: %v\n", err) os.Exit(1) diff --git a/commands/set.go b/commands/set.go new file mode 100644 index 0000000..f5366ff --- /dev/null +++ b/commands/set.go @@ -0,0 +1,69 @@ +package commands + +import ( + "errors" + "strings" + + "git.sr.ht/~sircmpwn/aerc/widgets" + + "github.com/go-ini/ini" +) + +type Set struct{} + +func setUsage() string { + return "set .