diff options
Diffstat (limited to 'forgeConfig/main.go')
| -rw-r--r-- | forgeConfig/main.go | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/forgeConfig/main.go b/forgeConfig/main.go index 76d91e0..bd65f26 100644 --- a/forgeConfig/main.go +++ b/forgeConfig/main.go @@ -11,37 +11,34 @@ import ( var VERSION string func main() { - var repos forgepb.ForgeConfigs - if err := repos.ConfigLoad(); err != nil { - log.Warn("forgepb.ConfigLoad() failed", err) - os.Exit(-1) - } + var f forgepb.Forge + f.Init() if argv.List { - repos.PrintTable() - loop := repos.SortByPath() // get the list of repos - for loop.Scan() { - r := loop.Next() - log.Info("repo:", r.GoPath) - } + f.PrintTable() + loop := f.SortByPath() // get the list of forge configs + for loop.Scan() { + r := loop.Next() + log.Info("repo:", r.GoPath) + } os.Exit(0) } // try to delete, then save config and exit if argv.Delete { - if oldr := repos.DeleteByPath(argv.GoPath); oldr == nil { + if oldr := f.Config.DeleteByPath(argv.GoPath); oldr == nil { log.Info("deleted", argv.GoPath, "did not exist. did nothing") os.Exit(0) } log.Info("deleted", argv.GoPath, "ok") - repos.ConfigSave() + f.ConfigSave() os.Exit(0) } // try to update, then save config and exit if argv.Update { /* - if repos.UpdateGoPath(argv.Name, argv.GoPath) { + if f.UpdateGoPath(argv.Name, argv.GoPath) { // save updated config file repos.ConfigSave() } @@ -62,18 +59,18 @@ func main() { Interesting: argv.Interesting, } - if repos.Append(&new1) { + if f.Config.Append(&new1) { log.Info("added", new1.GoPath, "ok") } else { log.Info("added", new1.GoPath, "failed") os.Exit(-1) } - repos.ConfigSave() + f.ConfigSave() os.Exit(0) } - // testMemoryCorruption(repos) - repos.ConfigSave() + // testMemoryCorruption(f) + f.ConfigSave() } /* |
