summaryrefslogtreecommitdiff
path: root/init.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-15 13:42:14 -0500
committerJeff Carr <[email protected]>2025-10-15 13:42:14 -0500
commit6c958fb9c135c2e06322e0065bcdb8e4f5f4b0b2 (patch)
tree91969901842ba760b2ae53f1d39e6d55d38563ac /init.go
parent0d85a0ef02516eb9677e21390325413e4c4132e3 (diff)
housekeeping + new user behavior
Diffstat (limited to 'init.go')
-rw-r--r--init.go29
1 files changed, 21 insertions, 8 deletions
diff --git a/init.go b/init.go
index 7f1ebbe..80c9ca1 100644
--- a/init.go
+++ b/init.go
@@ -8,6 +8,7 @@ import (
"path/filepath"
"go.wit.com/lib/config"
+ "go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -66,6 +67,26 @@ func initFromConfig(cfg *ForgeConfigs) *Forge {
os.Exit(-1)
}
+ // todo: play with these / determine good values based on user's machine
+ if f.Config.RillX == 0 {
+ f.Config.RillX = 10
+ }
+ if f.Config.RillY == 0 {
+ f.Config.RillY = 20
+ }
+
+ if !shell.Exists(f.Config.ReposPB) {
+ if f.Config.Mode == ForgeMode_NEWUSER {
+ // new user. drop back to main() for an introduction
+ return f
+ }
+ // create an initial repos.pb file
+ // panic() here? // warning? // (probably not. it's just the repos.pb cache file
+ f.Repos = gitpb.NewRepos()
+ f.Repos.Filename = f.Config.ReposPB
+ f.Repos.Save()
+ }
+
f.Repos = gitpb.NewRepos()
f.Repos.ConfigLoad(f.Config.ReposPB)
@@ -83,14 +104,6 @@ func initFromConfig(cfg *ForgeConfigs) *Forge {
}
}
}
-
- // todo: play with these / determine good values based on user's machine
- if f.Config.RillX == 0 {
- f.Config.RillX = 10
- }
- if f.Config.RillY == 0 {
- f.Config.RillY = 20
- }
return f
}