version

package
v0.0.16 Latest Latest
Warning

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

Go to latest
Published: May 21, 2022 License: MIT Imports: 18 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCombinedVersion

func GetCombinedVersion() string

GetCombinedVersion returns the version and commit id

func GetCommit

func GetCommit() string

GetCommit returns the commit id

func GetDate

func GetDate() string

GetDate returns the build date time

func GetVersion

func GetVersion() string

GetVersion returns the version

func NewSelfUpgradeCmd

func NewSelfUpgradeCmd(org, repo, name string, customDownloadFunc CustomDownloadFunc) (cmd *cobra.Command)

NewSelfUpgradeCmd create a command for self upgrade

func NewVersionCmd

func NewVersionCmd(org, repo, name string, customDownloadFunc CustomDownloadFunc) (cmd *cobra.Command)

NewVersionCmd create a command for version

func SetVersion

func SetVersion(ver string)

SetVersion is only for the test purpose

Types

type CustomDownloadFunc

type CustomDownloadFunc func(string) string

CustomDownloadFunc is the function interface for custom download URL

type PrintOption

type PrintOption struct {
	Changelog  bool
	ShowLatest bool

	Org  string
	Repo string
}

PrintOption is the version option

func (*PrintOption) RunE

func (o *PrintOption) RunE(cmd *cobra.Command, _ []string) (err error)

RunE is the main point of current command

type SelfUpgradeOption

type SelfUpgradeOption struct {
	ShowProgress       bool
	Privilege          bool
	Org                string
	Repo               string
	Name               string
	CustomDownloadFunc CustomDownloadFunc
	PathSeparate       string
	Thread             int

	GitHubClient *github.Client
	RoundTripper http.RoundTripper
}

SelfUpgradeOption is the option for self upgrade command

func (*SelfUpgradeOption) Download

func (o *SelfUpgradeOption) Download(log common.Printer, version, currentVersion, targetPath string) (err error)

Download downloads the binary file from GitHub release Org, Repo, Name is necessary

func (*SelfUpgradeOption) RunE

func (o *SelfUpgradeOption) RunE(cmd *cobra.Command, args []string) (err error)

RunE is the main point of current command

Jump to

Keyboard shortcuts

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