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 }