binary

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MIT Imports: 12 Imported by: 3

Documentation

Index

Constants

View Source
const (
	GithubLatestURL = "https://github.com/%s/releases/latest"
)

Variables

This section is empty.

Functions

func GetBinaryPath

func GetBinaryPath() string

func GetBody

func GetBody(url string) (string, error)

func GetGitRootDirectory

func GetGitRootDirectory() (string, error)

func GithubLatest

func GithubLatest(b *Binary) (string, error)

Types

type Binary

type Binary struct {
	Context context.Context
	// for installation
	URL           string
	URLF          Callback
	GitHubRepo    string
	GitHubFile    string
	GitHubFileF   Callback
	Version       string
	VersionF      Callback
	VersionLocalF Callback
	Name          string
	File          string
	IsTarGz       bool
	TarFile       string
	TarFileF      Callback
	Tracker       *progress.Tracker
	// for execution
	Envs map[string]string
}

func (*Binary) BinaryExists

func (b *Binary) BinaryExists() bool

func (*Binary) BinaryPath

func (b *Binary) BinaryPath() string

func (*Binary) Cmd

func (b *Binary) Cmd(args ...string) *exec.Cmd

func (*Binary) EnsureBinary

func (b *Binary) EnsureBinary(update bool) error

func (*Binary) Env

func (b *Binary) Env() []string

func (*Binary) Exec

func (b *Binary) Exec(args ...string) (string, error)

func (*Binary) LocalBinary

func (b *Binary) LocalBinary() *LocalBinary

type Callback

type Callback func(*Binary) (string, error)

type IsBinary

type IsBinary interface {
	EnsureBinary(bool) error
	LocalBinary() *LocalBinary
}

type LocalBinary

type LocalBinary struct {
	Name    string `json:"name"`
	File    string `json:"file"`
	Version string `json:"version"`
	Latest  string `json:"latest"`
}

Jump to

Keyboard shortcuts

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