confirm

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Confirm

type Confirm struct {
	// contains filtered or unexported fields
}

func New

func New(ops ...Option) *Confirm

func (*Confirm) Apply

func (c *Confirm) Apply(ops ...Option) *Confirm

Apply options on Confirm

func (*Confirm) Display

func (c *Confirm) Display() (bool, error)

Display Confirm component.

func (*Confirm) Value

func (c *Confirm) Value() bool

Value returns whether the user has chosen to confirm or deny.

type KeyMap

type KeyMap struct {
	Quit key.Binding
	Yes  key.Binding
	No   key.Binding
}

func DefaultKeyMap

func DefaultKeyMap() KeyMap

func (KeyMap) FullHelp

func (k KeyMap) FullHelp() [][]key.Binding

func (KeyMap) ShortHelp

func (k KeyMap) ShortHelp() []key.Binding

type Option

type Option func(confirm *Confirm)

func WithDefaultYes

func WithDefaultYes() Option

WithDefaultYes the `confirm` default is no, adding this option will turn into yes.

func WithDisableOutputResult

func WithDisableOutputResult() Option

WithDisableOutputResult disable output result

func WithDisplayHelp

func WithDisplayHelp() Option

WithDisplayHelp display help view.

func WithFocusInterval

func WithFocusInterval(s string) Option

WithFocusInterval default is theme.DefaultTheme#FocusInterval

func WithFocusIntervalStyle

func WithFocusIntervalStyle(s *style.Style) Option

WithFocusIntervalStyle default is theme.DefaultTheme#FocusIntervalStyle

func WithFocusSymbol

func WithFocusSymbol(s string) Option

WithFocusSymbol default is theme.DefaultTheme#FocusSymbol

func WithFocusSymbolStyle

func WithFocusSymbolStyle(s *style.Style) Option

WithFocusSymbolStyle default is theme.DefaultTheme#FocusSymbolStyle

func WithKeyMap

func WithKeyMap(keyMap KeyMap) Option

WithKeyMap change `confirm` default KeyMap.

func WithNotice

func WithNotice(notice string) Option

WithNotice replace notice, default is " ( y/N ) ".

func WithNoticeStyle

func WithNoticeStyle(style *style.Style) Option

WithNoticeStyle replace notice style.

func WithPrompt

func WithPrompt(prompt string) Option

WithPrompt change `confirm` default prompt.

func WithPromptStyle

func WithPromptStyle(style *style.Style) Option

WithPromptStyle change `confirm` default promptStyle.

func WithPure

func WithPure() Option

WithPure do not use any beautification features, any options you customize will be cleared

func WithUnFocusInterval

func WithUnFocusInterval(s string) Option

WithUnFocusInterval default is theme.DefaultTheme#UnFocusInterval

func WithUnFocusIntervalStyle

func WithUnFocusIntervalStyle(s *style.Style) Option

WithUnFocusIntervalStyle default is theme.DefaultTheme#UnFocusIntervalStyle

func WithUnFocusSymbol

func WithUnFocusSymbol(s string) Option

WithUnFocusSymbol default is theme.DefaultTheme#UnFocusSymbol

func WithUnFocusSymbolStyle

func WithUnFocusSymbolStyle(s *style.Style) Option

WithUnFocusSymbolStyle default is theme.DefaultTheme#UnFocusIntervalStyle

func WithValueStyle

func WithValueStyle(s *style.Style) Option

WithValueStyle render value

Jump to

Keyboard shortcuts

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