protogocmd

package
v0.0.0-...-d4426de Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2023 License: MIT Imports: 11 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CLI struct{}

Functions

func KongOptions

func KongOptions() []kong.Option

func Main

func Main()

func MustRegister

func MustRegister(cmd *Plugin)

Types

type Build

type Build struct {
	Plugins     []string `name:"plugin" help:"Plugins to build. Format: <module[=replacement]>"`
	SkipCleanup int      `env:"PROTOGO_SKIP_CLEANUP" default:"0" help:"Whether to leave build artifacts on disk after exiting."`
}

func (*Build) Run

func (b *Build) Run(ctx *kong.Context) error

type Gen

type Gen struct {
	Generator

	SrcFilename   string `arg:"" name:"source-file" help:"source file"`
	InterfaceName string `arg:"" name:"interface-name" help:"interface name"`
}

func NewGen

func NewGen(generator Generator) *Gen

func (*Gen) Run

func (g *Gen) Run(ctx *kong.Context) error

type Generator

type Generator interface {
	// PkgName returns the destination package name to which the generated file will belong.
	//
	// Note that if it's different from the source package name (to which the interface belong),
	// all type names used in the interface will be full-qualified.
	PkgName() string

	Generate(data *ifacetool.Data) (*generator.File, error)
}

type Plugin

type Plugin struct {
	Name  string
	Help  string
	Group string
	Cmd   interface{}
	Tags  []string
}

type Registry

type Registry map[string]*Plugin

func (Registry) KongOptions

func (r Registry) KongOptions() []kong.Option

func (Registry) MustRegister

func (r Registry) MustRegister(cmd *Plugin)

func (Registry) Register

func (r Registry) Register(plugin *Plugin) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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