diff options
| author | s <[email protected]> | 2025-11-04 13:29:38 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-04 13:29:38 -0500 |
| commit | 307f133527fe0c0c95a2fce7a261b1fe4d781a7c (patch) | |
| tree | 7b73bfe31af7785e93a9b259c0aaca384461854e /cmd | |
| parent | 4486b6659640102dd542fea007f4c33ac02511ff (diff) | |
| download | dborg-307f133527fe0c0c95a2fce7a261b1fe4d781a7c.tar.gz dborg-307f133527fe0c0c95a2fce7a261b1fe4d781a7c.zip | |
refactor: replace auto-update feature with manual update command
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/update.go | 33 |
1 files changed, 33 insertions, 0 deletions
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) +} |
