Documentation ¶
Overview ¶
Package ui contains some common UI elements.
Index ¶
- Constants
- Variables
- func Confirm(msg string, _ bool, opt ...Option) (bool, error)
- func FieldConfirm(b *bool, msg string, _ bool, opt ...Option) huh.Field
- func FieldFileInput(filename *string, msg, descr string, opt ...Option) huh.Field
- func FileSelector(msg, descr string, opt ...Option) (string, error)
- func Input(msg, help string, validateFn func(s string) error) (string, error)
- func NoValidation(s string) error
- func String(msg, help string) (string, error)
- func StringRequire(msg, help string) (string, error)
- func ThemeBase16Ext() *huh.Theme
- func Time(msg string, _ ...Option) (time.Time, error)
- func ValidateNotEmpty(s string) error
- func ValidateNotExists(s string) error
- type ControlStyle
- type FileSystemModel
- type Option
- type OptionStyle
- type Theme
Constants ¶
View Source
const (
// MenuSeparator is the separator to use in the wizard menus.
MenuSeparator = "────────────────"
)
Variables ¶
View Source
var DefaultHuhKeymap = huh.NewDefaultKeyMap()
View Source
var ErrEmptyOptionalInput = errors.New("empty input in optional field")
ErrEmptyOptionalInput is returned when an optional input is empty.
View Source
var HuhTheme = ThemeBase16Ext
HuhTheme is the default Wizard theme.
Functions ¶
func FieldFileInput ¶
func NoValidation ¶
func StringRequire ¶
StringRequire requires user to input string.
func ThemeBase16Ext ¶
ThemeBase16Ext returns a modified Base16 theme based on huh.ThemeBase16.
func Time ¶
Time asks the user to enter a date and time. For simplicity, the date and time are entered in two separate prompts. The date is optional, and if it is not given, the function terminates returning ErrEmptyOptionalInput. If the date is entered and is valid (checked with validators, you don't have to worry), the function will ask for time, which is then required.
func ValidateNotEmpty ¶
func ValidateNotExists ¶
Types ¶
type ControlStyle ¶
type ControlStyle struct { // Border defines the border style for the control. It should not have // any color, otherwise it will paint everything that does not have // the color set. Border lipgloss.Style Title lipgloss.Style Description lipgloss.Style Text lipgloss.Style // Cursor is the pointer to the selected item, i.e. the ">" in a list. Cursor lipgloss.Style // SelectedLine is the style for the selected line in a list, next to the pointer. SelectedLine lipgloss.Style Unselected lipgloss.Style SelectedFile lipgloss.Style UnselectedFile lipgloss.Style DisabledFile lipgloss.Style Directory lipgloss.Style Options OptionStyle }
type FileSystemModel ¶
type FileSystemModel struct { SelectedFile string Propmt string // contains filtered or unexported fields }
func NewFilePicker ¶
func NewFilePicker(prompt string, homedir string, allowedExt ...string) FileSystemModel
func (FileSystemModel) Init ¶
func (m FileSystemModel) Init() tea.Cmd
func (FileSystemModel) View ¶
func (m FileSystemModel) View() string
type OptionStyle ¶
type Theme ¶
type Theme struct { Focused ControlStyle Blurred ControlStyle StatusText lipgloss.Style Error lipgloss.Style Help help.Styles }
func DefaultTheme ¶
func DefaultTheme() Theme
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package ask provides common functions for asking questions for getting user input on dump and export parameters.
|
Package ask provides common functions for asking questions for getting user input on dump and export parameters. |
bubbles
|
|
datepicker
Package datepicker provides a bubble tea component for viewing and selecting a date from a monthly view.
|
Package datepicker provides a bubble tea component for viewing and selecting a date from a monthly view. |
Package dumpui provides a universal wizard for running dump-family commands.
|
Package dumpui provides a universal wizard for running dump-family commands. |
Package updaters contains the models that wrap the variable and provide the UI for changing their values.
|
Package updaters contains the models that wrap the variable and provide the UI for changing their values. |
Click to show internal directories.
Click to hide internal directories.