Documentation
¶
Index ¶
Constants ¶
const (
LabelSection = "Section"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormField ¶
type FormField struct {
Name string `json:"name"` // e.g. "Bool.FromStrings.CustomListForTrue"
Label string `json:"label"` // e.g. "CustomListForTrue"
Type FieldType `json:"type"`
Description string `json:"description,omitempty"` // tooltip/help text from TOML comments
Value string `json:"value"` // the value as string
Options []Option `json:"options,omitempty"` // the value only for selects
}
FormField describes a single input field in the form.
type FormModel ¶
type FormModel struct {
Sections []*FormSection `json:"sections"`
}
FormModel is the root JSON schema for the form.
func Introspect ¶
Introspect walks the provided cfg (must be a pointer to your Config) and builds a FormModel representing each section, its Disabled flag, fields, and nested subsections.
type FormSection ¶
type FormSection struct {
Title string `json:"title"`
Fields []FormField `json:"fields"`
Subsections []*FormSection `json:"subsections,omitempty"`
}
FormSection represents a group of fields (and nested subsections).
type TOMLComments ¶
TOMLComments holds a mapping of TOML keys to their comment descriptions.
func ParseTOMLComments ¶
func ParseTOMLComments(content string) (TOMLComments, error)
ParseTOMLComments reads TOML content and extracts comments above each field. It builds a map from field paths (e.g., "Bool.FromStrings.CaseInsensitive") to their descriptions.
func (TOMLComments) GetDescription ¶
func (tc TOMLComments) GetDescription(fieldPath string) string
GetDescription returns the description for a given field path. It tries multiple variations to handle nested structures.