issue-9: moved keybindings out into a separate type
Also started working on a service which can be used to rebind keys using reflection.
This commit is contained in:
parent
cb31da3806
commit
2f89610c51
5 changed files with 102 additions and 15 deletions
32
internal/dynamo-browse/services/keybindings/service.go
Normal file
32
internal/dynamo-browse/services/keybindings/service.go
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
package keybindings
|
||||
|
||||
import "reflect"
|
||||
|
||||
type Service struct {
|
||||
keyBindingValue reflect.Value
|
||||
}
|
||||
|
||||
func NewService(keyBinding any) *Service {
|
||||
v := reflect.ValueOf(keyBinding)
|
||||
if v.Kind() != reflect.Pointer {
|
||||
panic("keyBinding must be a pointer to a struct")
|
||||
}
|
||||
|
||||
return &Service{
|
||||
keyBindingValue: v.Elem(),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Service) Rebind(name string, key string) error {
|
||||
|
||||
}
|
||||
|
||||
func (s *Service) findFieldForBinding(name string) reflect.Value {
|
||||
|
||||
}
|
||||
|
||||
func (s *Service) findFieldForBindingInGroup(group reflect.Value, name string) reflect.Value {
|
||||
for i := 0; i < group.NumField(); i++ {
|
||||
group.Field(i).Type().
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue