diff options
Diffstat (limited to 'forgeConfig/main.go')
| -rw-r--r-- | forgeConfig/main.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/forgeConfig/main.go b/forgeConfig/main.go index 434f222..237698c 100644 --- a/forgeConfig/main.go +++ b/forgeConfig/main.go @@ -26,6 +26,19 @@ func main() { } os.Exit(0) } + + // try to delete, then save config and exit + if argv.Delete { + if oldr := repos.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() + os.Exit(0) + } + + // try to update, then save config and exit if argv.Update { /* if repos.UpdateGoPath(argv.Name, argv.GoPath) { @@ -35,10 +48,15 @@ func main() { */ os.Exit(0) } + + // try to add, then save config and exit if argv.Add { log.Info("going to add a new repo", argv.GoPath) new1 := new(forgepb.Repo) new1.GoPath = argv.GoPath + new1.Writable = argv.Writable + new1.ReadOnly = argv.ReadOnly + new1.Directory = argv.Directory if repos.Append(new1) { log.Info("added", new1.GoPath, "ok") } else { |
