workdir

package
v0.14.1 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v0.14.1

func Init(dir string) (string, error)

Init will initialize context in specified directory.

Types

type IRuntime added in v0.14.1

type IRuntime interface {
	// Parse will parse string with module name. It is used only on `toolset add` step.
	// Parse should:
	//	1) ensure that this program is valid, exists, and can be installed.
	//	2) normalize program name and return a canonical name.
	Parse(ctx context.Context, str string) (string, error)
	// GetModule returns an information about module (parsed module).
	GetModule(ctx context.Context, program string) (*structs.ModuleInfo, error)
	// Install will install the program.
	Install(ctx context.Context, program string) error
	Run(ctx context.Context, program string, args ...string) error
	GetLatest(ctx context.Context, module string) (string, bool, error)
}

type Include added in v0.12.0

type Include struct {
	Src  string   `json:"src"`
	Tags []string `json:"tags"`
}

func (Include) IsSame added in v0.12.0

func (i Include) IsSame(include Include) bool

func (*Include) UnmarshalJSON added in v0.14.0

func (i *Include) UnmarshalJSON(bb []byte) error

type Lock added in v0.12.0

type Lock struct {
	Tools   structs.Tools `json:"tools"`
	Remotes []RemoteSpec  `json:"remotes"`
}

type RemoteSpec added in v0.12.0

type RemoteSpec struct {
	Source string   `json:"source"`
	Spec   Spec     `json:"spec"`
	Tags   []string `json:"tags"`
}

func (*RemoteSpec) UnmarshalJSON added in v0.14.1

func (r *RemoteSpec) UnmarshalJSON(bb []byte) error

type SourceUri added in v0.13.0

type SourceUri interface {
	// contains filtered or unexported methods
}

type SourceUriFile added in v0.13.0

type SourceUriFile struct {
	Path string
}

type SourceUriGit added in v0.13.0

type SourceUriGit struct {
	Addr string
	Path string
}

type SourceUriUrl added in v0.13.0

type SourceUriUrl struct {
	URL string
}

type Spec

type Spec struct {
	Dir      string        `json:"dir"`
	Tools    structs.Tools `json:"tools"`
	Includes []Include     `json:"includes"`
}

func (*Spec) AddInclude added in v0.12.0

func (s *Spec) AddInclude(include Include) bool

type Workdir added in v0.14.1

type Workdir struct {
	// contains filtered or unexported fields
}

func New added in v0.14.1

func New() (*Workdir, error)

func (*Workdir) Add added in v0.14.1

func (c *Workdir) Add(ctx context.Context, runtime, program string, alias optional.Val[string], tags []string) (bool, string, error)

func (*Workdir) AddInclude added in v0.14.1

func (c *Workdir) AddInclude(ctx context.Context, source string, tags []string) (int, error)

func (*Workdir) CopySource added in v0.14.1

func (c *Workdir) CopySource(ctx context.Context, source string, tags []string) (int, error)

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

func (*Workdir) FindTool added in v0.14.1

func (c *Workdir) FindTool(name string) (*structs.Tool, error)

func (*Workdir) RunTool added in v0.14.1

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

RunTool will run a tool by its name and args.

func (*Workdir) Save added in v0.14.1

func (c *Workdir) Save() error

func (*Workdir) Sync added in v0.14.1

func (c *Workdir) Sync(ctx context.Context, maxWorkers int, tags []string) error

Sync will read the locked tools and try to install the desired version. It will skip the installation in case when we have a desired version.

func (*Workdir) Upgrade added in v0.14.1

func (c *Workdir) Upgrade(ctx context.Context, tags []string) error

Upgrade will upgrade only spec tools. and re-fetch latest versions of includes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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