cliplugin

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package cliplugin contains helper functionality for protoc plugins.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Main

func Main(handler Handler)

Main runs the application using the OS runtime and calling os.Exit on the return value of Run.

func Run

func Run(handler Handler, runEnv *cli.RunEnv) int

Run runs the application, returning the exit code.

RunEnv will be modified to have dummy values if fields are not set.

Types

type Handler

type Handler interface {

	// If Handle returns a user error and no system errors, this will be added to the error field.
	// If Handle returns any system error, the whole error will be printed as an error to stderr
	// and the plugin will exit with code 1.
	// Only one of files and error can be returned.
	Handle(
		stderr io.Writer,
		request *plugin_go.CodeGeneratorRequest,
	) ([]*plugin_go.CodeGeneratorResponse_File, error)
}

Handler handles protoc plugun functionality.

type HandlerFunc

HandlerFunc is a function that implements Handler.

func (HandlerFunc) Handle

Handle implements Handler.

Jump to

Keyboard shortcuts

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