scripter

package
v0.0.0-...-d0bb578 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(c *Command) error

Types

type Command

type Command struct {
	// Args contains the arguments to the function.
	Args []string `mapstructure:"scripter.args"`
	// Package the function exists in.
	Package string `mapstructure:"scripter.package"`
	// Function (or method) to call.
	Function string `mapstructure:"scripter.function"`
	// GlobalVar, if not empty, indicates a global variable to call, and means
	// Function is a method on that variable.
	GlobalVar string `mapstructure:"scripter.globalvar"`
	// Regen, if true, indicates we should create a new script file even if the
	// old one exists.
	Regen bool `mapstructure:"scripter.regen"`
	// Cache, if non-empty, indicates the user has specified the non-default
	// location for their gorram scripts to be located.
	Cache string `mapstructure:"scripter.cache"`
	// Template, if non-empty, contains the Go template with which to format the
	// output.
	Template string `mapstructure:"scripter.template"`
	// Env contains the input and output streams the command should read from
	// and write to.
	Env Env `mapstructure:",squash"`
	// contains filtered or unexported fields
}

Command contains the definition of a command that gorram can execute. It represents a package and either global function or a method call on a global variable. If GlobalVar is non-empty, it's the latter.

func (*Command) Generate

func (c *Command) Generate() (path string, err error)

Generate creates the gorram .go file for the given command.

type Env

type Env struct {
	Stderr io.Writer
	Stdout io.Writer
	Stdin  io.Reader
}

Env encapsulates the externalities of the environment in which a command is running.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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