Documentation ¶
Index ¶
- Variables
- func QuitScreen() quitScreen
- type And
- type App
- type AppExt
- type DateTime
- type ErrorScreen
- func (l *ErrorScreen) AvailableLines() int
- func (l *ErrorScreen) Body() string
- func (l *ErrorScreen) Header() string
- func (i *ErrorScreen) Lines() int
- func (l *ErrorScreen) Name() string
- func (l *ErrorScreen) OnInput(s string) Screen
- func (l *ErrorScreen) RunGui() (sc Screen, back bool, err error)
- func (i *ErrorScreen) SetOptions(opts ...ScreenOption)
- func (l *ErrorScreen) SetValue(v interface{})
- func (i *ErrorScreen) UUID() string
- type GUI
- type InputScreen
- func (l *InputScreen) AvailableLines() int
- func (l *InputScreen) Body() string
- func (l *InputScreen) Header() string
- func (i *InputScreen) Lines() int
- func (l *InputScreen) Name() string
- func (l *InputScreen) OnInput(str string) Screen
- func (l *InputScreen) RunGui() (sc Screen, back bool, err error)
- func (i *InputScreen) SetOptions(opts ...ScreenOption)
- func (l *InputScreen) SetValue(v interface{})
- func (i *InputScreen) UUID() string
- func (l *InputScreen) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- type Max
- type Min
- type MultiSelectScreen
- func (l *MultiSelectScreen) AvailableLines() int
- func (l *MultiSelectScreen) Body() string
- func (l *MultiSelectScreen) Header() string
- func (s *MultiSelectScreen) Lines() int
- func (l *MultiSelectScreen) Name() string
- func (l *MultiSelectScreen) OnInput(str string) Screen
- func (l *MultiSelectScreen) RunGui() (sc Screen, back bool, err error)
- func (i *MultiSelectScreen) SetOptions(opts ...ScreenOption)
- func (l *MultiSelectScreen) SetValue(v interface{})
- func (i *MultiSelectScreen) UUID() string
- type Multihandler
- type Option
- type Or
- type OutputScreen
- func (l *OutputScreen) AvailableLines() int
- func (l *OutputScreen) Body() string
- func (l *OutputScreen) Header() string
- func (i *OutputScreen) Lines() int
- func (l *OutputScreen) Name() string
- func (l *OutputScreen) OnInput(str string) Screen
- func (l *OutputScreen) RunGui() (sc Screen, back bool, err error)
- func (i *OutputScreen) SetOptions(opts ...ScreenOption)
- func (l *OutputScreen) SetValue(v interface{})
- func (i *OutputScreen) UUID() string
- type Regexp
- type Screen
- type ScreenOption
- type SelectScreen
- func (l *SelectScreen) AvailableLines() int
- func (l *SelectScreen) Body() string
- func (l *SelectScreen) Header() string
- func (s *SelectScreen) Lines() int
- func (l *SelectScreen) Name() string
- func (l *SelectScreen) OnInput(str string) Screen
- func (l *SelectScreen) RunGui() (sc Screen, back bool, err error)
- func (i *SelectScreen) SetOptions(opts ...ScreenOption)
- func (l *SelectScreen) SetValue(v interface{})
- func (i *SelectScreen) UUID() string
- type Validator
- type ValidatorFunc
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCanceled = fmt.Errorf("operation canceled")
Functions ¶
func QuitScreen ¶
func QuitScreen() quitScreen
Types ¶
type App ¶
type App interface { Name() string Run(firstScreen Screen) error NewPassword(question string, hd func(string) Screen) *InputScreen NewInput(question string, hd func(string) Screen) *InputScreen NewMultiSelect(question string, choices []string, hd func(s []string) Screen) *MultiSelectScreen NewOutput(message string, next func() Screen) *OutputScreen NewSelect(question string, choices []string, hd func(string) Screen) *SelectScreen NewError(message string) *ErrorScreen }
type DateTime ¶
type DateTime string
the string is the format of the expected datetime (excel format)
type ErrorScreen ¶
type ErrorScreen struct {
// contains filtered or unexported fields
}
ErrorScreen is a screen just for printing an error message
func (*ErrorScreen) AvailableLines ¶
func (l *ErrorScreen) AvailableLines() int
func (*ErrorScreen) Body ¶
func (l *ErrorScreen) Body() string
func (*ErrorScreen) Header ¶
func (l *ErrorScreen) Header() string
func (*ErrorScreen) Lines ¶
func (i *ErrorScreen) Lines() int
func (*ErrorScreen) Name ¶
func (l *ErrorScreen) Name() string
func (*ErrorScreen) OnInput ¶
func (l *ErrorScreen) OnInput(s string) Screen
func (*ErrorScreen) SetOptions ¶
func (i *ErrorScreen) SetOptions(opts ...ScreenOption)
func (*ErrorScreen) SetValue ¶
func (l *ErrorScreen) SetValue(v interface{})
func (*ErrorScreen) UUID ¶
func (i *ErrorScreen) UUID() string
type GUI ¶
type GUI interface { Input(msg string, prefilled string, hideText bool) (res string, back bool, err error) Select(msg string, items []string, selected string) (res string, back bool, err error) MultiSelect(msg string, items []string, preselected []string) (res []string, back bool, err error) Output(msg string) (back bool, err error) Error(msg string) SetApp(a AppExt) }
type InputScreen ¶
type InputScreen struct {
// contains filtered or unexported fields
}
InputScreen is a Screen that allows user input
func (*InputScreen) AvailableLines ¶
func (l *InputScreen) AvailableLines() int
func (*InputScreen) Body ¶
func (l *InputScreen) Body() string
func (*InputScreen) Header ¶
func (l *InputScreen) Header() string
func (*InputScreen) Lines ¶
func (i *InputScreen) Lines() int
func (*InputScreen) Name ¶
func (l *InputScreen) Name() string
func (*InputScreen) OnInput ¶
func (l *InputScreen) OnInput(str string) Screen
func (*InputScreen) SetOptions ¶
func (i *InputScreen) SetOptions(opts ...ScreenOption)
func (*InputScreen) SetValue ¶
func (l *InputScreen) SetValue(v interface{})
func (*InputScreen) UUID ¶
func (i *InputScreen) UUID() string
type MultiSelectScreen ¶
type MultiSelectScreen struct {
// contains filtered or unexported fields
}
MultiSelectScreen is a Screen that allows to choose more than one option of a given number of options
func (*MultiSelectScreen) AvailableLines ¶
func (l *MultiSelectScreen) AvailableLines() int
func (*MultiSelectScreen) Body ¶
func (l *MultiSelectScreen) Body() string
func (*MultiSelectScreen) Header ¶
func (l *MultiSelectScreen) Header() string
func (*MultiSelectScreen) Lines ¶
func (s *MultiSelectScreen) Lines() int
func (*MultiSelectScreen) Name ¶
func (l *MultiSelectScreen) Name() string
func (*MultiSelectScreen) OnInput ¶
func (l *MultiSelectScreen) OnInput(str string) Screen
func (*MultiSelectScreen) RunGui ¶
func (l *MultiSelectScreen) RunGui() (sc Screen, back bool, err error)
func (*MultiSelectScreen) SetOptions ¶
func (i *MultiSelectScreen) SetOptions(opts ...ScreenOption)
func (*MultiSelectScreen) SetValue ¶
func (l *MultiSelectScreen) SetValue(v interface{})
func (*MultiSelectScreen) UUID ¶
func (i *MultiSelectScreen) UUID() string
type Multihandler ¶
type Option ¶
type Option func(s *app)
func WithBackNavigation ¶
func WithBackNavigation() Option
func WithBreadcrumb ¶
func WithBreadcrumb() Option
func WithFooter ¶
func WithFooter() Option
func WithHeader ¶
func WithHeader() Option
type OutputScreen ¶
type OutputScreen struct {
// contains filtered or unexported fields
}
OutputScreen is a screen just for printing
func (*OutputScreen) AvailableLines ¶
func (l *OutputScreen) AvailableLines() int
func (*OutputScreen) Body ¶
func (l *OutputScreen) Body() string
func (*OutputScreen) Header ¶
func (l *OutputScreen) Header() string
func (*OutputScreen) Lines ¶
func (i *OutputScreen) Lines() int
func (*OutputScreen) Name ¶
func (l *OutputScreen) Name() string
func (*OutputScreen) OnInput ¶
func (l *OutputScreen) OnInput(str string) Screen
func (*OutputScreen) SetOptions ¶
func (i *OutputScreen) SetOptions(opts ...ScreenOption)
func (*OutputScreen) SetValue ¶
func (l *OutputScreen) SetValue(v interface{})
func (*OutputScreen) UUID ¶
func (i *OutputScreen) UUID() string
type ScreenOption ¶
type ScreenOption func(*screenConfig)
func OptionCharLimit ¶
func OptionCharLimit(n int) ScreenOption
func OptionName ¶
func OptionName(n string) ScreenOption
func OptionPrefilled ¶
func OptionPrefilled(val interface{}) ScreenOption
func OptionSetUUID ¶
func OptionSetUUID(s string) ScreenOption
func OptionValidator ¶
func OptionValidator(v Validator) ScreenOption
type SelectScreen ¶
type SelectScreen struct {
// contains filtered or unexported fields
}
SelectScreen is a screen that shows different options to select one of them
func (*SelectScreen) AvailableLines ¶
func (l *SelectScreen) AvailableLines() int
func (*SelectScreen) Body ¶
func (l *SelectScreen) Body() string
func (*SelectScreen) Header ¶
func (l *SelectScreen) Header() string
func (*SelectScreen) Lines ¶
func (s *SelectScreen) Lines() int
func (*SelectScreen) Name ¶
func (l *SelectScreen) Name() string
func (*SelectScreen) OnInput ¶
func (l *SelectScreen) OnInput(str string) Screen
func (*SelectScreen) SetOptions ¶
func (i *SelectScreen) SetOptions(opts ...ScreenOption)
func (*SelectScreen) SetValue ¶
func (l *SelectScreen) SetValue(v interface{})
func (*SelectScreen) UUID ¶
func (i *SelectScreen) UUID() string
type Validator ¶
type Validator interface { // if the value is valid, nil is returned. otherwise we can use the error message Validate(v interface{}) error }
type ValidatorFunc ¶
type ValidatorFunc func(interface{}) error
var Any ValidatorFunc = func(v interface{}) error { return nil }
var Int ValidatorFunc = func(v interface{}) error { switch t := v.(type) { case int: case int8: case int16: case int32: case int64: case uint: case uint8: case uint16: case uint32: case uint64: case string: _, err := strconv.Atoi(t) if err != nil { return fmt.Errorf("'%s' is no integer", t) } default: return fmt.Errorf("%v is no integer", v) } return nil }
var NonEmpty ValidatorFunc = func(v interface{}) error { err := fmt.Errorf("%v is empty", v) switch vv := v.(type) { case string: if vv == "" { return err } case int: if vv == -1 { return err } case float32: if vv < 0.0 { return err } case float64: if vv < 0.0 { return err } default: if v == nil { return err } } return nil }
func (ValidatorFunc) Validate ¶
func (fn ValidatorFunc) Validate(v interface{}) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.