Documentation
¶
Overview ¶
Package fieldtype holds the hand-written config-field types (Kind, Field, FlagNames) that the generated inventory in schema/gen populates. It is a dependency-free leaf: schema/gen imports it for the types, keeping the generated data pure (no import of internal/config), and the schema package re-exports these as aliases so callers need not import this package directly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Field ¶
type Field struct {
GoPath string // "Cache.Dir"
YamlPath string // "cache.dir"
EnvVar string // "MAGUS_CACHE_DIR"
Flag FlagNames // long + optional short; Long empty means env-only
Kind Kind
Usage string // one-line description for flag.Usage
}
Field documents one scalar config field exposed as a CLI flag and/or MAGUS_* environment variable.
func (Field) Describe ¶
Describe renders a Field as a labeled three-line block:
Env: MAGUS_CACHE_DIR Flags: --cache-dir Config: cache.dir
The short form is omitted when none was declared. Fields with no CLI flag (KindBoolPtr) show "(env-only)" on the Flags line.
func (Field) String ¶
String returns a single-line summary suitable for log output and %v formatting:
MAGUS_CACHE_DIR (--cache-dir, cache.dir) MAGUS_OUTPUT (-o, --output, output) MAGUS_HINTS_ENABLED (env-only, hints.enabled)
For the labeled multi-line block, use Field.Describe.
type FlagNames ¶
type FlagNames struct {
Long string // e.g. "cache-dir"; empty means env-only
Short string // e.g. "c"; empty when no short was declared
}
FlagNames carries the long and (optional) short forms of a CLI flag. Names are bare — callers prepend "--" / "-" for display.
type Kind ¶
type Kind uint8
Kind identifies the Go type of a config field.
const ( KindString Kind = iota // string KindInt // int KindBool // bool KindFloat64 // float64 KindBoolPtr // *bool (env-only; three-state nil/true/false) KindDuration // time.Duration KindStringSlice // []string (env-only; comma-separated) )
The Kind constants enumerate the supported config-field Go types.