updatecmd

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UpdateCmd = &cobra.Command{
	Use:   "update",
	Short: "Update to the latest version of scf",
	Long:  "Update to the latest version of scf",
	Run: func(cmd *cobra.Command, args []string) {
		currentVersion, err := versioninfo.GetVersion()
		cobra.CheckErr(err)
		isUpdate, newVersion, err := versioninfo.CheckForUpdate()
		cobra.CheckErr(err)
		if !isUpdate {
			fmt.Printf("Current version, %s, is the latest. Nothing to update.\n", currentVersion)
		} else {
			fmt.Printf("Updating from version %s to version %s\n", currentVersion, newVersion)
			err = versioninfo.Update()
			if err != nil {
				var notSupportedError *updater.NotSupportedError
				if errors.As(err, &notSupportedError) {
					fmt.Printf("Self updating is not supported for %s. Please reinstall.", notSupportedError.Platform)
				} else {
					fmt.Println(err)
				}
				os.Exit(1)
			}
			fmt.Printf("Updated to version %s\n", newVersion)
		}
	},
}

updateCmd represents the update command

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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