48 lines
744 B
Go
48 lines
744 B
Go
package fields
|
|
|
|
import (
|
|
"fmt"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
)
|
|
|
|
type ComputeModel struct {
|
|
Label string
|
|
value string
|
|
}
|
|
|
|
func NewComputeModel(label, value string) *ComputeModel {
|
|
return &ComputeModel{
|
|
Label: label,
|
|
value: value,
|
|
}
|
|
}
|
|
|
|
func (m *ComputeModel) Init() tea.Cmd {
|
|
return nil
|
|
}
|
|
|
|
func (m *ComputeModel) Update(msg tea.Msg) (FieldModel, tea.Cmd) {
|
|
return m, nil
|
|
}
|
|
|
|
func (m *ComputeModel) View() string {
|
|
return fmt.Sprintf("%s: %s", m.Label, m.value)
|
|
}
|
|
|
|
func (m *ComputeModel) Focus() {}
|
|
|
|
func (m *ComputeModel) Blur() {
|
|
|
|
}
|
|
|
|
func (m *ComputeModel) CaptureKeys() bool {
|
|
return false
|
|
}
|
|
|
|
func (m *ComputeModel) GetLabel() string {
|
|
return m.Label
|
|
}
|
|
|
|
func (m *ComputeModel) GetValue() interface{} {
|
|
return m.value
|
|
}
|