testGui example seems to work

This commit is contained in:
Jeff Carr 2024-11-28 21:03:23 -06:00
parent 931e345895
commit 8893af7740
5 changed files with 20 additions and 13 deletions

View File

@ -99,6 +99,10 @@ func (r *RepoRow) IsDirty() bool {
return r.Status.IsDirty() return r.Status.IsDirty()
} }
func (r *RepoRow) RepoType() string {
return r.pb.RepoType()
}
func (r *RepoRow) ReadOnly() bool { func (r *RepoRow) ReadOnly() bool {
if r == nil { if r == nil {
log.Warn("ReadOnly() repo == nil") log.Warn("ReadOnly() repo == nil")

View File

@ -98,25 +98,26 @@ func (r *RepoList) NewRepo(path string) (*RepoRow, error) {
*/ */
// adds a gui row to the table based off the repo protobuf // adds a gui row to the table based off the repo protobuf
func (r *RepoList) AddRepo(repo *gitpb.Repo) (*RepoRow, error) { func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {
test, ok := r.allrepos[repo.GetGoPath()] test, ok := r.allrepos[pb.GetGoPath()]
if ok { if ok {
// this repo already exists // this repo already exists
return test, nil return test, nil
} }
status, err := repostatus.NewRepoStatusWindow(repo) status, err := repostatus.NewRepoStatusWindow(pb)
if err != nil { if err != nil {
return nil, err return nil, err
} }
newRepo := new(RepoRow) newRepo := new(RepoRow)
newRepo.Status = status newRepo.Status = status
newRepo.pb = pb
newRepo.Status.InitOk = false newRepo.Status.InitOk = false
newRepo.pLabel = r.reposgrid.NewLabel(repo.GoPath).SetProgName("path") newRepo.pLabel = r.reposgrid.NewLabel(pb.GoPath).SetProgName("path")
newRepo.hidden = false newRepo.hidden = false
r.allrepos[repo.GoPath] = newRepo r.allrepos[pb.GoPath] = newRepo
newRepo.NewScan() newRepo.NewScan()
switch r.viewName { switch r.viewName {

View File

@ -6,6 +6,7 @@ import (
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/gui/repostatus" "go.wit.com/lib/gui/repostatus"
"go.wit.com/lib/protobuf/forgepb" "go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/gitpb"
) )
var me *RepoList var me *RepoList
@ -53,6 +54,7 @@ type RepoRow struct {
lasttagrev string lasttagrev string
// lasttag string // lasttag string
giturl string giturl string
pb *gitpb.Repo
pLabel *gui.Node // path label pLabel *gui.Node // path label

View File

@ -8,7 +8,6 @@ build:
reset reset
GO111MODULE=off go build \ GO111MODULE=off go build \
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
./testGui --no-gui --list
vet: vet:
GO111MODULE=off go vet GO111MODULE=off go vet
@ -34,7 +33,7 @@ redomod:
GO111MODULE= go mod init GO111MODULE= go mod init
GO111MODULE= go mod tidy GO111MODULE= go mod tidy
list-packages: list:
./testGui --no-gui --list ./testGui --no-gui --list
pull: build pull: build

View File

@ -22,12 +22,6 @@ func main() {
me.forge = forgepb.Init() me.forge = forgepb.Init()
me.forge.ConfigPrintTable() me.forge.ConfigPrintTable()
if err := me.forge.Machine.ConfigLoad(); err != nil {
log.Warn("zoopb.ConfigLoad() failed", err)
os.Exit(-1)
}
me.forge.Machine.InitWit()
// setup the GUI // setup the GUI
me.myGui = gui.New() me.myGui = gui.New()
me.myGui.Default() me.myGui.Default()
@ -42,6 +36,13 @@ func main() {
rloop := me.repoList.ReposSortByName() rloop := me.repoList.ReposSortByName()
for rloop.Scan() { for rloop.Scan() {
repo := rloop.Repo() repo := rloop.Repo()
repotype := repo.RepoType()
if repotype != "binary" {
// we only want to process golang binaries where package == 'main'
// log.Info("skipping repo", repo.GoPath(), repotype)
continue
}
// var cmd []string // var cmd []string
var start string var start string
var end string var end string