vin

package module
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2021 License: MIT Imports: 18 Imported by: 0

README

banner

ci release go report card license go version release

Description | Features | Installation | Usage | Configuration | References

Description

vin is the CLI to install applications from GitHub Releases.

In recent years, many useful CLI tools have been made by Go, Rust, etc.
Many of them are available as pre-built binaries in GitHub Releases, but we have to manipulate the browser to download them, decompress the compressed files, and move the executables to the appropriate path.

vin makes it easy to manage all at once by writing a list of applications in a TOML file.
No longer do we have to select suitable assets for our machines from GitHub Releases, no longer do we have to look up the options for the tar command, and no longer do we have to be pained when we setup a new machine.

Features

  • Easy to use
  • TOML-based configuration

Installation

Download the binary from GitHub Releases.
Unfortunately, the first time you install vin, you need to open the browser.

Or, if you have Go, you can install vin with the following command.

go get github.com/skmatz/vin/...

After installation, add ~/.vin/bin to your $PATH.

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

Usage

First, put the following TOML file in ~/.config/vin/vin.toml.

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

You can set this with the following command.

# darwin
mkdir -p ~/Library/Application\ Support/vin
vin example > ~/Library/Application\ Support/vin/vin.toml

# linux
mkdir -p ~/.config/vin
vin example > ~/.config/vin/vin.toml

# windows (confirmed on Windows Terminal)
mkdir -p ~\AppData\Roaming\vin\vin.toml
vin example > ~\AppData\Roaming\vin\vin.toml

Yes, all you have to do is run the following command.

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 is treated as "latest".
tag = "v1.2.0"

# keywords is a list of keywords for selecting suitable assets from multiple assets.
# If empty, it is treated as [$GOOS, $GOARCH].
keywords = ["amd64", "linux"]

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

# hosts is a list of host names.
# If empty, it is treated as any hosts.
hosts = ["awesome-machine"]

# priority is the priority of the application.
priority = 3

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

References

Thanks to ghg for the idea.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultVinDir added in v0.4.0

func DefaultVinDir() (string, error)

func TokenFromJSON added in v0.4.0

func TokenFromJSON(path string) (string, error)

Types

type App

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

	// Tag is the tag on GitHub.
	Tag string `toml:"tag,omitempty"`

	// Keywords is a list of keywords for selecting suitable assets from multiple assets.
	Keywords []string `toml:"keywords,omitempty"`

	// Name is the name of the executable file.
	Name string `toml:"name,omitempty"`

	// Hosts is a list of host names.
	Hosts []string `toml:"hosts,omitempty"`

	// Priority is the priority of the application.
	Priority int `toml:"priority,omitempty"`

	// Command is the command to run after installation.
	Command string `toml:"command,omitempty"`
	// contains filtered or unexported fields
}

App represents an application.

func (*App) RunCommand added in v0.3.0

func (a *App) RunCommand() error

func (*App) SuitableAssetURLs added in v0.3.0

func (a *App) SuitableAssetURLs() []string

func (*App) TagName added in v0.3.2

func (a *App) TagName() (string, error)

type ReadCloserWrapper added in v0.3.2

type ReadCloserWrapper interface {
	Wrap(app App, reader io.ReadCloser, contentLength int64) io.ReadCloser
}

type Token added in v0.3.3

type Token struct {
	Token string `json:"token"`
}

type Vin

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

Vin represents a Vin client.

func New

func New(vinDir string) (*Vin, error)

New returns a Vin client.

func (*Vin) AppAlreadyInstalled added in v0.3.0

func (v *Vin) AppAlreadyInstalled(app App) (bool, error)

func (*Vin) BinDir added in v0.4.0

func (v *Vin) BinDir() string

func (*Vin) CacheDir added in v0.3.0

func (v *Vin) CacheDir() (string, error)

func (*Vin) FetchApps added in v0.4.0

func (v *Vin) FetchApps(token string) error

func (Vin) Filter added in v0.3.0

func (v Vin) Filter(filter func(app App) bool) *Vin

func (*Vin) FilterByHost added in v0.3.0

func (v *Vin) FilterByHost(host string) *Vin

func (*Vin) FilterByPriority added in v0.3.0

func (v *Vin) FilterByPriority(minPriority int) *Vin

func (*Vin) FilterByRepo added in v0.3.0

func (v *Vin) FilterByRepo(repos []string) *Vin

func (*Vin) Install added in v0.3.0

func (v *Vin) Install(app App, url string, wrapper ReadCloserWrapper) error

func (*Vin) ReadTOML added in v0.4.0

func (v *Vin) ReadTOML(path string) error

func (*Vin) Repos added in v0.3.0

func (v *Vin) Repos() []string

func (*Vin) SaveCache added in v0.3.0

func (v *Vin) SaveCache(app App) error

func (*Vin) TmpDir added in v0.4.0

func (v *Vin) TmpDir() string

Directories

Path Synopsis
cmd
vin

Jump to

Keyboard shortcuts

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