Documentation ¶
Overview ¶
Package dialog allows the user to enter configuration data via CLI dialogs and prompts.
Index ¶
- Constants
- Variables
- func EnterMainBranch(localBranches domain.LocalBranchNames, oldMainBranch domain.LocalBranchName, ...) (domain.LocalBranchName, error)
- func EnterParent(branch, defaultParent domain.LocalBranchName, lineage config.Lineage, ...) (domain.LocalBranchName, error)
- func EnterPerennialBranches(backend *git.BackendCommands, branches domain.Branches) (domain.BranchTypes, error)
- func Initialize()
- func ModalSelect(entries ModalSelectEntries, initialValue string) (*string, error)
- func MultiSelect(args MultiSelectArgs) ([]string, error)
- func Select(opts SelectArgs) (string, error)
- func SelectAuthor(branch string, authors []string) (string, error)
- func SelectSquashCommitAuthor(branch domain.LocalBranchName, authors []string) (string, error)
- type ModalSelectEntries
- type ModalSelectEntry
- type MultiSelectArgs
- type Response
- type SelectArgs
Constants ¶
const (
PerennialBranchOption = "<none> (perennial branch)"
)
Variables ¶
var ( // ResponseAbort stands for the user choosing to abort the unfinished run state. ResponseAbort = Response{"abort"} //nolint:gochecknoglobals // ResponseContinue stands for the user choosing to continue the unfinished run state. ResponseContinue = Response{"continue"} //nolint:gochecknoglobals // ResponseDiscard stands for the user choosing to discard the unfinished run state. ResponseDiscard = Response{"discard"} //nolint:gochecknoglobals // ResponseQuit stands for the user choosing to quit the program. ResponseQuit = Response{"quit"} //nolint:gochecknoglobals // ResponseSkip stands for the user choosing to continue the unfinished run state by skipping the current branch. ResponseSkip = Response{"skip"} //nolint:gochecknoglobals )
Functions ¶
func EnterMainBranch ¶
func EnterMainBranch(localBranches domain.LocalBranchNames, oldMainBranch domain.LocalBranchName, backend *git.BackendCommands) (domain.LocalBranchName, error)
EnterMainBranch lets the user select a new main branch for this repo. This includes asking the user and updating the respective setting.
func EnterParent ¶
func EnterParent(branch, defaultParent domain.LocalBranchName, lineage config.Lineage, branches domain.BranchInfos) (domain.LocalBranchName, error)
EnterParent lets the user select a new parent for the given branch.
func EnterPerennialBranches ¶
func EnterPerennialBranches(backend *git.BackendCommands, branches domain.Branches) (domain.BranchTypes, error)
EnterPerennialBranches lets the user update the perennial branches. This includes asking the user and updating the respective settings based on the user selection.
func ModalSelect ¶
func ModalSelect(entries ModalSelectEntries, 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 ¶
SelectAuthor allows the user to select an author amongst a given list of authors.
func SelectSquashCommitAuthor ¶
func SelectSquashCommitAuthor(branch domain.LocalBranchName, authors []string) (string, error)
SelectSquashCommitAuthor allows the user to select an author amongst a given list of authors.
Types ¶
type ModalSelectEntries ¶
type ModalSelectEntries []ModalSelectEntry
ModalSelectEntries is a collection of ModalEntry.
func (ModalSelectEntries) IndexOfValue ¶
func (self ModalSelectEntries) 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.
func (ModalSelectEntries) Strings ¶
func (self ModalSelectEntries) Strings() []string
type ModalSelectEntry ¶
type ModalSelectEntry struct { Text string // the text to display Value string // the return value }
ModalSelectEntry contains one of the many entries that the user can choose from.
type MultiSelectArgs ¶
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
func AskHowToHandleUnfinishedRunState ¶
func AskHowToHandleUnfinishedRunState(command string, endBranch domain.LocalBranchName, endTime time.Time, canSkip bool) (Response, error)
AskHowToHandleUnfinishedRunState prompts the user for how to handle the unfinished run state.