From e8a356fcc2a139970302996336d2f19d28e8ab2a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 20 Nov 2024 23:51:28 -0600 Subject: ReadOnly() support for wit-package --- forgeConfig/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'forgeConfig/main.go') 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 { -- cgit v1.2.3