generators

package
Version: v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Generate

func Generate(ctx context.Context, name DriverName, cmd gofire.Command, w io.Writer) error

Generate generates cli command using provided driver to provided writer output.

func Register

func Register(name DriverName, driver Driver)

Register makes a generator driver available by the provided name. If Register is called twice with the same name or if driver is nil, it panics.

Types

type Driver

type Driver interface {
	Producer
	Name() DriverName
	Imports() []string
	Parameters() []Parameter
	Template() string
	gofire.Visitor
}

type DriverName

type DriverName string

DriverName holds names of drivers implementations.

const (
	DriverNameFlag      DriverName = "flag"
	DriverNamePFlag     DriverName = "pflag"
	DriverNameCobra     DriverName = "cobra"
	DriverNameRefType   DriverName = "reftype"
	DriverNameBubbleTea DriverName = "bubbletea"
)

type Parameter

type Parameter struct {
	Name     string
	Full     string
	Short    string
	Type     gofire.Typ
	Ellipsis bool
	Doc      string
	Ref      *Reference
}

type Producer

type Producer interface {
	Output(gofire.Command) (string, error)
	Reset() error
}

type Reference

type Reference string

Reference helps to represent full qualified group name.

func NewReference

func NewReference(typ, g, f string) *Reference

func (*Reference) Field

func (g *Reference) Field() string

func (*Reference) Group

func (g *Reference) Group() string

func (*Reference) Type

func (g *Reference) Type() string

func (*Reference) Untyped

func (g *Reference) Untyped() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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