summaryrefslogtreecommitdiff
path: root/forgeConfig/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'forgeConfig/main.go')
-rw-r--r--forgeConfig/main.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/forgeConfig/main.go b/forgeConfig/main.go
index 058412d..cdd70cf 100644
--- a/forgeConfig/main.go
+++ b/forgeConfig/main.go
@@ -8,6 +8,9 @@ import (
"go.wit.com/log"
)
+// sent via ldflags
+var VERSION string
+
func main() {
var repos *forgepb.Repos
repos = new(forgepb.Repos)
@@ -15,6 +18,30 @@ func main() {
log.Warn("forgepb.ConfigLoad() failed", err)
os.Exit(-1)
}
+ if argv.List {
+ log.Info(forgepb.RepoHeader())
+ loop := repos.SortByName() // get the list of droplets
+ for loop.Scan() {
+ r := loop.Repo()
+ log.Info("repo:", r.Name, r.Gopath)
+ }
+ os.Exit(0)
+ }
+ if argv.Add {
+ log.Info("going to add a new repo", argv.Name, argv.GoPath)
+ new1 := new(forgepb.Repo)
+ new1.Name = argv.Name
+ new1.Gopath = argv.GoPath
+ if repos.Append(new1) {
+ log.Info("added", new1.Name, "ok")
+ } else {
+ log.Info("added", new1.Name, "failed")
+ os.Exit(-1)
+ }
+ repos.ConfigSave()
+ os.Exit(0)
+ }
+
testAddRepos(repos)
repos.ConfigSave()
}