github.com/wolfi-dev/wolfictl@v0.16.11/pkg/cli/components/advisory/field/field.go (about) 1 package field 2 3 import ( 4 "fmt" 5 6 tea "github.com/charmbracelet/bubbletea" 7 "github.com/wolfi-dev/wolfictl/pkg/advisory" 8 ) 9 10 type Field interface { 11 ID() string 12 View() string 13 IsDone() bool 14 Value() string 15 16 SetBlur() Field 17 SetFocus() (Field, tea.Cmd) 18 Update(tea.Msg) (Field, tea.Cmd) 19 UpdateRequest(request advisory.Request) advisory.Request 20 SubmitValue() (Field, error) 21 } 22 23 type ErrValueNotAccepted struct { 24 Value string 25 Reason error 26 } 27 28 func (e ErrValueNotAccepted) Error() string { 29 return fmt.Sprintf("entered value %q is not accepted: %s", e.Value, e.Reason.Error()) 30 }