repolist/init.go

63 lines
1.3 KiB
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"
)
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"
2024-12-17 06:36:28 -06:00
repos := me.forge.Repos.SortByFullPath()
for repos.Scan() {
repo := repos.Next()
2024-12-17 06:36:28 -06:00
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
2024-12-23 02:42:07 -06:00
// log.Info("repo scan readonly directory:", repo.FullPath)
} else {
2024-12-23 02:42:07 -06:00
// log.Info("repo scan writable directory:", repo.FullPath)
me.AddRepo(repo)
}
}
me.Enable()
2024-11-28 19:57:03 -06:00
return me
}
2024-11-29 22:38:22 -06:00
func InitBox(f *forgepb.Forge, newbox *gui.Node) *RepoList {
me = new(RepoList)
// make a window with a table of all the repos
me.AutotypistView(newbox)
me.Enable()
me.forge = f
me.viewName = "autotypist"
2024-12-17 06:36:28 -06:00
repos := me.forge.Repos.SortByFullPath()
2024-11-29 22:38:22 -06:00
for repos.Scan() {
repo := repos.Next()
2024-12-17 06:36:28 -06:00
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
2024-12-23 02:42:07 -06:00
// log.Info("repo scan readonly directory:", repo.FullPath)
2024-11-29 22:38:22 -06:00
} else {
2024-12-23 02:42:07 -06:00
// log.Info("repo scan writable directory:", repo.FullPath)
2024-11-29 22:38:22 -06:00
me.AddRepo(repo)
}
}
me.Enable()
return me
}