configbuilder

package
v0.0.33 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCantBuild = errors.New("cannot build")

Functions

func RequiredHelp

func RequiredHelp(help string) string

func Singular

func Singular(s string) string

Types

type APIBuilder

type APIBuilder struct {
	// contains filtered or unexported fields
}

func NewAPIBuilder

func NewAPIBuilder(cfg Config, build *config.Config, m reflect.Method) *APIBuilder

func (*APIBuilder) Build

func (b *APIBuilder) Build(spec Spec) error

func (*APIBuilder) Commit

func (b *APIBuilder) Commit()

type AliasBuilder

type AliasBuilder struct {
	// contains filtered or unexported fields
}

func NewAliasBuilder

func NewAliasBuilder(cfg Config, build *config.Config, m reflect.Method) *AliasBuilder

func (*AliasBuilder) Build

func (b *AliasBuilder) Build(spec Spec) error

func (*AliasBuilder) Commit

func (b *AliasBuilder) Commit()

type ClientBuilder

type ClientBuilder[T any] struct {
	// contains filtered or unexported fields
}

func NewClientBuilder

func NewClientBuilder[T any](cfg Config) *ClientBuilder[T]

func (*ClientBuilder[T]) BuildFor

func (b *ClientBuilder[T]) BuildFor(build *config.Config, spec Spec)

func (*ClientBuilder[T]) BuildMethod

func (b *ClientBuilder[T]) BuildMethod(build *config.Config, m reflect.Method, spec Spec)

type Config

type Config struct {
	InputStructSuffix string

	// SkipMethods skips the method (no octl API command)
	SkipMethods []string
	// SkipSuffixes skips the method with the following suffixes
	SkipSuffixes []string
	// AllowedNumOut defines the number of allowed args
	AllowedNumOut []int

	// Skip avoids generating an alias for an entity
	SkipAlias []string
	// TypeName is an entity => type name map
	TypeName map[string]string

	PriorityFields           []string
	RequiredFromFieldPointer bool
	RequiredFromComment      func(string) bool

	// ReadFlagPrefixes The prefix that read flags must have (removed in alias flag).
	ReadFlagPrefixes []string
	// CreateFlagPrefixes The prefix that create flags must have (removed in alias flag).
	CreateFlagPrefixes []string
	// UpdateFlagPrefixes The prefix that update flags must have (removed in alias flag).
	UpdateFlagPrefixes []string
	// DeleteFlagPrefixes The prefix that delete flags must have (removed in alias flag).
	DeleteFlagPrefixes []string

	SkipFlagsPrefixes  map[string][]string
	StripFlagsPrefixes map[string][]string

	FlagOverrides map[string]config.Flag
	FlagReplaces  []string

	IdFieldInUsage string

	AliasRootPath []string
}

type EntityBuilder

type EntityBuilder struct {
	// contains filtered or unexported fields
}

func NewEntityBuilder

func NewEntityBuilder(cfg Config, build *config.Config, m reflect.Method) *EntityBuilder

func (*EntityBuilder) Build

func (b *EntityBuilder) Build(spec Spec) error

func (*EntityBuilder) Commit

func (b *EntityBuilder) Commit()

type Enum

type Enum interface {
	Values() []string
}

type MethodBuilder

type MethodBuilder interface {
	Build(spec Spec) error
	Commit()
}

type Spec

type Spec struct {
	Calls      map[string]SpecCall      `yaml:"calls,omitempty"`
	Attributes map[string]SpecAttribute `yaml:"attributes,omitempty"`
}

func (Spec) ForAttribute

func (s Spec) ForAttribute(call, name string) SpecAttribute

func (Spec) ForCall

func (s Spec) ForCall(name string) SpecCall

func (*Spec) SetAttribute

func (s *Spec) SetAttribute(call, name string, spec SpecAttribute)

type SpecAttribute

type SpecAttribute struct {
	Help     string
	Required bool
}

type SpecBuilder

type SpecBuilder struct {
	// contains filtered or unexported fields
}

func NewSpecBuilder

func NewSpecBuilder(cfg Config) *SpecBuilder

func (*SpecBuilder) BuildSpec

func (b *SpecBuilder) BuildSpec(base *config.Config, pkgNames ...string) Spec

type SpecCall

type SpecCall struct {
	Group string
	Help  string
}

Jump to

Keyboard shortcuts

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