gpm

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RegexpDependency = regexp.MustCompile(`^((?P<owner>[^/]+)/)?(?P<repo>[a-zA-Z-_.]+)(@(?P<tag>[^:]*))?(:(?P<assets>.*))?$`)

RegexpDependency is used to parse dependencies from raw strings.

Functions

This section is empty.

Types

type Dependency

type Dependency struct {
	Owner      string
	Repo       string
	ReleaseTag string
	AssetName  string
}

Dependency represents a release asset from a Github repository.

func ConvertDependenciesStrings

func ConvertDependenciesStrings(s ...string) ([]Dependency, error)

ConvertDependenciesStrings parses raw strings with RegexpDependency.

func (Dependency) String

func (dep Dependency) String() string

type GPM

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

GPM holds the common configurations to manage Dependency.

func NewGPM

func NewGPM(opts ...GPMOption) *GPM

func (GPM) GetBinPath

func (gpm GPM) GetBinPath() (string, error)

GetBinPath returns bin directory. See WithBinPath.

func (GPM) GetHomePath

func (gpm GPM) GetHomePath() (string, error)

GetHomePath returns the user home directory. See WithHomePath.

func (GPM) GetStorePath

func (gpm GPM) GetStorePath() (string, error)

GetStorePath returns the store directory. See WithStorePath.

func (GPM) InstallDependency

func (gpm GPM) InstallDependency(ctx context.Context, dep Dependency, progressTracker getter.ProgressTracker) error

func (GPM) ListDownloadedDependencies

func (gpm GPM) ListDownloadedDependencies(ctx context.Context) ([]Dependency, error)

func (GPM) ListLinkedDependencies

func (gpm GPM) ListLinkedDependencies(ctx context.Context) ([]LinkedDependencies, error)

type GPMOption

type GPMOption func(*GPM)

GPMOption is used to set options on GPM. GPM can accept a variable number of options.

func WithBinPath

func WithBinPath(binPath string) GPMOption

WithBinPath sets the path where symlinks to executables will be created. Defaults to ~/.local/bin.

func WithHomePath

func WithHomePath(homePath string) GPMOption

WithHomePath sets the home path that is used when initializing default paths (eg. GPM.GetBinPath). Defaults to ~/.

func WithStorePath

func WithStorePath(storePath string) GPMOption

WithStorePath sets the path prefix where the releases assets will be downloaded. Defaults to ~/.local/share/gpm.

type LinkedDependencies

type LinkedDependencies struct {
	Src, Dst string
}

Jump to

Keyboard shortcuts

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