sg

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: MIT Imports: 20 Imported by: 7

Documentation

Index

Constants

View Source
const (
	SageDir        = ".sage"
	ToolsDir       = "tools"
	BinDir         = "bin"
	SageFileBinary = "bin/sagefile"
)

Variables

This section is empty.

Functions

func Command

func Command(_ context.Context, path string, args ...string) *exec.Cmd

Command should be used when returning exec.Cmd from tools to set opinionated standard fields.

func Deps

func Deps(ctx context.Context, functions ...interface{})

Deps runs each of the provided functions in parallel.

Dependencies must be of type func(context.Context) error or Function.

Each function will be run exactly once, even across multiple calls to Deps.

func FromBinDir

func FromBinDir(pathElems ...string) string

FromBinDir returns the path relative to where tool binaries are installed.

func FromGitRoot

func FromGitRoot(pathElems ...string) string

func FromSageDir

func FromSageDir(pathElems ...string) string

FromSageDir returns the path relative to where the sage files are kept.

func FromToolsDir

func FromToolsDir(pathElems ...string) string

FromToolsDir returns the path relative to where tools are downloaded and installed.

func FromWorkDir

func FromWorkDir(pathElems ...string) string

func GenerateMakefiles

func GenerateMakefiles(mks ...Makefile)

GenerateMakefiles define which makefiles should be created by go.einride.tech/cmd/build.

func NewLogger

func NewLogger(name string) logr.Logger

NewLogger returns a standard logger.

func Output

func Output(cmd *exec.Cmd) string

Output runs the given command, and returns all output from stdout in a neatly, trimmed manner, panicking if an error occurs.

func SerialDeps

func SerialDeps(ctx context.Context, targets ...interface{})

SerialDeps works like Deps except running all dependencies serially instead of in parallel.

Types

type Function

type Function interface {
	// Name is a unique identifier and display name for the function.
	Name() string

	// Run the function.
	Run(ctx context.Context) error
}

Function represents a function that can be run with Deps.

func Fn

func Fn(target interface{}, args ...interface{}) Function

Fn creates a Function from a compatible target function and args.

type Makefile

type Makefile struct {
	Namespace     interface{}
	Path          string
	DefaultTarget interface{}
}

type Namespace

type Namespace struct{}

Namespace allows for the grouping of similar commands.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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