summaryrefslogtreecommitdiff
path: root/main.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 /main.go
parent2daf0189f628f7214cdc9295f898c355636ef9a3 (diff)
handles forge running for the first time
Diffstat (limited to 'main.go')
-rw-r--r--main.go46
1 files changed, 6 insertions, 40 deletions
diff --git a/main.go b/main.go
index 65f5473..9baff99 100644
--- a/main.go
+++ b/main.go
@@ -7,9 +7,7 @@ package main
import (
"embed"
- "fmt"
- "go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/prep"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/forgepb"
@@ -30,6 +28,8 @@ var ARGNAME string = "forge"
func main() {
me = new(mainType)
+ var s string
+ var err error
// autocomplete must run before everythingi
// any writes before this to STDOUT or STDERR
@@ -39,43 +39,11 @@ func main() {
// the current forge init process
me.forge = forgepb.Init() // init forge.pb
- if !shell.Exists(me.forge.Config.ReposPB) {
- // 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?")
- }
- }
+ // checks if this is a new forge setup.
+ // if so, forge needs to configure things first
+ s, err = doNewUser()
+
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: forge --forge-rebuild")
- }
if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
me.forge.Config.DumpPB()
@@ -101,8 +69,6 @@ func main() {
log.Info("Starting forge with subcommand:", me.sh.Cmd)
//// start standard argv subcommand processing here ////
- var s string
- var err error
if argv.Dev != nil {
// first find the repos or gopaths to operate on
if argv.Dev.Config != nil {