exec

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2023 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package exec brings all the functionality of Prototool together in a format easily consumable by CLI libraries. It is effectively the glue between internal/cmd and all other packages.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExitError

type ExitError struct {
	Code    int
	Message string
}

ExitError is an error that signals to exit with a certain code.

func (*ExitError) Error

func (e *ExitError) Error() string

Error implements error.

type Runner

type Runner interface {
	Init(args []string, uncomment bool, document bool) error
	Create(args []string, pkg string) error
	Version() error
	CacheUpdate(args []string) error
	CacheDelete() error
	Files(args []string) error
	Compile(args []string, dryRun bool) error
	Gen(args []string, dryRun bool) error
	Lint(args []string, listAllLinters bool, listLinters bool, listAllLintGroups bool, listLintGroup string, diffLintGroups string, generateIgnores bool) error
	Format(args []string, overwrite, diffMode, lintMode, fix bool) error
	All(args []string, disableFormat, disableLint, fix bool) error
	GRPC(args, headers []string, address, method, data, callTimeout, connectTimeout, keepaliveTime string, stdin bool, details bool, tls bool, insecure bool, cacert string, cert string, key string, serverName string) error
	InspectPackages(args []string) error
	InspectPackageDeps(args []string, name string) error
	InspectPackageImporters(args []string, name string) error
	BreakCheck(args []string, gitBranch string, descriptorSetPath string) error
	BreakDescriptorSet(args []string, outputPath string) error
	DescriptorSet(args []string, includeImports bool, includeSourceInfo bool, outputPath string, tmp bool) error
}

Runner runs commands.

The args given are the args from the command line. Each additional parameter generally refers to a command-specific flag.

func NewRunner

func NewRunner(workDirPath string, input io.Reader, output io.Writer, options ...RunnerOption) Runner

NewRunner returns a new Runner.

workDirPath should generally be the current directory. input and output generally refer to stdin and stdout.

type RunnerOption

type RunnerOption func(*runner)

RunnerOption is an option for a new Runner.

func RunnerWithCachePath

func RunnerWithCachePath(cachePath string) RunnerOption

RunnerWithCachePath returns a RunnerOption that uses the given cache path.

func RunnerWithConfigData

func RunnerWithConfigData(configData string) RunnerOption

RunnerWithConfigData returns a RunnerOption that uses the given config path.

func RunnerWithDevelMode

func RunnerWithDevelMode() RunnerOption

RunnerWithDevelMode returns a RunnerOption that allows devel-mode.

func RunnerWithErrorFormat

func RunnerWithErrorFormat(errorFormat string) RunnerOption

RunnerWithErrorFormat returns a RunnerOption that uses the given colon-separated error format. The default is filename:line:column:message.

func RunnerWithJSON

func RunnerWithJSON() RunnerOption

RunnerWithJSON returns a RunnerOption that will print failures as JSON.

func RunnerWithLogger

func RunnerWithLogger(logger *zap.Logger) RunnerOption

RunnerWithLogger returns a RunnerOption that uses the given logger.

The default is to use zap.NewNop().

func RunnerWithProtocBinPath

func RunnerWithProtocBinPath(protocBinPath string) RunnerOption

RunnerWithProtocBinPath returns a RunnerOption that uses the given protoc binary path.

func RunnerWithProtocURL

func RunnerWithProtocURL(protocURL string) RunnerOption

RunnerWithProtocURL returns a RunnerOption that uses the given protoc zip file URL.

func RunnerWithProtocWKTPath

func RunnerWithProtocWKTPath(protocWKTPath string) RunnerOption

RunnerWithProtocWKTPath returns a RunnerOption that uses the given path to include the well-known types.

func RunnerWithWalkTimeout

func RunnerWithWalkTimeout(walkTimeout time.Duration) RunnerOption

RunnerWithWalkTimeout returns a RunnerOption that sets a given walk timeout

Jump to

Keyboard shortcuts

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