diff 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) +} |
