summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-21 06:40:33 -0500
committerJeff Carr <[email protected]>2025-10-21 06:40:33 -0500
commit46aae682f88cd9171e81d536d85436c2b6cfc469 (patch)
tree7cf3dec84ef4342c1ca09e5a4a7b7a09e92133bd
parent9941532f439ac9774803db3328b66b158654efaf (diff)
use lib/ENV
-rw-r--r--doGui.go14
-rw-r--r--doNewUser.go4
-rw-r--r--doNormal.go11
-rw-r--r--doPatch.go6
-rw-r--r--doStats.go8
-rw-r--r--doVerify.go4
-rw-r--r--structs.go4
-rw-r--r--windowHowto.go6
8 files changed, 29 insertions, 28 deletions
diff --git a/doGui.go b/doGui.go
index 92192d3..657ddd0 100644
--- a/doGui.go
+++ b/doGui.go
@@ -11,7 +11,7 @@ import (
"time"
"go.wit.com/gui"
- "go.wit.com/lib/config"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/shell"
"go.wit.com/lib/protobuf/gitpb"
@@ -26,24 +26,24 @@ func doGui() {
}
grid := win.Group.RawGrid()
- if config.True("PathLock") {
+ if ENV.True("PathLock") {
me.goSrcPwd = gadgets.NewOneLiner(grid, "Working Directory")
- me.goSrcPwd.SetText(config.Get("gopath"))
+ me.goSrcPwd.SetText(ENV.Get("gopath"))
} else {
me.goSrcEdit = gadgets.NewBasicEntry(grid, "Working Directory")
- me.goSrcEdit.SetText(config.Get("gopath"))
+ me.goSrcEdit.SetText(ENV.Get("gopath"))
me.goSrcEdit.Custom = func() {
log.Info("updating text to", me.goSrcEdit.String())
}
}
- lockpath := grid.NewCheckbox("Lock").SetChecked(config.True("PathLock"))
+ lockpath := grid.NewCheckbox("Lock").SetChecked(ENV.True("PathLock"))
lockpath.Custom = func() {
if lockpath.IsChecked() {
log.Info("lock working directory")
- config.Set("PathLock", "true")
+ ENV.Set("PathLock", "true")
} else {
log.Info("unlock working directory")
- config.Set("PathLock", "false")
+ ENV.Set("PathLock", "false")
}
me.forge.ConfigSave()
okExit("you must restart forge after changing the Path Lock")
diff --git a/doNewUser.go b/doNewUser.go
index bba0a1e..f1ee259 100644
--- a/doNewUser.go
+++ b/doNewUser.go
@@ -10,7 +10,7 @@ import (
"fmt"
"path/filepath"
- "go.wit.com/lib/config"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
@@ -40,7 +40,7 @@ func doNewUser() (string, error) {
log.Info("")
log.Info(string(pfile))
- gosrc := filepath.Join(config.Get("homedir"), "go/src")
+ gosrc := filepath.Join(ENV.Get("homedir"), "go/src")
s = fmt.Sprintf("Scan %s for .git repos", gosrc)
if fhelp.QuestionUser(s) {
me.forge.ScanRepoDir(gosrc) // looks for new dirs, checks existing repos for changes
diff --git a/doNormal.go b/doNormal.go
index 849122e..d9aee18 100644
--- a/doNormal.go
+++ b/doNormal.go
@@ -12,6 +12,7 @@ import (
"strings"
"time"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/config"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/gui/shell"
@@ -27,7 +28,7 @@ func doNormalAll() (string, error) {
var err error
me.curpatches = forgepb.NewPatches()
- me.curpatches.Filename = config.Get("curpatches")
+ me.curpatches.Filename = ENV.Get("curpatches")
if me.curpatches.Filename == "" {
panic("config failed. no 'curpatches' set in ~/.config/forge/config.text")
}
@@ -39,7 +40,7 @@ func doNormalAll() (string, error) {
// return
// // THIS IS NEEDED? NOTSURE
me.curpatches = forgepb.NewPatches()
- me.curpatches.Filename = config.Get("curpatches")
+ me.curpatches.Filename = ENV.Get("curpatches")
me.curpatches.Save()
}
@@ -155,11 +156,11 @@ func doNormalStatus() bool {
// this also verifies that
func checkNormalRepoState(repo *gitpb.Repo) error {
var err error
- tmp := filepath.Join(config.Get("gopath"), repo.GetNamespace())
+ tmp := filepath.Join(ENV.Get("gopath"), repo.GetNamespace())
if tmp != repo.FullPath {
log.Infof("%s != %s\n", repo.FullPath, tmp)
- if strings.HasPrefix(repo.FullPath, config.Get("gopath")) {
- tmp = strings.TrimPrefix(repo.FullPath, config.Get("gopath"))
+ if strings.HasPrefix(repo.FullPath, ENV.Get("gopath")) {
+ tmp = strings.TrimPrefix(repo.FullPath, ENV.Get("gopath"))
tmp = strings.Trim(tmp, "/")
repo.Namespace = tmp
err = log.Errorf("namespace set to filepath")
diff --git a/doPatch.go b/doPatch.go
index 9d5cedc..3e82cd1 100644
--- a/doPatch.go
+++ b/doPatch.go
@@ -13,7 +13,7 @@ import (
"regexp"
"strings"
- "go.wit.com/lib/config"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
@@ -38,7 +38,7 @@ func isPatchingSafe() bool {
func doPatch() (string, error) {
// var changed bool
me.curpatches = forgepb.NewPatches()
- me.curpatches.Filename = config.Get("curpatches")
+ me.curpatches.Filename = ENV.Get("curpatches")
if me.curpatches.Filename == "" {
panic("config failed. no 'curpatches' set in ~/.config/forge/config.text")
}
@@ -50,7 +50,7 @@ func doPatch() (string, error) {
// return
// // THIS IS NEEDED? NOTSURE
me.curpatches = forgepb.NewPatches()
- me.curpatches.Filename = config.Get("curpatches")
+ me.curpatches.Filename = ENV.Get("curpatches")
me.curpatches.Save()
}
diff --git a/doStats.go b/doStats.go
index 21847be..3a5ce67 100644
--- a/doStats.go
+++ b/doStats.go
@@ -7,8 +7,8 @@ import (
"errors"
"strings"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/cobol"
- "go.wit.com/lib/config"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
"google.golang.org/protobuf/types/known/timestamppb"
@@ -102,7 +102,7 @@ func refHash(r *gitpb.Repo, name string) (string, error) {
cmdout := r.Run(cmd)
for i, line := range cmdout.Stdout {
parts := strings.Fields(line)
- if config.If("stats") {
+ if ENV.If("stats") {
log.Info(parts[0], "LINE:", i, line)
}
hash = parts[0]
@@ -139,14 +139,14 @@ func last100(r *gitpb.Repo, pb *gitpb.Stats) (int, error) {
var counter int
cmd := []string{"git", "log", "-n", "100", makeFmts(), "origin/" + r.GetMasterBranchName()} // must use 'master' as queried from the git server
// cmd := []string{"git", "log", "-n", "100", makeFmts(), "origin/HEAD"} // HEAD is _NOT_ always set
- if config.If("stats") {
+ if ENV.If("stats") {
log.Info("Run:", cmd)
}
cmdout := r.Run(cmd)
for i, line := range cmdout.Stdout {
parts := strings.Split(line, standardSeperator)
hash := parts[0]
- if config.If("stats") {
+ if ENV.If("stats") {
log.Printf("LINE:%8.8s %2d %v\n", hash, i, parts[1:])
}
found := pb.FindByHash(hash)
diff --git a/doVerify.go b/doVerify.go
index 72c7f1d..c9b9cc4 100644
--- a/doVerify.go
+++ b/doVerify.go
@@ -7,7 +7,7 @@ import (
"errors"
"path/filepath"
- "go.wit.com/lib/config"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/protobuf/argvpb"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
@@ -30,7 +30,7 @@ func doVerify() (string, error) {
func cleanNamespace(r *gitpb.Repo) string {
// check for GO repos
- gowork := config.Get("gopath")
+ gowork := ENV.Get("gopath")
// todo: detect if using go.work file
newpath, err := filepath.Rel(gowork, r.FullPath)
// log.Info("cleanNamespace()", newpath, gowork, "is gowork. fullpath:", r.FullPath)
diff --git a/structs.go b/structs.go
index b2b6b9b..64926fc 100644
--- a/structs.go
+++ b/structs.go
@@ -6,7 +6,7 @@ package main
import (
"go.wit.com/dev/alexflint/arg"
"go.wit.com/gui"
- "go.wit.com/lib/config"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/fhelp"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/protobuf/argvpb"
@@ -27,7 +27,7 @@ func (b *mainType) Enable() {
// returns the server to connect to
func myServer() string {
- return config.Get("ForgeURL")
+ return ENV.Get("ForgeURL")
}
// this app's variables
diff --git a/windowHowto.go b/windowHowto.go
index 64578d1..6a947d1 100644
--- a/windowHowto.go
+++ b/windowHowto.go
@@ -6,7 +6,7 @@ package main
// An app to submit patches for the 30 GO GUI repos
import (
- "go.wit.com/lib/config"
+ "go.wit.com/lib/ENV"
"go.wit.com/lib/gadgets"
)
@@ -37,10 +37,10 @@ func makeHowtoWin() *gadgets.GenericWindow {
grid.NewLabel("") // a stupid way to add padding
grid.NextRow()
- // howtoWin.Group.NewLabel("Working dir: " + config.Get("gopath"))
+ // howtoWin.Group.NewLabel("Working dir: " + ENV.Get("gopath"))
grid = howtoWin.Group.RawGrid()
- grid.NewButton("Download into "+config.Get("gopath"), func() {
+ grid.NewButton("Download into "+ENV.Get("gopath"), func() {
howtoWin.Disable()
defer howtoWin.Enable()
doRebuildForge()