more code cleanups

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-30 21:54:51 -06:00
parent b6d8130333
commit 3dcb168348
1 changed files with 9 additions and 3 deletions

View File

@ -3,7 +3,9 @@ package main
import (
"io/ioutil"
"os"
"os/user"
"path/filepath"
"strings"
"go.wit.com/gui"
@ -40,7 +42,9 @@ func splitLine(line string) (string, string, string, string) {
}
func myrepolist() []string {
content, _ := ioutil.ReadFile("/home/jcarr/.config/myrepolist")
homeDir, _ := os.UserHomeDir()
cfgfile := filepath.Join(homeDir, ".config/myrepolist")
content, _ := ioutil.ReadFile(cfgfile)
out := string(content)
out = strings.TrimSpace(out)
lines := strings.Split(out, "\n")
@ -166,6 +170,8 @@ func repolistWindow() {
reposgrid.NewLabel("Show()")
usr, _ := user.Current()
repos := myrepolist()
for _, line := range repos {
log.Verbose("repo =", line)
@ -176,19 +182,19 @@ func repolistWindow() {
if dbranch == "" {
dbranch = "devel"
}
usr, _ := user.Current()
if ubranch == "" {
ubranch = usr.Username
}
addRepo(reposgrid, path, mbranch, dbranch, ubranch)
}
// TODO: figure out why this borks everything
/*
for i, path := range repostatus.ListGitDirectories() {
// log.Info("addRepo()", i, path)
tmp := strings.TrimPrefix(path, me.goSrcPwd.String())
log.Info("addRepo()", i, tmp)
addRepo(reposgrid, tmp, "master", "master", "master")
addRepo(reposgrid, tmp, "guimaster", "guidevel", usr.Username)
}
*/