core

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseFlag

type BaseFlag struct {
	Name         string       // Long name (e.g. "verbose").
	Short        string       // Short alias (single letter, e.g. "v").
	Usage        string       // Brief description shown in help.
	Value        Value        // Underlying value handler (scalar, slice, or dynamic).
	Hidden       bool         // If true, omit from help.
	DisableEnv   bool         // If true, disallow ENV lookup.
	HideEnv      bool         // If true, hide ENV key from help.
	EnvKey       string       // Custom environment variable (overrides derived key).
	Deprecated   string       // If non‐empty, show deprecation notice.
	Required     bool         // Mark flag as required.
	HideRequired bool         // Hide “(Required)” in help.
	Placeholder  string       // Placeholder for the value (e.g. "FILE").
	Allowed      []string     // Allowed string values (help only).
	Group        *MutualGroup // Mutual exclusion group membership.
}

BaseFlag holds metadata for a single flag.

type DynamicItemValues

type DynamicItemValues interface {
	ValuesAny() map[string]any
}

DynamicItemValues exposes all parsed dynamic entries.

type DynamicValue

type DynamicValue interface {
	Set(id, val string) error
	FieldName() string
	GetAny(id string) (any, bool)
}

DynamicValue accepts keyed values (e.g. --http.alpha.port).

type GroupItem added in v0.0.19

type GroupItem struct {
	Value DynamicValue
	Flag  *BaseFlag
}

GroupItem holds a single flag and its value for a dynamic group.

type Incrementable

type Incrementable interface {
	Value
	Increment() error
}

Incrementable allows repeated use to increment a counter flag.

type MutualGroup

type MutualGroup struct {
	Name  string      // Identifier for this group.
	Flags []*BaseFlag // Member flags.
	// contains filtered or unexported fields
}

MutualGroup enforces exclusivity among a set of flags. Only one flag in the group may be set.

func (*MutualGroup) Hidden

func (g *MutualGroup) Hidden() *MutualGroup

Hidden marks the group as omitted from help.

func (*MutualGroup) IsHidden

func (g *MutualGroup) IsHidden() bool

IsHidden reports whether the group is hidden.

func (*MutualGroup) IsRequired

func (g *MutualGroup) IsRequired() bool

IsRequired reports whether the group is required.

func (*MutualGroup) Required

func (g *MutualGroup) Required() *MutualGroup

Required enforces that one member must be set.

func (*MutualGroup) Title

func (g *MutualGroup) Title(t string) *MutualGroup

Title sets a custom help heading.

func (*MutualGroup) TitleText

func (g *MutualGroup) TitleText() string

TitleText returns the custom heading, if any.

type Registry

type Registry interface {
	RegisterFlag(name string, bf *BaseFlag)
	GetGroup(name string) *MutualGroup
	Groups() []*MutualGroup
	DefaultDelimiter() string
}

Registry manages static flags, dynamic groups, and defaults.

type SliceMarker

type SliceMarker interface {
	IsSlice()
}

SliceMarker tags slice-type flags (no methods).

type StrictBool

type StrictBool interface {
	IsStrictBool() bool
}

StrictBool supports --flag / --no-flag syntax.

type Value

type Value interface {
	Set(string) error // parse from string
	Get() any         // retrieve stored value
	Changed() bool    // was flag explicitly set?
	Default() string  // default value as string
}

Value parses and holds a single CLI value.

Jump to

Keyboard shortcuts

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