pkg

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2025 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfirmAttributes

type ConfirmAttributes struct {
	Affirmative string `yaml:"affirmative,omitempty"`
	Negative    string `yaml:"negative,omitempty"`
}

type Field

type Field struct {
	Type                  string        `yaml:"type"`
	Key                   string        `yaml:"key,omitempty"`
	Title                 string        `yaml:"title,omitempty"`
	Description           string        `yaml:"description,omitempty"`
	Value                 interface{}   `yaml:"value,omitempty"`
	Options               []*Option     `yaml:"options,omitempty"`
	Validation            []*Validation `yaml:"validation,omitempty"`
	InputAttributes       *InputAttributes
	TextAttributes        *TextAttributes
	SelectAttributes      *SelectAttributes
	MultiSelectAttributes *MultiSelectAttributes
	ConfirmAttributes     *ConfirmAttributes
	NoteAttributes        *NoteAttributes
	FilePickerAttributes  *FilePickerAttributes
}

type FieldWithValidation

type FieldWithValidation interface {
	Validate(func(string) error) huh.Field
}

type FilePickerAttributes

type FilePickerAttributes struct {
	CurrentDirectory string   `yaml:"current_directory,omitempty"`
	ShowHidden       bool     `yaml:"show_hidden,omitempty"`
	ShowSize         bool     `yaml:"show_size,omitempty"`
	ShowPermissions  bool     `yaml:"show_permissions,omitempty"`
	FileAllowed      bool     `yaml:"file_allowed,omitempty"`
	DirAllowed       bool     `yaml:"dir_allowed,omitempty"`
	AllowedTypes     []string `yaml:"allowed_types,omitempty"`
	Height           int      `yaml:"height,omitempty"`
}

type Form

type Form struct {
	Name   string   `yaml:"name,omitempty"`
	Theme  string   `yaml:"theme,omitempty"`
	Groups []*Group `yaml:"groups"`
}

func (*Form) Run

func (f *Form) Run(ctx context.Context) (map[string]interface{}, error)

Run executes the form and returns a map of the input values and an error if any

type Group

type Group struct {
	Name   string   `yaml:"name,omitempty"`
	Fields []*Field `yaml:"fields"`
}

type InputAttributes

type InputAttributes struct {
	Prompt      string `yaml:"prompt,omitempty"`
	CharLimit   int    `yaml:"char_limit,omitempty"`
	Placeholder string `yaml:"placeholder,omitempty"`
	EchoMode    string `yaml:"echo_mode,omitempty"`
}

type MultiSelectAttributes

type MultiSelectAttributes struct {
	Limit      int  `yaml:"limit,omitempty"`
	Height     int  `yaml:"height,omitempty"`
	Filterable bool `yaml:"filterable,omitempty"`
}

type NoteAttributes

type NoteAttributes struct {
	Height         int    `yaml:"height,omitempty"`
	ShowNextButton bool   `yaml:"show_next_button,omitempty"`
	NextLabel      string `yaml:"next_label,omitempty"`
}

type Option

type Option struct {
	Label string      `yaml:"label"`
	Value interface{} `yaml:"value"`
}

type SelectAttributes

type SelectAttributes struct {
	Inline     bool `yaml:"inline,omitempty"`
	Height     int  `yaml:"height,omitempty"`
	Filterable bool `yaml:"filterable,omitempty"`
}

type TextAttributes

type TextAttributes struct {
	Lines           int      `yaml:"lines,omitempty"`
	CharLimit       int      `yaml:"char_limit,omitempty"`
	ShowLineNumbers bool     `yaml:"show_line_numbers,omitempty"`
	Placeholder     string   `yaml:"placeholder,omitempty"`
	Editor          string   `yaml:"editor,omitempty"`
	EditorArgs      []string `yaml:"editor_args,omitempty"`
	EditorExtension string   `yaml:"editor_extension,omitempty"`
}

type Validation

type Validation struct {
	Condition string `yaml:"condition"`
	Error     string `yaml:"error"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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