summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-22 09:18:26 -0500
committerJeff Carr <[email protected]>2025-10-22 09:18:26 -0500
commit98f656afbc699e2c3f6cf47cdb88af31b46134a8 (patch)
tree00162a7a872a76b99a225df84898d5129e2ee0a7
parentf945380a98f0b52a4b5d1614295700a92fdd5f2b (diff)
-rw-r--r--argv.template.go3
-rw-r--r--clone.go3
-rw-r--r--main.go11
-rw-r--r--work.go7
4 files changed, 13 insertions, 11 deletions
diff --git a/argv.template.go b/argv.template.go
index e7a9948..1808722 100644
--- a/argv.template.go
+++ b/argv.template.go
@@ -10,6 +10,7 @@ import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/fhelp"
"go.wit.com/log"
)
@@ -63,7 +64,7 @@ func (args) InitGui() error {
func (args) Exit() {
gui.UnloadToolkits()
- if me.argv.Verbose() {
+ if ENV.Verbose() {
log.Info("argv.Exit() called", APPNAME+".Exit()")
}
// remove this from the template for your app (or make one for youself if you need it)
diff --git a/clone.go b/clone.go
index 3e9a7f2..5b3453e 100644
--- a/clone.go
+++ b/clone.go
@@ -7,6 +7,7 @@ import (
"path/filepath"
"strings"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
)
@@ -68,7 +69,7 @@ func clone(gopath string) (*gitpb.Repo, error) {
gopath = CleanRepoURL(gopath)
os.Setenv("REPO_AUTO_CLONE", "true")
// pb, _ := me.forge.NewGoPath(gopath)
- check := me.forge.FindAnyPath(filepath.Join(me.forge.Config.ReposDir, gopath))
+ check := me.forge.FindAnyPath(filepath.Join(ENV.Get("gopath"), gopath))
if check != nil {
if check.IsValidDir() {
// repo already exists and is valid
diff --git a/main.go b/main.go
index 0884d10..44b582c 100644
--- a/main.go
+++ b/main.go
@@ -1,8 +1,7 @@
package main
import (
- "os"
-
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/protobuf/argvpb"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
@@ -74,12 +73,12 @@ func okExit(thing string) {
log.Info(thing, "ok")
}
log.Info("Finished clone on", workingRepo.GetGoPath(), "ok")
- me.forge.ConfigSave()
- os.Exit(0)
+ me.forge.Save()
+ me.argv.GoodExit(thing)
}
func badExit(err error) {
log.Info("Total repositories:", me.forge.Repos.Len())
- log.Info("Finished go-clone with error", err, me.forge.Config.ReposDir)
- os.Exit(-1)
+ s := log.Sprintf("go-clone error in %s", ENV.Get("gopath"))
+ me.argv.BadExit(s, err)
}
diff --git a/work.go b/work.go
index fd8baeb..2983aae 100644
--- a/work.go
+++ b/work.go
@@ -1,6 +1,7 @@
package main
import (
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
)
@@ -10,10 +11,10 @@ func autoWork() {
if !argv.AutoWork {
return
}
- log.Info("About to re-create", me.forge.Config.ReposDir+"/go.work")
- shell.PathRun(me.forge.Config.ReposDir, []string{"mv", "go.work", "go.work.last"})
+ log.Info("About to re-create", ENV.Get("gopath")+"/go.work")
+ shell.PathRun(ENV.Get("gopath"), []string{"mv", "go.work", "go.work.last"})
me.forge.MakeGoWork()
- shell.PathRun(me.forge.Config.ReposDir, []string{"go", "work", "use"})
+ shell.PathRun(ENV.Get("gopath"), []string{"go", "work", "use"})
log.Info("")
log.Info("original go.work file saved as go.work.last")
log.Info("")