binary

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 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 `json:"-"`
	// for installation
	URL           string            `json:"-"`
	URLF          Callback          `json:"-"`
	GitHubRepo    string            `json:"repo"`
	GitHubFile    string            `json:"-"`
	GitHubFileF   Callback          `json:"-"`
	Version       string            `json:"-"`
	VersionF      Callback          `json:"-"`
	VersionLocalF Callback          `json:"-"`
	Name          string            `json:"name" yaml:"name"`
	File          string            `json:"-"`
	IsTarGz       bool              `json:"-"`
	TarFile       string            `json:"-"`
	TarFileF      Callback          `json:"-"`
	Tracker       *progress.Tracker `json:"-"`
	// for execution
	Envs map[string]string `json:"-"`
}

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) DownloadBinary added in v0.2.1

func (b *Binary) DownloadBinary() error

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,omitempty"`
	Version  string `json:"version,omitempty"`
	Latest   string `json:"latest"`
	Enforced string `json:"enforced,omitempty"`
}

Jump to

Keyboard shortcuts

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