batch

package
v0.0.0-...-c1097c7 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 12 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyEnv

func CopyEnv(vars ...string) map[string]string

func Init

func Init()

Init must be called at the top of your program's main function after `Register`.

func Register

func Register(fns ...interface{})

Register stores information about functions so they can be called remotely. The function must take a pointer to a struct as an argument and return nothing.

Types

type Client

type Client struct {
	*rpc.Client
}

func NewClient

func NewClient(path string) (*Client, error)

func (*Client) MapFunc

func (cl *Client) MapFunc(
	env map[string]string,
	fn interface{},
	argsList ...interface{},
) []Result

Run runs the function on the given list of arguments. See RunFunc.

func (*Client) Run

func (cl *Client) Run(task Task) (Result, error)

func (*Client) RunFunc

func (cl *Client) RunFunc(
	env map[string]string,
	fn interface{},
	args interface{},
) (
	Result,
	error,
)

Run runs the function on the given arguments. The function must be registered with the `Register` function. See also: `Init` function.

type Result

type Result struct {
	Code   int    // Executable exit code. 0 is traditionally success.
	Output string // Combined command output.
}

type Task

type Task struct {
	Executable string            // Full path to executable.
	Env        map[string]string // Environment variables and values.
	Args       string            // Arguments to the executable.
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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