fix(linux): remove support for upgrade

resolves #4992 as we are not able to support the upgrade command
on linux as updating oh-my-posh from within itself is impossible
to due a lock on the executable, unlike on darwin

Windows is able to update the executable after we start the installer
in the background and exit the current process
This commit is contained in:
Jan De Dobbeleer 2024-06-04 10:55:27 +02:00 committed by Jan De Dobbeleer
parent 92927638bf
commit fdf0de08c4
4 changed files with 13 additions and 2 deletions

View file

@ -2,6 +2,7 @@ package cli
import (
"fmt"
"runtime"
"github.com/jandedobbeleer/oh-my-posh/src/platform"
"github.com/jandedobbeleer/oh-my-posh/src/upgrade"
@ -17,6 +18,11 @@ var upgradeCmd = &cobra.Command{
Long: "Upgrade when a new version is available.",
Args: cobra.NoArgs,
Run: func(_ *cobra.Command, _ []string) {
if runtime.GOOS == platform.LINUX {
fmt.Print("\n ⚠️ upgrade is not supported on this platform\n\n")
return
}
if force {
upgrade.Run()
return

View file

@ -1,3 +1,5 @@
//go:build windows || darwin
package upgrade
import (

View file

@ -1,5 +1,3 @@
//go:build !windows
package upgrade
import (

5
src/upgrade/cli_other.go Normal file
View file

@ -0,0 +1,5 @@
//go:build linux || freebsd || openbsd
package upgrade
func Run() {}