internal

package
v0.0.0-...-6a0a7f8 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2023 License: Unlicense Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeToKebabCase

func NormalizeToKebabCase(s string) string

NormalizeToKebabCase normalizes the input string to ASCII kebab-case. It tries to convert non-ASCII runes in the input string to ASCII by decomposing and then dropping all non-ASCII runes (and so is lossy). It supports camelCase, PascalCase, snake_case, and SCREAMING_SNAKE_CASE -- anything else (including digits mixed in) working is a happy accident.

func Panicf

func Panicf(format string, a ...any)

func ParamsUsage

func ParamsUsage(names []string, types []ParamType) string

Types

type Metadata

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

func DecodeAsMetadata

func DecodeAsMetadata(b []byte) *Metadata

func (*Metadata) Aliases

func (md *Metadata) Aliases() []string

func (*Metadata) Child

func (md *Metadata) Child(name string) *Metadata

func (*Metadata) Long

func (md *Metadata) Long() string

func (*Metadata) Lookup

func (md *Metadata) Lookup(pkgPath, name string) *Metadata

func (*Metadata) LookupType

func (md *Metadata) LookupType(t reflect.Type) *Metadata

func (*Metadata) Short

func (md *Metadata) Short() string

func (*Metadata) Usage

func (md *Metadata) Usage(name string, args []ParamType) string

type ParamType

type ParamType int
const (
	NoParam ParamType = iota
	RequiredParam
	OptionalParam
	FixedLengthParam
	ArbitraryLengthParam
)

func ParamTypes

func ParamTypes(f reflect.Type) []ParamType

type Plan

type Plan interface {
	Execute(context.Context, *Metadata) error
}

type RawMetadata

type RawMetadata struct {
	Doc        string
	Directives map[string]string
	Comment    string
	Params     []string
	Children   map[string]*RawMetadata
}

Note: it's important that all fields of RawMetadata be exported, otherwise gob won't be able to encode / decode them correctly.

func DecodeAsRawMetadata

func DecodeAsRawMetadata(b []byte) *RawMetadata

func (*RawMetadata) Child

func (rmd *RawMetadata) Child(name string) *RawMetadata

func (*RawMetadata) Encode

func (rmd *RawMetadata) Encode() []byte

func (*RawMetadata) SetComment

func (rmd *RawMetadata) SetComment(comment *ast.CommentGroup)

func (*RawMetadata) SetDoc

func (rmd *RawMetadata) SetDoc(doc *ast.CommentGroup)

type RunOptions

type RunOptions struct {
	Metadata *[]byte
}

Jump to

Keyboard shortcuts

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