summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-25 07:28:06 -0500
committerJeff Carr <[email protected]>2025-03-25 13:17:00 -0500
commitd141b4d308f71418e8d43a58c2e04f9560db3092 (patch)
tree57dc156187f844d078c10b98bf30e1ca3a477d7e /init.go
parent3420aee2911af5ecfc8ee77bfff2c890b78d86ab (diff)
save the toolkit config options
Diffstat (limited to 'init.go')
-rw-r--r--init.go23
1 files changed, 23 insertions, 0 deletions
diff --git a/init.go b/init.go
index 6bb8efd..8122cca 100644
--- a/init.go
+++ b/init.go
@@ -72,3 +72,26 @@ func (t *TreeInfo) ConfigFind(n string) (string, error) {
}
return "", fmt.Errorf("toolkit config %s not found", n)
}
+
+func (t *TreeInfo) ConfigSave(o *ToolkitConfig) {
+ t.configInsert(o)
+ t.config.configSave()
+}
+
+// update the config option value (or append if new record)
+func (t *TreeInfo) configInsert(newr *ToolkitConfig) {
+ all := t.config.All() // get the list of repos
+ for all.Scan() {
+ r := all.Next()
+ if t.PluginName != r.Plugin {
+ // option isn't for this plugin
+ continue
+ }
+ if newr.Name == r.Name {
+ // found the record!
+ r.Value = newr.Value
+ return
+ }
+ }
+ t.config.Append(newr)
+}