repolist/init.go

38 lines
778 B
Go
Raw Normal View History

package repolist
import (
"go.wit.com/gui"
2024-11-28 18:36:00 -06:00
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/log"
)
2024-11-28 19:57:03 -06:00
func Init(f *forgepb.Forge, g *gui.Node) *RepoList {
me = new(RepoList)
// todo: this code sucks. fix it soon
2024-11-28 19:57:03 -06:00
me.mainWindow = g.NewWindow("builds and uploads all the packages")
me.mainbox = me.mainWindow.NewBox("bw hbox", true)
// make a window with a table of all the repos
2024-11-28 19:57:03 -06:00
me.AutotypistView(me.mainbox)
me.Enable()
me.forge = f
me.viewName = "autotypist"
repos := me.forge.Repos.SortByPath()
for repos.Scan() {
repo := repos.Next()
if me.forge.IsReadOnly(repo.GoPath) {
log.Info("repo scan readonly directory:", repo.FullPath)
} else {
log.Info("repo scan writable directory:", repo.FullPath)
me.AddRepo(repo)
}
}
me.Enable()
2024-11-28 19:57:03 -06:00
return me
}