ui

package
v0.0.0-...-d24a1a8 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package ui handles everything ui related in mkgo

Index

Constants

This section is empty.

Variables

View Source
var (
	AppStyle   = lipgloss.NewStyle().PaddingLeft(2).PaddingTop(1)
	TitleStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("205")).Bold(true)

	HelpStyle = blurredStyle
)

Functions

func Checkbox

func Checkbox() *checkboxModel
func Header() *headerModel

func Input

func Input() *inputModel

func List

func List() *listModel

func SummaryFromArguments

func SummaryFromArguments(opts SummaryOptions) string

Types

type Field

type Field interface {
	Hidable
	// contains filtered or unexported methods
}

Field is the minimal interface for a UI form field. It covers only the methods that the model needs at runtime (rendering, focus management, event handling, and visibility). Builder/configuration methods live on the concrete types instead.

type FieldDef

type FieldDef struct {
	Type                  FieldType
	Title                 string
	Description           string
	RotationTitle         string
	Placeholder           string
	Prompts               []string
	Focus                 bool
	Validate              func(string) error
	Value                 *string
	DisablePromptRotation bool
	Hide                  func() bool
	CheckboxValue         *bool
	Fields                []FieldDef
}

type FieldType

type FieldType int
const (
	InputType FieldType = iota
	ListType
	CheckboxType
	GroupType
)

type Form

type Form interface {
	Summary() string
	LineCount() int
	GetModule() string
	GetPath() string
	GetTemplate() string
	GetGitRepo() string
	GetCreateMakefile() bool
	GetInitGit() bool
}

Form is the interface for interactive forms, providing summary and line count access.

func CreateForm

func CreateForm(fieldDefs []FieldDef) (Form, error)

func NewForm

func NewForm() (Form, error)

type Hidable

type Hidable interface {
	// SetHide sets the function that determines the field's visibility.
	SetHide(func() bool)
	// IsHidden returns true if the field should be hidden.
	IsHidden() bool
}

Hidable defines the contract for UI elements that can be hidden.

type SummaryOptions

type SummaryOptions interface {
	Path() string
	Template() string
	CreateMakefile() bool
	InitGit() bool
}

SummaryOptions defines the methods needed to generate a post-creation summary.

Jump to

Keyboard shortcuts

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