From 307f133527fe0c0c95a2fce7a261b1fe4d781a7c Mon Sep 17 00:00:00 2001 From: s Date: Tue, 4 Nov 2025 13:29:38 -0500 Subject: refactor: replace auto-update feature with manual update command --- cmd/update.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cmd/update.go (limited to 'cmd/update.go') diff --git a/cmd/update.go b/cmd/update.go new file mode 100644 index 0000000..c1aaec3 --- /dev/null +++ b/cmd/update.go @@ -0,0 +1,33 @@ +package cmd + +import ( + "fmt" + "os" + "os/exec" + + "github.com/spf13/cobra" +) + +var updateCmd = &cobra.Command{ + Use: "update", + Short: "Update dborg to the latest version", + Long: `Update dborg by running go install git.db.org.ai/dborg`, + Run: func(cmd *cobra.Command, args []string) { + fmt.Println("Updating dborg...") + + installCmd := exec.Command("go", "install", "git.db.org.ai/dborg") + installCmd.Stdout = os.Stdout + installCmd.Stderr = os.Stderr + + if err := installCmd.Run(); err != nil { + fmt.Fprintf(os.Stderr, "Failed to update dborg: %v\n", err) + os.Exit(1) + } + + fmt.Println("dborg updated successfully!") + }, +} + +func init() { + rootCmd.AddCommand(updateCmd) +} -- cgit v1.2.3