Documentation
¶
Overview ¶
Package components contains shared components to build full dialog screens out of.
Index ¶
- Constants
- func CheckList[S comparable](entries list.Entries[S], selections []int, title, help string, ...) (selected []S, aborted bool, err error)
- func FormattedSecret(secret string, aborted bool) string
- func FormattedSelection(selection string, aborted bool) string
- func FormattedToken(token string, aborted bool) string
- func RadioList[S comparable](entries list.Entries[S], cursor int, title, help string, inputs TestInput) (selected S, aborted bool, err error)
- func SendInputs(inputs TestInput, program *tea.Program)
- func TextDisplay(title, text string, inputs TestInput) (bool, error)
- func TextField(args TextFieldArgs) (string, bool, error)
- type CheckListModel
- func (self CheckListModel[S]) CheckedEntries() []S
- func (self CheckListModel[S]) DisableCurrentEntry() CheckListModel[S]
- func (self CheckListModel[S]) EnableCurrentEntry() CheckListModel[S]
- func (self CheckListModel[S]) Init() tea.Cmd
- func (self CheckListModel[S]) IsRowChecked(row int) bool
- func (self CheckListModel[S]) ToggleCurrentEntry() CheckListModel[S]
- func (self CheckListModel[S]) Update(msg tea.Msg) (tea.Model, tea.Cmd)
- func (self CheckListModel[S]) View() string
- type TestInput
- type TestInputs
- type TextFieldArgs
Constants ¶
const TestInputKey = "GITTOWN_DIALOG_INPUT"
TestInputKey specifies the name of environment variables containing input for dialogs in end-to-end tests.
const WindowSize = 9
how many elements to display in the dialog
Variables ¶
This section is empty.
Functions ¶
func CheckList ¶
func CheckList[S comparable](entries list.Entries[S], selections []int, title, help string, inputs TestInput) (selected []S, aborted bool, err error)
lets the user select zero, one, or many of the given entries
func FormattedSecret ¶
FormattedToken provides the given API token in a printable format.
func FormattedSelection ¶
FormattedSelection provides the given dialog choice in a printable format.
func FormattedToken ¶
FormattedToken provides the given API token in a printable format.
func RadioList ¶
func RadioList[S comparable](entries list.Entries[S], cursor int, title, help string, inputs TestInput) (selected S, aborted bool, err error)
RadioList lets the user select one of the given entries.
func SendInputs ¶
SendInputs sends the given keystrokes to the given bubbletea program.
Types ¶
type CheckListModel ¶
type CheckListModel[S comparable] struct { list.List[S] Selections []int // contains filtered or unexported fields }
func (CheckListModel[S]) CheckedEntries ¶
func (self CheckListModel[S]) CheckedEntries() []S
provides all checked list entries
func (CheckListModel[S]) DisableCurrentEntry ¶
func (self CheckListModel[S]) DisableCurrentEntry() CheckListModel[S]
unchecks the currently selected list entry
func (CheckListModel[S]) EnableCurrentEntry ¶
func (self CheckListModel[S]) EnableCurrentEntry() CheckListModel[S]
checks the currently selected list entry
func (CheckListModel[S]) Init ¶
func (self CheckListModel[S]) Init() tea.Cmd
func (CheckListModel[S]) IsRowChecked ¶
func (self CheckListModel[S]) IsRowChecked(row int) bool
indicates whether the row with the given number is checked or not
func (CheckListModel[S]) ToggleCurrentEntry ¶
func (self CheckListModel[S]) ToggleCurrentEntry() CheckListModel[S]
unchecks the currently selected list entry if it is checked, and checks it if it is unchecked
func (CheckListModel[S]) View ¶
func (self CheckListModel[S]) View() string
type TestInput ¶
TestInput contains the input for a single dialog in an end-to-end test.
func ParseTestInput ¶
ParseTestInput converts the given input data in the environment variable format into the format understood by Git Town's dialogs.
type TestInputs ¶
type TestInputs struct {
// contains filtered or unexported fields
}
TestInputs contains the input for all dialogs in an end-to-end test. This struct is always mutable, so doesn't need to be wrapped in Mutable.
func LoadTestInputs ¶
func LoadTestInputs(environmenttVariables []string) TestInputs
LoadTestInputs provides the TestInputs to use in an end-to-end test, taken from the given environment variable snapshot.
func NewTestInputs ¶
func NewTestInputs(inputs ...TestInput) TestInputs
func (TestInputs) Append ¶
func (self TestInputs) Append(input TestInput)
Next provides the TestInput for the next dialog in an end-to-end test.
func (TestInputs) Len ¶
func (self TestInputs) Len() int
func (TestInputs) Next ¶
func (self TestInputs) Next() TestInput
Next provides the TestInput for the next dialog in an end-to-end test.