dialog

package
v8.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package dialog allows the user to enter configuration data via CLI dialogs and prompts.

Index

Constants

View Source
const (
	// ResponseTypeAbort stands for the user choosing to abort the unfinished run state.
	ResponseTypeAbort = "abort"
	// ResponseTypeContinue stands for the user choosing to continue the unfinished run state.
	ResponseTypeContinue = "continue"
	// ResponseTypeDiscard stands for the user choosing to discard the unfinished run state.
	ResponseTypeDiscard = "discard"
	// ResponseTypeQuit stands for the user choosing to quit the program.
	ResponseTypeQuit = "quit"
	// ResponseTypeSkip stands for the user choosing to continue the unfinished run state by skipping the current branch.
	ResponseTypeSkip = "skip"
)

Variables

This section is empty.

Functions

func AskHowToHandleUnfinishedRunState

func AskHowToHandleUnfinishedRunState(command, endBranch string, endTime time.Time, canSkip bool) (string, error)

AskHowToHandleUnfinishedRunState prompts the user for how to handle the unfinished run state.

func Initialize

func Initialize()

Initialize configures the prompts to work on Windows.

func ModalSelect

func ModalSelect(entries ModalEntries, initialValue string) (*string, error)

ModalSelect allows the user to select a value from the given entries. Entries can be arbitrarily formatted. The given initial value is preselected.

func MultiSelect

func MultiSelect(args MultiSelectArgs) ([]string, error)

MultiSelect displays a visual dialog that allows the user to select multiple entries amongst the given options.

func Select

func Select(opts SelectArgs) (string, error)

Select displays a visual dialog that allows the user to select one of the given options.

func SelectAuthor

func SelectAuthor(branch string, authors []string) (string, error)

SelectAuthor allows the user to select an author amongst a given list of authors.

func SelectSquashCommitAuthor

func SelectSquashCommitAuthor(branch string, authors []string) (string, error)

SelectSquashCommitAuthor allows the user to select an author amongst a given list of authors.

Types

type ModalEntries

type ModalEntries []ModalEntry

ModalEntries is a collection of ModalEntry.

func (ModalEntries) IndexOfValue

func (mes ModalEntries) IndexOfValue(value string) *int

IndexOfValue provides the index of the entry with the given value, or nil if the given value is not in the list.

type ModalEntry

type ModalEntry struct {
	Text  string // the text to display
	Value string // the return value
}

ModalEntry contains one of the many entries that the user can choose from.

type MultiSelectArgs

type MultiSelectArgs struct {
	Options  []string
	Defaults []string
	Message  string
}

type SelectArgs

type SelectArgs struct {
	Options []string
	Default string
	Message string
}

Jump to

Keyboard shortcuts

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