update

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: MIT Imports: 13 Imported by: 1

README

cobra-update

Provides a cobra command to allow your apps to self-update themselves by downloading the latest GitHub release.

Setup

  1. Add the command to your Cobra app, passing in the owner/repo where new releases will be downloaded from:

    import update "github.com/Shamus03/cobra-update"
    
    func init() {
        rootCmd.AddCommand(update.Command("Shamus03", "munn"))
    }
    
  2. (optional) Make sure your root *cobra.Command has its Version field set. This is the most simple example:

    var rootCmd = &cobra.Command {
        Use: "your-command",
        // other fields
        Version: "1.2.3",
    }
    
    • Skipping this step will cause the update command to always download the latest release, even if the executable is already up to date.
    • For a more complex example of setting the version through an automated workflow at build time, see munn's version file and semantic-release configuration.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(owner, repo string, options ...Option) *cobra.Command

Types

type Option

type Option interface {
	// contains filtered or unexported methods
}

func SetAssetIsCompatibleFunc

func SetAssetIsCompatibleFunc(f func(*github.ReleaseAsset) bool) Option

func SetDebugLoggerFlags

func SetDebugLoggerFlags(flags int) Option

func SetErrorLoggerFlags

func SetErrorLoggerFlags(flags int) Option

func SetGithubTokenEnvironmentVariableName

func SetGithubTokenEnvironmentVariableName(name string) Option

func SetLoggerFlags

func SetLoggerFlags(flags int) Option

Jump to

Keyboard shortcuts

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