run

package
v0.0.0-...-7fc9597 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2017 License: MIT Imports: 14 Imported by: 2

Documentation

Overview

Package run provides the logic for generating code for the gorram CLI tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(c *Command) error

Run executes the gorram command.

Types

type Command

type Command struct {
	// Args contains the arguments to the function.
	Args []string
	// Package the function exists in.
	Package string
	// Function (or method) to call.
	Function string
	// GlobalVar, if not empty, indicates a global variable to call, and means
	// Function is a method on that variable.
	GlobalVar string
	// Regen, if true, indicates we should create a new script file even if the
	// old one exists.
	Regen bool
	// Cache, if non-empty, indicates the user has specified the non-default
	// location for their gorram scripts to be located.
	Cache string
	// Template, if non-empty, contains the Go template with which to format the
	// output.
	Template string
	// Env contains the input and output streams the command should read from
	// and write to.
	Env Env
	// 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