summaryrefslogtreecommitdiff
path: root/doNewUser.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-15 17:55:42 -0500
committerJeff Carr <[email protected]>2025-10-15 17:55:42 -0500
commita739e4c5f4f6fbfe269b2243047fdcda1d487cb0 (patch)
tree479eca9a26bf92b64a2f66d03324098a5bd689f4 /doNewUser.go
parent2daf0189f628f7214cdc9295f898c355636ef9a3 (diff)
handles forge running for the first time
Diffstat (limited to 'doNewUser.go')
-rw-r--r--doNewUser.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/doNewUser.go b/doNewUser.go
new file mode 100644
index 0000000..9095377
--- /dev/null
+++ b/doNewUser.go
@@ -0,0 +1,63 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// An app to submit patches for the 30 GO GUI repos
+
+import (
+ "fmt"
+
+ "go.wit.com/lib/fhelp"
+ "go.wit.com/lib/gui/shell"
+ "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
+)
+
+func doNewUser() (string, error) {
+ var s string
+ var err error
+
+ if shell.Exists(me.forge.Config.ReposPB) {
+ // not a new user
+ return s, err
+ }
+
+ // very likely new user
+ pfile, _ := resources.ReadFile("resources/NEWUSER")
+ log.Info("")
+ log.Info(string(pfile))
+ s = fmt.Sprintf("Initialize forge?")
+ if fhelp.QuestionUser(s) {
+ } else {
+ me.sh.GoodExit("no? porque?")
+ }
+ if fhelp.QuestionUser("forge will not look for git repos in ~/go/src") {
+ } else {
+ me.sh.GoodExit("no? porque?")
+ }
+
+ me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
+ if me.forge.Config.Mode == forgepb.ForgeMode_NEWUSER {
+ log.Info("")
+ log.Info(" A good thing to try as a new user is to rebuild forge.")
+ log.Info(" This will attempt to download all the sources & needed tools.")
+ log.Info("")
+ log.Info(" Also, you can enable bash & zsh completion with --bash & --zsh")
+ log.Info("")
+ log.Info(" todo: make better notes here.")
+ log.Info("")
+ if fhelp.QuestionUser("test question") {
+ log.Info("question true")
+ } else {
+ log.Info("question false")
+ }
+ me.forge.Config.Mode = forgepb.ForgeMode_MASTER
+ err := me.forge.ConfigSave()
+ if err != nil {
+ log.Info("ConfigSave() failed", err)
+ }
+ }
+ me.sh.GoodExit("try running: 'forge rebuild forge' to test out that forge is working on your machine")
+ return s, err
+}