exact version == print, delete comand

This commit is contained in:
daveberrys committed 2026-07-20 20:57:20 +08:00
1 parent f5b73893b7
commit d0cb8499df
3 files changed
+26

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
package cli
import (
"fmt"
"os"
"github.com/spf13/cobra"
)
var removeCmd = &cobra.Command{
Use: "remove",
Short: "Deletes the Guh binary",
Args: cobra.NoArgs,
RunE: func(cobraCmd *cobra.Command, args []string) error {
fmt.Println("Deleting Guh binary...")
fmt.Println("Goodbye, world!")
sysExec, _ := os.Executable()
err := os.Remove(sysExec)
if err != nil { return err }
return nil
},
}
+1
View File
@@ -10,6 +10,7 @@ func init() {
cliCmd.AddCommand(updateCmd) cliCmd.AddCommand(updateCmd)
cliCmd.AddCommand(versionCmd) cliCmd.AddCommand(versionCmd)
cliCmd.AddCommand(installCmd) cliCmd.AddCommand(installCmd)
cliCmd.AddCommand(removeCmd)
} }
var cliCmd = &cobra.Command{ var cliCmd = &cobra.Command{
+1
View File
@@ -35,6 +35,7 @@ var updateCmd = &cobra.Command{
guhGithubHash := commits[0].Sha[:7] guhGithubHash := commits[0].Sha[:7]
if guhGithubHash == Version { if guhGithubHash == Version {
fmt.Println("Already up to date.")
return nil return nil
} }