From d0cb8499df970c454059622a5ffe4984d1ddca2f Mon Sep 17 00:00:00 2001 From: daveberrys <84567826+daveberrys@users.noreply.github.com> Date: Mon, 20 Jul 2026 20:57:20 +0800 Subject: [PATCH] exact version == print, delete comand --- src/cmd/cli/remove.go | 24 ++++++++++++++++++++++++ src/cmd/cli/root.go | 1 + src/cmd/cli/update.go | 1 + 3 files changed, 26 insertions(+) create mode 100644 src/cmd/cli/remove.go diff --git a/src/cmd/cli/remove.go b/src/cmd/cli/remove.go new file mode 100644 index 0000000..b97c5f1 --- /dev/null +++ b/src/cmd/cli/remove.go @@ -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 + }, +} \ No newline at end of file diff --git a/src/cmd/cli/root.go b/src/cmd/cli/root.go index fcb7170..3101af3 100644 --- a/src/cmd/cli/root.go +++ b/src/cmd/cli/root.go @@ -10,6 +10,7 @@ func init() { cliCmd.AddCommand(updateCmd) cliCmd.AddCommand(versionCmd) cliCmd.AddCommand(installCmd) + cliCmd.AddCommand(removeCmd) } var cliCmd = &cobra.Command{ diff --git a/src/cmd/cli/update.go b/src/cmd/cli/update.go index ea5af99..9d35b7d 100644 --- a/src/cmd/cli/update.go +++ b/src/cmd/cli/update.go @@ -35,6 +35,7 @@ var updateCmd = &cobra.Command{ guhGithubHash := commits[0].Sha[:7] if guhGithubHash == Version { + fmt.Println("Already up to date.") return nil }