girelas

package module
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2021 License: MIT Imports: 6 Imported by: 0

README

girelas - Git Releases Assets downloader

Download assets from releases

usage

usage: girelas <rep> [--tag=<s>] [--token=<s>]

positional:
  rep                     repository name, like: owner/repository

options:
      --tag=<s>           tag name, if not specified, download latest release
      --token=<s>         access token required for private repository
  -h, --help              display this help and exit

./girelas owner/packagename - download assets from latest release

./girelas owner/packagename --token=... --tag=v1.2.3 - download assets from private repository by specified tag

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetData

type AssetData struct {
	URL                string `json:"url"`
	Name               string `json:"name"`
	Size               int    `json:"size"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

type Girelas

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

func NewGirelas

func NewGirelas(rep, token string) *Girelas

NewGirelas initialize new instance of Girelas struct

func (*Girelas) DownloadAsset

func (g *Girelas) DownloadAsset(asset AssetData, dir string) error

downloadAsset is request to the github api, to specified asset URL, it is impotant to set 'application/octet-stream' to the Accept header in response will be 302 forwarding to the real download link

func (*Girelas) FoundRelease

func (g *Girelas) FoundRelease(releases []ReleaseData, tag string) (rel ReleaseData, err error)

FoundRelease a release by specified tag or pick latest

func (*Girelas) GET

func (g *Girelas) GET(url, contentType string) (*req.Resp, error)

GET perform HTTP GET request with imroc/req package

func (*Girelas) LoadReleases

func (g *Girelas) LoadReleases() (releases []ReleaseData, err error)

loadReleases is request to the github api to specified repository and load all releases

type GithubRestErr

type GithubRestErr struct {
	Message          string `json:"message"`
	DocumentationURL string `json:"documentation_url"`
}

GithubRestErr describe REST API response error, it contains error message and url to the documentation

func (*GithubRestErr) Error

func (e *GithubRestErr) Error() string

type ReleaseData

type ReleaseData struct {
	URL        string      `json:"url"`
	AssetsURL  string      `json:"assets_url"`
	TagName    string      `json:"tag_name"`
	Assets     []AssetData `json:"assets"`
	ZipBallURL string      `json:"zipball_url"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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