plugin

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(ctx context.Context, url string) error

Download downloads the given plugin into the cache

Types

type Command

type Command string

Command is the command to be executed by conftest, passed as a single string.

func (Command) Prepare

func (c Command) Prepare() (string, []string, error)

Prepare prepares the plugin command and parses out the main and args

type MetaData

type MetaData struct {
	// Name is the name of the plugin
	Name string `yaml:"name"`

	// Version is a SemVer 2 version of the plugin.
	Version string `yaml:"version"`

	// Usage provides a short description
	// of what the plugin does
	Usage string `yaml:"usage"`

	// Description provides a long description
	// of what the plugin does
	Description string `yaml:"description"`

	// Command is the command to add to conftest
	Command Command `yaml:"command"`
}

MetaData contains the required metadata for conftest plugins

type Plugin

type Plugin struct {
	// Metadata contains the contents of the plugin.yaml metatdata file
	MetaData *MetaData

	// Dir contains the full path to the plugin
	Dir string
	// contains filtered or unexported fields
}

Plugin represents a conftest plugin

func FindPlugins

func FindPlugins() ([]*Plugin, error)

FindPlugins returns a list of all plugins available on the local file system.

func LoadPlugin

func LoadPlugin(path string) (*Plugin, error)

LoadPlugin loads the plugin.yaml from the given path and parses the metadata into a Plugin struct

func (*Plugin) Exec

func (p *Plugin) Exec(ctx context.Context, args []string) error

Exec executes the plugin command

func (*Plugin) SetStdErr

func (p *Plugin) SetStdErr(w io.Writer) *Plugin

SetStdErr configures to where the plugin writes errors to when the command is executed

func (*Plugin) SetStdIn

func (p *Plugin) SetStdIn(r io.Reader) *Plugin

SetStdIn configures where the plugin reads from when the command is executed

func (*Plugin) SetStdOut

func (p *Plugin) SetStdOut(w io.Writer) *Plugin

SetStdOut configures to where the plugin writes to when the command is executed

Jump to

Keyboard shortcuts

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