summon

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package summon does the heavy lifting of instanciating files or executing configured scripts on the user's machine.

You can control instantiation by using Options described below.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFs

func GetFs() afero.Fs

GetFs returns the current filesystem

Types

type ConfigurableLister added in v0.8.0

type ConfigurableLister interface {
	Configurer
	Lister
}

ConfigurableLister allows configuration and listing.

type ConfigurableRunner added in v0.8.0

type ConfigurableRunner interface {
	Configurer
	Runner
}

ConfigurableRunner is a runner that can be configured.

type Configurer added in v0.8.0

type Configurer interface {
	Configure(opts ...Option) error
}

Configurer allows configuring a driver from variadic options.

type Driver added in v0.8.0

type Driver struct {
	// contains filtered or unexported fields
}

Driver manages functionality of summon.

func New

func New(box *packr.Box, opts ...Option) (*Driver, error)

New creates the Driver.

func (*Driver) Configure added in v0.8.0

func (d *Driver) Configure(opts ...Option) error

Configure is used to extract options and customize the summon.Driver.

func (*Driver) List added in v0.8.0

func (d *Driver) List(opts ...Option) ([]string, error)

List lists the content of the data tree.

func (*Driver) ListInvocables added in v0.8.0

func (d *Driver) ListInvocables() []string

ListInvocables lists the invocables in the config file under the exec: key.

func (*Driver) Run added in v0.8.0

func (d *Driver) Run(opts ...Option) error

Run will run executable scripts described in the summon.config.yaml file of the data repository module.

func (*Driver) Summon added in v0.8.0

func (d *Driver) Summon(opts ...Option) (string, error)

Summon is the main comnand invocation

type Lister added in v0.8.0

type Lister interface {
	List(opts ...Option) ([]string, error)
}

Lister allows listing files in the assets.

type Option

type Option func(*options) error

Option allows specifying configuration settings from the user.

func All

func All(all bool) Option

All specifies to download all config files.

func Args

func Args(args ...string) Option

Args captures the arguments to be passed to run.

func Debug added in v0.10.0

func Debug(enable bool) Option

Debug prints debugging info on stderr

func Dest

func Dest(dest string) Option

Dest specifies where the file(s) will be rooted. '-' is a special value representing stdout.

func DryRun added in v0.10.0

func DryRun(enable bool) Option

DryRun does not run the command

func ExecCmd added in v0.8.0

func ExecCmd(e command.ExecCommandFn) Option

ExecCmd allows changing the execution function for external processes.

func Filename

func Filename(filename string) Option

Filename sets the requested filename in the boxed data.

func JSON

func JSON(j string) Option

JSON configures the dictionary to use to render a templated asset.

func Raw added in v0.4.0

func Raw(raw bool) Option

Raw disables any template rendering in assets.

func Ref

func Ref(ref string) Option

Ref references an exec config entry.

func ShowTree

func ShowTree(tree bool) Option

ShowTree will print a pretty graph of the data tree.

type Runner added in v0.8.0

type Runner interface {
	Run(opts ...Option) error
	ListInvocables() []string
}

Runner allows executing configured aliases from summon.config.yaml.

type Summon added in v0.8.0

type Summon interface {
	Summon(opts ...Option) (string, error)
}

Summon is used to instanciate a real file to the filesystem.

type Summoner

type Summoner = Driver

Summoner is the old name for Driver, use Driver instead.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳