sg

package
v0.279.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendLoggerPrefix added in v0.232.0

func AppendLoggerPrefix(ctx context.Context, prefix string) context.Context

AppendLoggerPrefix appends a prefix to the current logger.

func Command

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

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

func ContextWithEnv added in v0.94.0

func ContextWithEnv(ctx context.Context, env ...string) context.Context

ContextWithEnv returns a context with environment variables which are appended to Command.

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 Target.

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. Parent directories of the returned path will be automatically created.

func FromBuildDir added in v0.64.0

func FromBuildDir(pathElems ...string) string

FromBuildDir returns the path relative to where generated build files are installed. Parent directories of the returned path will be automatically created.

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. Parent directories of the returned path will be automatically created.

func FromWorkDir

func FromWorkDir(pathElems ...string) string

func GenerateMakefiles

func GenerateMakefiles(mks ...Makefile)

GenerateMakefiles defines which Makefiles should be generated.

func Logger added in v0.57.0

func Logger(ctx context.Context) *log.Logger

Logger returns the log.Logger attached to ctx, or a default logger.

func NewLogger

func NewLogger(name string) *log.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.

func WithLogger added in v0.57.0

func WithLogger(ctx context.Context, logger *log.Logger) context.Context

WithLogger attaches a log.Logger to the provided context.

Types

type Makefile

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

type Namespace

type Namespace struct{}

Namespace allows for the grouping of similar commands.

type Target added in v0.73.0

type Target interface {
	// Name is a non-unique display name for the Target.
	Name() string

	// ID is a unique identifier for the Target.
	ID() string

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

Target represents a target function that can be run with Deps.

func Fn

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

Fn creates a Target from a compatible function and args.

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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