diff options
| author | Jeff Carr <[email protected]> | 2025-03-25 07:28:06 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-03-25 13:17:00 -0500 |
| commit | d141b4d308f71418e8d43a58c2e04f9560db3092 (patch) | |
| tree | 57dc156187f844d078c10b98bf30e1ca3a477d7e /init.go | |
| parent | 3420aee2911af5ecfc8ee77bfff2c890b78d86ab (diff) | |
save the toolkit config options
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 23 |
1 files changed, 23 insertions, 0 deletions
@@ -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) +} |
