Finish implementation of update-self

This commit is contained in:
Kovid Goyal
2022-11-16 17:44:21 +05:30
parent ae93d95bbe
commit 81916d0f02

View File

@@ -4,6 +4,7 @@ package update_self
import (
"fmt"
"kitty"
"os"
"path/filepath"
"runtime"
@@ -12,6 +13,8 @@ import (
"kitty/tools/tty"
"kitty/tools/tui"
"kitty/tools/utils"
"golang.org/x/sys/unix"
)
var _ = fmt.Print
@@ -38,6 +41,9 @@ func update_self(version string) (err error) {
if err != nil {
return err
}
if !kitty.IsStandaloneBuild {
return fmt.Errorf("This is not a standalone kitty-tool executable. You must update all of kitty instead.")
}
rv := "v" + version
if version == "nightly" {
rv = version
@@ -68,7 +74,8 @@ func update_self(version string) (err error) {
return err
}
}
return
fmt.Print("Updated to: ")
return unix.Exec(exe, []string{"kitty-tool", "--version"}, os.Environ())
}
func EntryPoint(root *cli.Command) {