diff --git a/fa2247e80b8e35024d0d42e8849b57933f63d6af b/fa2247e80b8e35024d0d42e8849b57933f63d6af deleted file mode 100644 index 3930458..0000000 --- a/fa2247e80b8e35024d0d42e8849b57933f63d6af +++ /dev/null @@ -1,528 +0,0 @@ -// `autogen:go.mod` - -module go.wit.com/toolkits/tree - -go 1.22 - -toolchain go1.23.6 - -require ( - go.wit.com/lib/protobuf/guipb v0.0.2 - go.wit.com/log v0.22.16 - go.wit.com/widget v1.1.29 - google.golang.org/protobuf v1.36.5 -) - -// `autogen:go.sum` - -github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -go.wit.com/lib/protobuf/guipb v0.0.2 h1:ZR4cLy+XheRQEFLlissBmASJDqiLfHaAluF6wYbVuOo= -go.wit.com/lib/protobuf/guipb v0.0.2/go.mod h1:mZsirb7zRgsE2IGHuvHkG7j85hkrGZl3NAALOEkjowA= -go.wit.com/log v0.22.16 h1:E0Vd0Z2ILtfjhs7J/CQ4g13DK1jtQiYl6l5KOBGsZoA= -go.wit.com/log v0.22.16/go.mod h1:/c5Uj30sWRQ4B5ei2ElB6Q8Si/cK6v+KbxnH208KD84= -go.wit.com/widget v1.1.29 h1:rURM/N1hbrl0btGlBIUx0SCre9jj+hshvkBLMMa008I= -go.wit.com/widget v1.1.29/go.mod h1:wj7TpAr2gk7Poa+v8XQkH1aidnTdgAa/a8GxrMtcztw= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= -google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= - -// `autogen:toolkitConfig.marshal.pb.go` - -// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. -// This file was autogenerated with autogenpb v0.0.52-1-g4fdcc99 2025.02.12_1512 -// go install go.wit.com/apps/autogenpb@latest -// -// define which structs (messages) you want to use in the .proto file -// Then sort.pb.go and marshal.pb.go files are autogenerated -// -// autogenpb uses it and has an example .proto file with instructions -// - -package tree - -import ( - "google.golang.org/protobuf/encoding/protojson" - "google.golang.org/protobuf/encoding/prototext" - "google.golang.org/protobuf/proto" -) - -// human readable JSON -func (v *ToolkitConfigs) FormatJSON() string { - return protojson.Format(v) -} - -// marshal json -func (v *ToolkitConfigs) MarshalJSON() ([]byte, error) { - return protojson.Marshal(v) -} - -// unmarshal json -func (v *ToolkitConfigs) UnmarshalJSON(data []byte) error { - return protojson.Unmarshal(data, v) -} - -// apparently this isn't stable, but it's awesomely better -// https://protobuf.dev/reference/go/faq/#unstable-text -// it's brilliant for config files! -func (v *ToolkitConfigs) FormatTEXT() string { - v.fixUuid() - return prototext.Format(v) -} - -// unmarshalTEXT. This reads the .text config file back in after the user edits it -func (v *ToolkitConfigs) UnmarshalTEXT(data []byte) error { - return prototext.Unmarshal(data, v) -} - -// marshal to wire. This is called winning. -func (v *ToolkitConfigs) Marshal() ([]byte, error) { - v.fixUuid() - return proto.Marshal(v) -} - -// unmarshal from wire. You have won. -func (v *ToolkitConfigs) Unmarshal(data []byte) error { - return proto.Unmarshal(data, v) -} - -// `autogen:toolkitConfig.pb.go` - -// Code modified by go.wit.com/apps/autogenpb DO NOT EDIT. -// -// user defined Mutex locks were auto added -// -// autogenpb version & build time: v0.0.52-1-g4fdcc99 2025.02.12_1512 -// autogenpb auto generates Sort(), Unique() and Marshal() functions -// go install go.wit.com/apps/autogenpb@latest - -// Copyright 2025 WIT.COM Inc Licensed GPL 3.0 - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.33.0 -// protoc v3.21.12 -// source: toolkitConfig.proto - -package tree // autogenpb changed the package name - -import ( - reflect "reflect" - sync "sync" - - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - _ "google.golang.org/protobuf/types/known/timestamppb" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type ToolkitConfig struct { - sync.RWMutex // auto-added by go.wit.com/apps/autogenpb - - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Plugin string `protobuf:"bytes,1,opt,name=plugin,proto3" json:"plugin,omitempty"` // 'gocui', 'andlabs', etc - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` // variable name 'fullscreen' - Value string `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"` // value "true" -} - -func (x *ToolkitConfig) Reset() { - *x = ToolkitConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_toolkitConfig_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToolkitConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToolkitConfig) ProtoMessage() {} - -func (x *ToolkitConfig) ProtoReflect() protoreflect.Message { - mi := &file_toolkitConfig_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToolkitConfig.ProtoReflect.Descriptor instead. -func (*ToolkitConfig) Descriptor() ([]byte, []int) { - return file_toolkitConfig_proto_rawDescGZIP(), []int{0} -} - -func (x *ToolkitConfig) GetPlugin() string { - if x != nil { - return x.Plugin - } - return "" -} - -func (x *ToolkitConfig) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ToolkitConfig) GetValue() string { - if x != nil { - return x.Value - } - return "" -} - -type ToolkitConfigs struct { - // sync.RWMutex // skipped. protobuf file has `autogenpb:nomutex` - - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid,omitempty"` // `autogenpb:uuid:d7886d47-a3b9-43b9-b0f6-17074a9844e6` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // `autogenpb:version:v0.0.1` - ToolkitConfigs []*ToolkitConfig `protobuf:"bytes,3,rep,name=ToolkitConfigs,proto3" json:"ToolkitConfigs,omitempty"` -} - -func (x *ToolkitConfigs) Reset() { - *x = ToolkitConfigs{} - if protoimpl.UnsafeEnabled { - mi := &file_toolkitConfig_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ToolkitConfigs) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ToolkitConfigs) ProtoMessage() {} - -func (x *ToolkitConfigs) ProtoReflect() protoreflect.Message { - mi := &file_toolkitConfig_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use ToolkitConfigs.ProtoReflect.Descriptor instead. -func (*ToolkitConfigs) Descriptor() ([]byte, []int) { - return file_toolkitConfig_proto_rawDescGZIP(), []int{1} -} - -func (x *ToolkitConfigs) GetUuid() string { - if x != nil { - return x.Uuid - } - return "" -} - -func (x *ToolkitConfigs) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -func (x *ToolkitConfigs) GetToolkitConfigs() []*ToolkitConfig { - if x != nil { - return x.ToolkitConfigs - } - return nil -} - -var File_toolkitConfig_proto protoreflect.FileDescriptor - -var file_toolkitConfig_proto_rawDesc = []byte{ - 0x0a, 0x13, 0x74, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x07, 0x66, 0x6f, 0x72, 0x67, 0x65, 0x70, 0x62, 0x1a, 0x1f, - 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, - 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, - 0x51, 0x0a, 0x0d, 0x54, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, - 0x12, 0x16, 0x0a, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x22, 0x7e, 0x0a, 0x0e, 0x54, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x75, 0x75, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, - 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, - 0x6f, 0x6e, 0x12, 0x3e, 0x0a, 0x0e, 0x54, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x66, 0x6f, 0x72, - 0x67, 0x65, 0x70, 0x62, 0x2e, 0x54, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, - 0x69, 0x67, 0x52, 0x0e, 0x54, 0x6f, 0x6f, 0x6c, 0x6b, 0x69, 0x74, 0x43, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_toolkitConfig_proto_rawDescOnce sync.Once - file_toolkitConfig_proto_rawDescData = file_toolkitConfig_proto_rawDesc -) - -func file_toolkitConfig_proto_rawDescGZIP() []byte { - file_toolkitConfig_proto_rawDescOnce.Do(func() { - file_toolkitConfig_proto_rawDescData = protoimpl.X.CompressGZIP(file_toolkitConfig_proto_rawDescData) - }) - return file_toolkitConfig_proto_rawDescData -} - -var file_toolkitConfig_proto_msgTypes = make([]protoimpl.MessageInfo, 2) -var file_toolkitConfig_proto_goTypes = []interface{}{ - (*ToolkitConfig)(nil), // 0: forgepb.ToolkitConfig - (*ToolkitConfigs)(nil), // 1: forgepb.ToolkitConfigs -} -var file_toolkitConfig_proto_depIdxs = []int32{ - 0, // 0: forgepb.ToolkitConfigs.ToolkitConfigs:type_name -> forgepb.ToolkitConfig - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_toolkitConfig_proto_init() } -func file_toolkitConfig_proto_init() { - if File_toolkitConfig_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_toolkitConfig_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToolkitConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_toolkitConfig_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ToolkitConfigs); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_toolkitConfig_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_toolkitConfig_proto_goTypes, - DependencyIndexes: file_toolkitConfig_proto_depIdxs, - MessageInfos: file_toolkitConfig_proto_msgTypes, - }.Build() - File_toolkitConfig_proto = out.File - file_toolkitConfig_proto_rawDesc = nil - file_toolkitConfig_proto_goTypes = nil - file_toolkitConfig_proto_depIdxs = nil -} - -// `autogen:toolkitConfig.sort.pb.go` - -// Code generated by go.wit.com/apps/autogenpb DO NOT EDIT. -// This file was autogenerated with autogenpb v0.0.52-1-g4fdcc99 2025.02.12_1512 -// go install go.wit.com/apps/autogenpb@latest -// -// define which structs (messages) you want to use in the .proto file -// Then sort.pb.go and marshal.pb.go files are autogenerated -// -// autogenpb uses it and has an example .proto file with instructions -// - -package tree - -import ( - "fmt" - "sync" -) - -// a simple global lock -var toolkitConfigMu sync.RWMutex - -func (x *ToolkitConfigs) fixUuid() { - if x == nil { - return - } - if x.Uuid == "d7886d47-a3b9-43b9-b0f6-17074a9844e6" { - return - } - x.Uuid = "d7886d47-a3b9-43b9-b0f6-17074a9844e6" - x.Version = "v0.0.1 go.wit.com/toolkits/tree" -} - -func NewToolkitConfigs() *ToolkitConfigs { - x := new(ToolkitConfigs) - x.Uuid = "d7886d47-a3b9-43b9-b0f6-17074a9844e6" - x.Version = "v0.0.1 go.wit.com/toolkits/tree" - return x -} - -// START SORT - -// DEFINE THE ToolkitConfigs ITERATOR. -// itializes a new iterator. -func newToolkitConfigsIterator(things []*ToolkitConfigs) *ToolkitConfigsIterator { - return &ToolkitConfigsIterator{things: things} -} - -type ToolkitConfigsIterator struct { - sync.RWMutex // this isn't getting used properly yet? - - things []*ToolkitConfigs - index int -} - -func (it *ToolkitConfigsIterator) Scan() bool { - if it.index >= len(it.things) { - return false - } - it.index++ - return true -} - -// Next() returns the next thing in the array -func (it *ToolkitConfigsIterator) Next() *ToolkitConfigs { - if it.things[it.index-1] == nil { - fmt.Println("Next() error in ToolkitConfigsIterator", it.index) - } - return it.things[it.index-1] -} - -// END DEFINE THE ITERATOR - -// DEFINE THE ToolkitConfig ITERATOR. -// itializes a new iterator. -func newToolkitConfigIterator(things []*ToolkitConfig) *ToolkitConfigIterator { - return &ToolkitConfigIterator{things: things} -} - -type ToolkitConfigIterator struct { - sync.RWMutex // this isn't getting used properly yet? - - things []*ToolkitConfig - index int -} - -func (it *ToolkitConfigIterator) Scan() bool { - if it.index >= len(it.things) { - return false - } - it.index++ - return true -} - -// Next() returns the next thing in the array -func (it *ToolkitConfigIterator) Next() *ToolkitConfig { - if it.things[it.index-1] == nil { - fmt.Println("Next() error in ToolkitConfigIterator", it.index) - } - return it.things[it.index-1] -} - -// END DEFINE THE ITERATOR - -// safely returns a slice of pointers to the FRUIT protobufs -func (x *ToolkitConfigs) allToolkitConfigs() []*ToolkitConfig { - toolkitConfigMu.RLock() - defer toolkitConfigMu.RUnlock() - - // Create a new slice to hold pointers to each FRUIT - var tmp []*ToolkitConfig - tmp = make([]*ToolkitConfig, len(x.ToolkitConfigs)) - for i, p := range x.ToolkitConfigs { - tmp[i] = p // Copy pointers for safe iteration - } - - return tmp -} - -// safely returns a slice of pointers to the ToolkitConfig protobufs -func (x *ToolkitConfigs) selectAllToolkitConfigs() []*ToolkitConfig { - toolkitConfigMu.RLock() - defer toolkitConfigMu.RUnlock() - - // Create a new slice to hold pointers to each ToolkitConfig - var tmp []*ToolkitConfig - tmp = make([]*ToolkitConfig, len(x.ToolkitConfigs)) - for i, p := range x.ToolkitConfigs { - tmp[i] = p // Copy pointers for safe iteration - } - - return tmp -} - -// END SORT - -func (x *ToolkitConfigs) Len() int { - toolkitConfigMu.RLock() - defer toolkitConfigMu.RUnlock() - - return len(x.ToolkitConfigs) -} - -// just a simple Append() shortcut (but still uses the mutex lock) -func (x *ToolkitConfigs) Append(y *ToolkitConfig) { - toolkitConfigMu.Lock() - defer toolkitConfigMu.Unlock() - - x.ToolkitConfigs = append(x.ToolkitConfigs, y) -} - -func (x *ToolkitConfigs) All() *ToolkitConfigIterator { - ToolkitConfigPointers := x.selectAllToolkitConfigs() - - iterator := newToolkitConfigIterator(ToolkitConfigPointers) - return iterator -} - -func (x *ToolkitConfigs) Delete(y *ToolkitConfig) bool { - toolkitConfigMu.Lock() - defer toolkitConfigMu.Unlock() - - for i, _ := range x.ToolkitConfigs { - if x.ToolkitConfigs[i] == y { - x.ToolkitConfigs[i] = x.ToolkitConfigs[len(x.ToolkitConfigs)-1] - x.ToolkitConfigs = x.ToolkitConfigs[:len(x.ToolkitConfigs)-1] - return true - } - } - return false -} - -// `autogen:`