autogen more stuff

This commit is contained in:
Jeff Carr 2024-11-30 15:33:53 -06:00
parent 75dd87e307
commit 0b5687f766
5 changed files with 10 additions and 10 deletions

View File

@ -35,4 +35,4 @@ install:
make -C forgeConfig install make -C forgeConfig install
forgeConfig.pb.go: forgeConfig.proto forgeConfig.pb.go: forgeConfig.proto
autogenpb --proto forgeConfig.proto --sort "ByPath,GoPath" --marshal ForgeConfigs autogenpb --proto forgeConfig.proto

View File

@ -11,7 +11,7 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time
// for example 'zookeeper' is packaged as 'zookeeper-go' // for example 'zookeeper' is packaged as 'zookeeper-go'
// due to the prior apache foundation project. This happens and is ok! // due to the prior apache foundation project. This happens and is ok!
message ForgeConfig { message ForgeConfig {
string goPath = 1; // Examples: 'go.wit.com/apps/go-clone' or "~/mythings" or "/home/src/foo" string goPath = 1; // `autogenpb:unique` // Examples: 'go.wit.com/apps/go-clone' or "~/mythings" or "/home/src/foo"
bool writable = 2; // if you have write access to the repo bool writable = 2; // if you have write access to the repo
bool readOnly = 3; // the opposite, but needed for now because I don't know what I'm doing bool readOnly = 3; // the opposite, but needed for now because I don't know what I'm doing
@ -32,7 +32,7 @@ message ForgeConfig {
} }
// TODO: autogen 'sort', 'marshal' // TODO: autogen 'sort', 'marshal'
message ForgeConfigs { message ForgeConfigs { // `autogenpb:marshal`
string uuid = 1; // could be useful for /usr/share/file/magic someday? string uuid = 1; // could be useful for /usr/share/file/magic someday?
string version = 2; // could be used for protobuf schema change violations? string version = 2; // could be used for protobuf schema change violations?
repeated ForgeConfig ForgeConfigs = 3; repeated ForgeConfig ForgeConfigs = 3;

View File

@ -15,7 +15,7 @@ func main() {
if argv.List { if argv.List {
f.ConfigPrintTable() f.ConfigPrintTable()
loop := f.Config.SortByPath() // get the list of forge configs loop := f.Config.SortByGoPath() // get the list of forge configs
for loop.Scan() { for loop.Scan() {
r := loop.Next() r := loop.Next()
log.Info("repo:", r.GoPath) log.Info("repo:", r.GoPath)

View File

@ -41,7 +41,7 @@ func (f *Forge) ConfigPrintTable() {
panic("WTF forge == nil") panic("WTF forge == nil")
} }
log.Info(standardHeader()) log.Info(standardHeader())
loop := f.Config.SortByPath() loop := f.Config.SortByGoPath()
for loop.Scan() { for loop.Scan() {
r := loop.Next() r := loop.Next()
log.Info(f.standardHeader(r)) log.Info(f.standardHeader(r))

View File

@ -15,7 +15,7 @@ import (
) )
/* /*
func (f *Forge) SortByPath() *ForgeConfigIterator { func (f *Forge) SortByGoPath() *ForgeConfigIterator {
return f.Config.SortByPath() return f.Config.SortByPath()
} }
*/ */
@ -37,7 +37,7 @@ func (all *ForgeConfigs) UpdateGoPath(name string, gopath string) bool {
func (f *Forge) IsReadOnly(gopath string) bool { func (f *Forge) IsReadOnly(gopath string) bool {
var match *ForgeConfig var match *ForgeConfig
loop := f.Config.SortByPath() // get the list of repos loop := f.Config.SortByGoPath() // get the list of repos
for loop.Scan() { for loop.Scan() {
r := loop.Next() r := loop.Next()
if r.GoPath == gopath { if r.GoPath == gopath {
@ -98,7 +98,7 @@ func (f *Forge) DebName(gopath string) string {
// get "zookeeper" from "go.wit.com/apps/zookeeper" // get "zookeeper" from "go.wit.com/apps/zookeeper"
normalBase := filepath.Base(gopath) normalBase := filepath.Base(gopath)
loop := f.Config.SortByPath() loop := f.Config.SortByGoPath()
for loop.Scan() { for loop.Scan() {
r := loop.Next() r := loop.Next()
if r.GoPath == gopath { if r.GoPath == gopath {
@ -127,7 +127,7 @@ func (f *Forge) IsPrivate(thing string) bool {
// sort by path means the simple 'match' logic // sort by path means the simple 'match' logic
// here works in the sense the last directory match // here works in the sense the last directory match
// is the one that is used // is the one that is used
loop := f.Config.SortByPath() // get the list of repos loop := f.Config.SortByGoPath() // get the list of repos
for loop.Scan() { for loop.Scan() {
r := loop.Next() r := loop.Next()
if r.GoPath == thing { if r.GoPath == thing {
@ -168,7 +168,7 @@ func (f *Forge) IsPrivate(thing string) bool {
func (f *Forge) IsFavorite(thing string) bool { func (f *Forge) IsFavorite(thing string) bool {
var match *ForgeConfig var match *ForgeConfig
loop := f.Config.SortByPath() // get the list of repos loop := f.Config.SortByGoPath() // get the list of repos
for loop.Scan() { for loop.Scan() {
r := loop.Next() r := loop.Next()
if r.GoPath == thing { if r.GoPath == thing {