vin

package module
v0.0.0-...-32ea98a Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: MIT Imports: 16 Imported by: 0

README

vin

Yet another GitHub Releases installer

vin is a CLI to install applications from GitHub Releases.

Concept

In recent years, many useful CLI applications have been created in Go, Rust, etc.
Many of them are available as pre-built binaries on GitHub Releases, but we (especially Linux users) don't have any tools to manage them.

vin makes it easy to manage them all at once by writing a list of applications in a TOML file.
No longer do you have to download a suitable asset from GitHub Releases, no longer do you have to unarchive it, and no longer do you have to check if the version has been updated.

Installation

Build with Go
go install github.com/km2/vin/cmd/vin@latest
GitHub Releases

https://github.com/km2/vin/releases

Usage

Put the following TOML file in $XDG_CONFIG_HOME/vin/vin.toml.

[[app]]
repo = "cli/cli"

Add the path where the downloaded binaries will be placed to $PATH.

export PATH="$HOME/.vin/bin:$PATH"

Now you just run the following command to install.

vin get

Configuration

[[app]]
# repo is the GitHub repository name in "owner/repo" format.
repo = "cli/cli"

# tag is the tag on GitHub.
# If empty, it means latest.
tag = "v1.0.0"

# keywords is a list of keywords to select a suitable asset from multiple assets.
# If empty, it means [$GOOS, $GOARCH].
keywords = ["linux", "amd64"]

# name is the name of the executable file.
# If empty, it means the original name.
name = "gh"

# command is the command to run after installation.
command = """
gh completion -s zsh > ~/.zfunc/_gh
"""

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterByRepo

func FilterByRepo(v *Vin) error

Types

type App

type App struct {
	// Repo is the GitHub repository name in "owner/repo" format.
	Repo string `mapstructure:"repo"`

	// Tag is the tag on GitHub.
	Tag string `mapstructure:"tag"`

	// Keywords is a list of keywords to select a suitable asset from multiple assets.
	Keywords []string `mapstructure:"keywords"`

	// Name is the name of the executable file.
	Name string `mapstructure:"name"`

	// Command is the command to run after installation.
	Command string `mapstructure:"command"`

	DownloadFunc func(ctx context.Context, url string, dst io.Writer) error
	// contains filtered or unexported fields
}

func (*App) AssetURL

func (a *App) AssetURL(release *github.RepositoryRelease) (string, error)

func (*App) HasCache

func (a *App) HasCache(tag string) bool

func (*App) Install

func (a *App) Install(ctx context.Context, url string) error

func (*App) Release

func (a *App) Release(ctx context.Context, gh *github.Client) (*github.RepositoryRelease, error)

func (*App) RunCommand

func (a *App) RunCommand() error

type Config

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

func NewConfig

func NewConfig() (*Config, error)

type Option

type Option func(*Vin) error

type Vin

type Vin struct {
	Apps []App `mapstructure:"app"`
	// contains filtered or unexported fields
}

func New

func New(config *Config) *Vin

func (*Vin) ApplyOptions

func (v *Vin) ApplyOptions(opts ...Option) error

func (*Vin) Init

func (v *Vin) Init()

Directories

Path Synopsis
cmd
vin

Jump to

Keyboard shortcuts

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