workdir

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RuntimeGo        = "go"
	SpecFilename     = ".toolset.json"
	SnapshotFilename = ".snapshot.json"
	DefaultToolsDir  = "./bin/tools"
)

Variables

This section is empty.

Functions

func InitContext

func InitContext(dir string) (string, error)

InitContext will initialize context in specified

Types

type Context

type Context struct {
	Workdir string
	Spec    *Spec
}

func NewContext

func NewContext() (*Context, error)

func (*Context) AddGo

func (c *Context) AddGo(ctx context.Context, goBinary string, alias optional.Val[string]) (bool, string, error)

func (*Context) CopyFrom added in v0.11.0

func (c *Context) CopyFrom(ctx context.Context, source string) (int, error)

CopyFrom will add all tools from source. Source can be a path to file or a http url.

func (*Context) FindTool

func (c *Context) FindTool(str string) (*Tool, error)

func (*Context) GetToolsDir

func (c *Context) GetToolsDir() string

func (*Context) RunTool

func (c *Context) RunTool(ctx context.Context, str string, args ...string) error

func (*Context) Save

func (c *Context) Save() error

func (*Context) SpecFilename

func (c *Context) SpecFilename() string

func (*Context) Sync

func (c *Context) Sync(ctx context.Context, maxWorkers int) error

func (*Context) Upgrade

func (c *Context) Upgrade(ctx context.Context) error

type GoModule

type GoModule struct {
	Version string    `json:"Version"`
	Time    time.Time `json:"Time"`
	Origin  struct {
		VCS  string `json:"VCS"`
		URL  string `json:"URL"`
		Hash string `json:"Hash"`
		Ref  string `json:"Ref"`
	} `json:"Origin"`
}

type Spec

type Spec struct {
	Dir   string `json:"dir"`
	Tools []Tool `json:"tools"`
}

func (*Spec) AddOrUpdateTool

func (s *Spec) AddOrUpdateTool(tool Tool)

func (*Spec) AddTool

func (s *Spec) AddTool(tool Tool) bool

type Tool

type Tool struct {
	// Name of runtime
	Runtime string `json:"runtime"`
	// Path to module with version
	Module string `json:"module"`
	// Alias create a link in tools. Works like exposing some tools
	Alias optional.Val[string] `json:"alias"`
}

func (Tool) IsSame

func (t Tool) IsSame(tool Tool) bool

Jump to

Keyboard shortcuts

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