basher

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Basher

type Basher struct {

	// The io.Reader given to Bash for STDIN
	Stdin io.Reader
	// The io.Writer given to Bash for STDOUT
	Stdout io.Writer
	// The io.Writer given to Bash for STDERR
	Stderr io.Writer

	Bindata Bindata
	// contains filtered or unexported fields
}

Basher is a context for running bash scripts

func NewBasher

func NewBasher(name string, scriptContent []byte, bindata Bindata) (*Basher, error)

NewBasher returns a new basher context

  • bindata contains all the assets
  • scriptContent is the all in one script content

The scripts will be placed in library/name, e.g. ~/.caimake/make-rules

func (*Basher) Run

func (c *Basher) Run(args ...string) (int, error)

Run a command in Bash from this Basher. Standard I/O by default is attached to the calling process I/O. You can change this by setting the Stdout, Stderr, Stdin variables of the Basher.

func (*Basher) Run1

func (c *Basher) Run1(cmd string, args ...string) (int, error)

Run1 runs one command

func (*Basher) Run2

func (c *Basher) Run2(cmd1, cmd2 string, args ...string) (int, error)

Run2 runs command and subcommand

type Bindata

type Bindata interface {
	// Asset loads and returns the asset for the given name.
	// It returns an error if the asset could not be found or
	// could not be loaded.
	Asset(name string) ([]byte, error)
	// MustAsset is like Asset but panics when Asset would return an error.
	// It simplifies safe initialization of global variables.
	MustAsset(name string) []byte
	// AssetInfo loads and returns the asset info for the given name.
	// It returns an error if the asset could not be found or
	// could not be loaded.
	AssetInfo(name string) (os.FileInfo, error)
	// AssetNames returns the names of the assets.
	AssetNames() []string
	// AssetDir returns the file names below a certain
	// directory embedded in the file by go-bindata.
	// For example if you run go-bindata on data/... and data contains the
	// following hierarchy:
	//     data/
	//       foo.txt
	//       img/
	//         a.png
	//         b.png
	// then AssetDir("data") would return []string{"foo.txt", "img"}
	// AssetDir("data/img") would return []string{"a.png", "b.png"}
	// AssetDir("foo.txt") and AssetDir("notexist") would return an error
	// AssetDir("") will return []string{"data"}.
	AssetDir(name string) ([]string, error)
	// RestoreAsset restores an asset under the given directory
	RestoreAsset(dir, name string) error
	// RestoreAssets restores an asset under the given directory recursively
	RestoreAssets(dir, name string) error
}

Bindata ...

func NewBindata

func NewBindata(
	asset func(name string) ([]byte, error),
	mustAsset func(name string) []byte,
	assetInfo func(name string) (os.FileInfo, error),
	assetNames func() []string,
	assetDir func(name string) ([]string, error),
	restoreAsset func(dir, name string) error,
	restoreAssets func(dir, name string) error,
) Bindata

NewBindata ...

Jump to

Keyboard shortcuts

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