blob: c1aaec3e6c77c26995c48ffcbcb8d7e77ce873b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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)
}
|