plugins

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PluginsMap = make(map[string]Plugin)

Functions

func ClearPlugins

func ClearPlugins()

func RegisterPlugin

func RegisterPlugin(plugin Plugin)

Types

type GenerateOpts

type GenerateOpts struct {
	// full path name of the file where the command is being run.
	Path string
	// all the words being passed on the generate macro
	Words []string
	// name of the executable being run. if it is a go package, it will be the name of the cmd tool
	ExecutableName string
	// full path of the command being run. if it is a go package, this path will be an empty string
	ExecutablePath string
	// when this command is a "go run [pkg]" command, the name of the package being run
	GoPackage string
	// when this command is a "go run [pkg]@version" command, the version specified on it (e.g. 1.2.3, latest). Empty string when not specified.
	GoPackageVersion string
	// arguments being passed to the target executable.
	// examples:
	// [exec] -a -b arg -> ["-a", "-b", "arg"]
	// go run [pkg] -a -b arg -> ["-a", "-b", "cmd"]
	SanitizedArgs []string
	// optionally added input files before the command
	ExtraInputPatterns []string
	// optionally added output files before the command
	ExtraOutputPatterns []string
}

func (*GenerateOpts) Command

func (g *GenerateOpts) Command() string

func (*GenerateOpts) Dir

func (g *GenerateOpts) Dir() string

full dir where the command is being run on. this is the os.Getwd() when the plugins are running

func (*GenerateOpts) File

func (g *GenerateOpts) File() string

base name of the file containing the command.

type InputOutputFiles

type InputOutputFiles struct {
	InputFiles  []string
	OutputFiles []string
	// output file patterns - will be computed after command is run
	OutputPatterns []string
	// extra data that is used in the hash calculations
	Extra []string
}

type Plugin

type Plugin interface {
	Name() string
	Matches(opts GenerateOpts) bool
	ComputeInputOutputFiles(opts GenerateOpts) *InputOutputFiles
}

func MatchPlugin

func MatchPlugin(opts GenerateOpts) Plugin

Directories

Path Synopsis
from https://github.com/go-bindata/go-bindata/blob/master/go-bindata/main.go
from https://github.com/go-bindata/go-bindata/blob/master/go-bindata/main.go

Jump to

Keyboard shortcuts

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