cobra_updater

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CobraUpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update {{.Use}} to latest version",
	Long: `Update or check for updates.
The default update method is to download the latest release from GitHub.`,
	Example: `# Update to latest version
{{.Use}} update


# Use go install to update
{{.Use}} update -g


# Download from a specific URL
# Not sure why anyone else would need this. I use it for quickly testing builds on different machines.
{{.Use}} update -u http://10.0.0.2:8000/dist/carbon_darwin_arm64/carbon

# This is typically used after I run the following:
#	goreleaser release --clean --snapshot
#	python -m http.server

`,
	Run: func(cmd *cobra.Command, args []string) {
		check, _ := cmd.Flags().GetBool("check")
		goInstall, _ := cmd.Flags().GetBool("go-install")
		force, _ := cmd.Flags().GetBool("force")
		url, _ := cmd.Flags().GetString("url")

		var flag updater.OptionsFlag
		if !goInstall {
			flag = flag | updater.OptionsRelease
		}
		if force {
			flag = flag | updater.OptionsForce
		}
		if check {
			flag = flag | updater.OptionsCheck
		}

		updater.SelfUpdate(flag, url, versionInfo)
	},
}

CobraUpdateCmd represents the image command

Functions

func AddToRootCmd

func AddToRootCmd(rootCmd *cobra.Command, info build_info.Version)

Types

This section is empty.

Jump to

Keyboard shortcuts

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