mirror of
https://github.com/daveberrys/guh.git
synced 2026-11-29 00:46:45 +08:00
windows heads-up discalimer
This commit is contained in:
1 parent
e0feb36c78
commit
b9025c6f7e
2 files changed
+14
-1
No files matched your search
@@ -3,6 +3,7 @@ package cli
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
@@ -19,6 +20,12 @@ var removeCmd = &cobra.Command{
|
|||||||
err := os.Remove(sysExec)
|
err := os.Remove(sysExec)
|
||||||
if err != nil { return err }
|
if err != nil { return err }
|
||||||
|
|
||||||
|
if runtime.GOOS == "windows" {
|
||||||
|
fmt.Println("\nThe binary may not be deleted due to Windows' permission issue.")
|
||||||
|
fmt.Println("If you wish to delete the binary, please run the following command in PowerShell:")
|
||||||
|
fmt.Printf(" del '%s'\n", sysExec)
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@@ -101,6 +101,12 @@ func doUpdateSequence() error {
|
|||||||
os.WriteFile(tmpPath, binData, 0755)
|
os.WriteFile(tmpPath, binData, 0755)
|
||||||
os.Rename(tmpPath, exePath)
|
os.Rename(tmpPath, exePath)
|
||||||
|
|
||||||
fmt.Println("Update successful!")
|
if runtime.GOOS == "windows" {
|
||||||
|
fmt.Println("\nThe update may not take effect due to Windows' permission issue.")
|
||||||
|
fmt.Println("If you wish to update, please run the following command in PowerShell:")
|
||||||
|
fmt.Printf(" move '%s' '%s'\n", tmpPath, exePath)
|
||||||
|
} else {
|
||||||
|
fmt.Println("Update successful!")
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user