use forge for IsPrivate() and IsReadOnly()

This commit is contained in:
Jeff Carr 2024-11-22 08:41:37 -06:00
parent 8e73e6fd7e
commit 1735ae5826
2 changed files with 37 additions and 1 deletions

30
main.go
View File

@ -22,6 +22,18 @@ var myargs argv
func main() {
me = new(autoType)
// load the ~/.config/forge/ config
if err := me.forge.ConfigLoad(); err != nil {
log.Warn("forgepb.ConfigLoad() failed", err)
os.Exit(-1)
}
// load the ~/.config/forge/ machine file from zoopb
if err := me.machine.ConfigLoad(); err != nil {
log.Warn("zoopb.ConfigLoad() failed", err)
os.Exit(-1)
}
// parse the command line
arg.MustParse(&myargs)
@ -110,12 +122,28 @@ func main() {
// TODO: should not really be necessary directly after init()
me.repos.View.ScanRepositories()
loop := me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
if me.forge.IsReadOnly(repo.GoPath()) {
repo.Status.SetReadOnly(true)
} else {
repo.Status.SetReadOnly(false)
}
if me.forge.IsPrivate(repo.GoPath()) {
repo.Status.SetPrivate(true)
} else {
repo.Status.SetPrivate(false)
}
}
// the repo from the command line
// var myrepo *repolist.RepoRow
// find myself. the guireleaser directory is used as a working scratchpad
// for running go commands that can mess up the go.* files
loop := me.repos.View.ReposSortByName()
loop = me.repos.View.ReposSortByName()
for loop.Scan() {
repo := loop.Repo()
if repo.GoPath() == "go.wit.com/apps/guireleaser" {

View File

@ -5,6 +5,8 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/protobuf/forgepb"
"go.wit.com/lib/protobuf/zoopb"
)
var me *autoType
@ -26,6 +28,12 @@ type autoType struct {
// our view of the repositories
repos *repoWindow
// your customized repo preferences and settings
forge forgepb.Repos
// use zookeeper to get the list of installed packages
machine zoopb.Machine
// #### autotypist Global Build Options
// what to change all the branches to
// so, as a developer, you can move all the repos