bud

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2022 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMinGoVersion = fmt.Errorf("bud requires Go %s or later", minGoVersion)

ErrMinGoVersion error is returned when Bud needs a newer version of Go

Functions

func BudModule

func BudModule() (*gomod.Module, error)

BudModule finds the module not of your app, but of bud itself

func CheckGoVersion added in v0.2.2

func CheckGoVersion(currentVersion string) error

CheckGoVersion checks if the current version of Go is greater than the minimum required Go version.

func EnsureVersionAlignment

func EnsureVersionAlignment(ctx context.Context, module *gomod.Module, budVersion string) error

EnsureVersionAlignment ensures that the CLI and runtime versions are aligned. If they're not aligned, the CLI will correct the go.mod file to align them.

func FileSystem

func FileSystem(ctx context.Context, log log.Interface, module *gomod.Module, flag *framework.Flag, in *Input) (*budfs.FileSystem, error)

func Log

func Log(stderr io.Writer, logFilter string) (log.Interface, error)

func Module

func Module(dir string) (*gomod.Module, error)

Module finds the go.mod file for the application

Types

type Command

type Command struct {
	Dir  string
	Log  string
	Args []string
	Help bool
	// contains filtered or unexported fields
}

func New

func New(in *Input) *Command

func (*Command) Run

func (c *Command) Run(ctx context.Context) error

Run a custom command TODO: finish supporting custom commands

  1. Compile a. Generate generator (later!) i. Generate bud/internal/generator ii. Build bud/generator iii. Run bud/generator b. Generate custom command i. Generate bud/internal/command/${name}/ ii. Build bud/command/${name}
  2. Run bud/command/${name}

type Input

type Input struct {
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	Env    []string

	// Currently passed in only for testing
	Dir   string          // Can be empty
	BudLn socket.Listener // Can be nil
	WebLn socket.Listener // Can be nil
	Bus   pubsub.Client   // Can be nil
}

Input contains the configuration that gets passed into the commands

Jump to

Keyboard shortcuts

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