add update command

This commit is contained in:
Henry Dollman
2024-07-20 17:00:09 -04:00
parent b18433f428
commit 0d2765a903
5 changed files with 111 additions and 11 deletions

View File

@@ -27,6 +27,7 @@ import (
"github.com/pocketbase/pocketbase/plugins/migratecmd"
"github.com/pocketbase/pocketbase/tools/cron"
"github.com/pocketbase/pocketbase/tools/mailer"
"github.com/spf13/cobra"
"golang.org/x/crypto/ssh"
)
@@ -43,6 +44,13 @@ func main() {
app.RootCmd.Use = "beszel"
app.RootCmd.Short = ""
// add update command
app.RootCmd.AddCommand(&cobra.Command{
Use: "update",
Short: "Update beszel to the latest version",
Run: updateBeszel,
})
// loosely check if it was executed using "go run"
isGoRun := strings.HasPrefix(os.Args[0], os.TempDir())