From 7b4f0639d861d104c67817e1f47816fa5e80b07d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 24 Oct 2025 18:30:50 -0500 Subject: s/ENV/env/ but ENV really is better here --- argv.template.go | 6 +++--- doBuild.go | 6 +++--- doGui.go | 16 ++++++++-------- doNewUser.go | 4 ++-- doNormal.go | 12 ++++++------ doPatch.go | 6 +++--- doShow.go | 6 +++--- doStats.go | 8 ++++---- doVerify.go | 4 ++-- exit.go | 6 +++--- main.go | 6 +++--- structs.go | 6 +++--- windowHowto.go | 6 +++--- 13 files changed, 46 insertions(+), 46 deletions(-) diff --git a/argv.template.go b/argv.template.go index 4af2c7a..681be3b 100644 --- a/argv.template.go +++ b/argv.template.go @@ -10,7 +10,7 @@ import ( "go.wit.com/dev/alexflint/arg" "go.wit.com/gui" - "go.wit.com/lib/ENV" + "go.wit.com/lib/env" "go.wit.com/lib/fhelp" "go.wit.com/log" ) @@ -64,8 +64,8 @@ func (args) InitGui() error { func (args) Exit() { gui.UnloadToolkits() - if ENV.Verbose() { - log.Info("argv.Exit() called", APPNAME+".Exit() because ENV.Verbose() == true") + if env.Verbose() { + log.Info("argv.Exit() called", APPNAME+".Exit() because env.Verbose() == true") } // remove this from the template for your app (or make one for youself if you need it) forgeExit() // custom forge shutdown function diff --git a/doBuild.go b/doBuild.go index 4575512..f72e260 100644 --- a/doBuild.go +++ b/doBuild.go @@ -6,7 +6,7 @@ package main import ( "fmt" - "go.wit.com/lib/ENV" + "go.wit.com/lib/env" "go.wit.com/log" ) @@ -14,7 +14,7 @@ import ( // so don't delete them func doBuild() error { v := []string{} - if ENV.Verbose() { + if env.Verbose() { v = []string{"-v", "-x"} } @@ -33,7 +33,7 @@ func doBuild() error { func doInstall() error { v := []string{} - if ENV.Verbose() { + if env.Verbose() { v = []string{"-v", "-x"} } diff --git a/doGui.go b/doGui.go index b230aa1..58cfce4 100644 --- a/doGui.go +++ b/doGui.go @@ -11,7 +11,7 @@ import ( "time" "go.wit.com/gui" - "go.wit.com/lib/ENV" + "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 ENV.True("PathLock") { + if env.True("PathLock") { me.goSrcPwd = gadgets.NewOneLiner(grid, "Working Directory") - me.goSrcPwd.SetText(ENV.Get("gopath")) + me.goSrcPwd.SetText(env.Get("gopath")) } else { me.goSrcEdit = gadgets.NewBasicEntry(grid, "Working Directory") - me.goSrcEdit.SetText(ENV.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(ENV.True("PathLock")) + lockpath := grid.NewCheckbox("Lock").SetChecked(env.True("PathLock")) lockpath.Custom = func() { if lockpath.IsChecked() { log.Info("lock working directory") - ENV.Set("PathLock", "true") + env.Set("PathLock", "true") } else { log.Info("unlock working directory") - ENV.Set("PathLock", "false") + env.Set("PathLock", "false") } me.forge.Save() okExit("you must restart forge after changing the Path Lock") @@ -51,7 +51,7 @@ func doGui() { grid.NextRow() - // use ENV GIT_AUTHOR + // use env GIT_AUTHOR me.gitAuthor = gadgets.NewOneLiner(grid, "Git Author") grid.NextRow() diff --git a/doNewUser.go b/doNewUser.go index 7d504ce..035e7ba 100644 --- a/doNewUser.go +++ b/doNewUser.go @@ -10,7 +10,7 @@ import ( "fmt" "path/filepath" - "go.wit.com/lib/ENV" + "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(ENV.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 cf6b64d..e297d04 100644 --- a/doNormal.go +++ b/doNormal.go @@ -12,8 +12,8 @@ import ( "strings" "time" - "go.wit.com/lib/ENV" "go.wit.com/lib/config" + "go.wit.com/lib/env" "go.wit.com/lib/fhelp" "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/forgepb" @@ -28,7 +28,7 @@ func doNormalAll() (string, error) { var err error me.curpatches = forgepb.NewPatches() - me.curpatches.Filename = ENV.Get("curpatches") + me.curpatches.Filename = env.Get("curpatches") if me.curpatches.Filename == "" { panic("config failed. no 'curpatches' set in ~/.config/forge/config.text") } @@ -40,7 +40,7 @@ func doNormalAll() (string, error) { // return // // THIS IS NEEDED? NOTSURE me.curpatches = forgepb.NewPatches() - me.curpatches.Filename = ENV.Get("curpatches") + me.curpatches.Filename = env.Get("curpatches") me.curpatches.Save() } @@ -156,11 +156,11 @@ func doNormalStatus() bool { // this also verifies that func checkNormalRepoState(repo *gitpb.Repo) error { var err error - tmp := filepath.Join(ENV.Get("gopath"), repo.GetNamespace()) + tmp := filepath.Join(env.Get("gopath"), repo.GetNamespace()) if tmp != repo.FullPath { log.Infof("checkNormalRepoState() %s != %s\n", repo.FullPath, tmp) - if strings.HasPrefix(repo.FullPath, ENV.Get("gopath")) { - tmp = strings.TrimPrefix(repo.FullPath, ENV.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 3e82cd1..3a3a688 100644 --- a/doPatch.go +++ b/doPatch.go @@ -13,7 +13,7 @@ import ( "regexp" "strings" - "go.wit.com/lib/ENV" + "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 = ENV.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 = ENV.Get("curpatches") + me.curpatches.Filename = env.Get("curpatches") me.curpatches.Save() } diff --git a/doShow.go b/doShow.go index 691dffe..6db2eb7 100644 --- a/doShow.go +++ b/doShow.go @@ -3,7 +3,7 @@ package main -import "go.wit.com/lib/ENV" +import "go.wit.com/lib/env" func doShow() (string, error) { if argv.Show.Dirty != nil { @@ -22,8 +22,8 @@ func doShow() (string, error) { } if argv.Show.ENV != nil { - footer := ENV.PrintTable() - return "Current ENV: " + footer, nil + footer := env.PrintTable() + return "Current env: " + footer, nil } if argv.Show.Mtime != nil { diff --git a/doStats.go b/doStats.go index 3a5ce67..8bc16cb 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/env" "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 ENV.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 ENV.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 ENV.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 c9b9cc4..97d7b3f 100644 --- a/doVerify.go +++ b/doVerify.go @@ -7,7 +7,7 @@ import ( "errors" "path/filepath" - "go.wit.com/lib/ENV" + "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 := ENV.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/exit.go b/exit.go index 62714a2..4f21c7c 100644 --- a/exit.go +++ b/exit.go @@ -4,7 +4,7 @@ package main import ( - "go.wit.com/lib/ENV" + "go.wit.com/lib/env" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -14,8 +14,8 @@ import ( // hopefully will allow the GUI plugins to unload properly func forgeExit() { resetTerminalTitle() - if ENV.Verbose() { - log.Info("argv.Exit() got to forge.Exit() because ENV.Verbose() was true") + if env.Verbose() { + log.Info("argv.Exit() got to forge.Exit() because env.Verbose() was true") } // me.forge.SetConfigSave(configSave) if err := me.forge.Close(); err != nil { diff --git a/main.go b/main.go index 3ae3c06..bf59e57 100644 --- a/main.go +++ b/main.go @@ -8,7 +8,7 @@ package main import ( "embed" - "go.wit.com/lib/ENV" + "go.wit.com/lib/env" "go.wit.com/lib/protobuf/argvpb" "go.wit.com/lib/protobuf/forgepb" "go.wit.com/log" @@ -20,7 +20,7 @@ import ( var resources embed.FS func doCoreChecks() { - // ENV.PrintTable() + // env.PrintTable() me.forge.RescanRepos() // looks for new dirs, checks existing repos for changes // if you are in "normal" mode, always run normal every time to catch accidental errors @@ -51,7 +51,7 @@ func main() { log.Printf("forge failure on Init err=(%v)\n", err) me.argv.BadExit("WTF", err) } - ENV.PrintTable() + env.PrintTable() if me.forge.IsModeUnknown() || me.forge.IsModeNewUser() { doNewUser() diff --git a/structs.go b/structs.go index 64926fc..39840c3 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/ENV" + "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 ENV.Get("ForgeURL") + return env.Get("ForgeURL") } // this app's variables @@ -47,7 +47,7 @@ type mainType struct { autoDryRun *gui.Node // checkbox for --dry-run goSrcPwd *gadgets.OneLiner // what is being used as primary directory for your work goSrcEdit *gadgets.BasicEntry // what is being used as primary directory for your work - gitAuthor *gadgets.OneLiner // ENV GIT_AUTHOR NAME and EMAIL + gitAuthor *gadgets.OneLiner // env GIT_AUTHOR NAME and EMAIL // these hold the branches that the user can switch all the repositories to them reposWinB *gui.Node // button that opens the repos window diff --git a/windowHowto.go b/windowHowto.go index 6a947d1..33672f9 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/ENV" + "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: " + ENV.Get("gopath")) + // howtoWin.Group.NewLabel("Working dir: " + env.Get("gopath")) grid = howtoWin.Group.RawGrid() - grid.NewButton("Download into "+ENV.Get("gopath"), func() { + grid.NewButton("Download into "+env.Get("gopath"), func() { howtoWin.Disable() defer howtoWin.Enable() doRebuildForge() -- cgit v1.2.3