components

package
v18.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package components contains shared components to build full dialog screens out of.

Index

Constants

View Source
const TestInputKey = "GITTOWN_DIALOG_INPUT"

TestInputKey specifies the name of environment variables containing input for dialogs in end-to-end tests.

View Source
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

func FormattedSecret(secret string, aborted bool) string

FormattedToken provides the given API token in a printable format.

func FormattedSelection

func FormattedSelection(selection string, aborted bool) string

FormattedSelection provides the given dialog choice in a printable format.

func FormattedToken

func FormattedToken(token string, aborted bool) string

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

func SendInputs(inputs TestInput, program *tea.Program)

SendInputs sends the given keystrokes to the given bubbletea program.

func TextDisplay

func TextDisplay(title, text string, inputs TestInput) (bool, error)

func TextField

func TextField(args TextFieldArgs) (string, bool, error)

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]) Update

func (self CheckListModel[S]) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (CheckListModel[S]) View

func (self CheckListModel[S]) View() string

type TestInput

type TestInput []tea.Msg

TestInput contains the input for a single dialog in an end-to-end test.

func ParseTestInput

func ParseTestInput(envData string) TestInput

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.

type TextFieldArgs

type TextFieldArgs struct {
	ExistingValue string
	Help          string
	Prompt        string
	TestInput     TestInput
	Title         string
}

Directories

Path Synopsis
Package list provides a generic list implementation to be used inside BubbleTea-based dialog components.
Package list provides a generic list implementation to be used inside BubbleTea-based dialog components.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL