From ef3ea4aacbb7bbb7fbdf43c73e05bbbf046a86b1 Mon Sep 17 00:00:00 2001 From: Gareth Date: Mon, 26 Jan 2026 21:34:54 -0800 Subject: [PATCH] fix: add a --version flag which prints the current backrest version info --- cmd/backrest/backrest.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/backrest/backrest.go b/cmd/backrest/backrest.go index 292abb09..56c23784 100644 --- a/cmd/backrest/backrest.go +++ b/cmd/backrest/backrest.go @@ -7,6 +7,7 @@ import ( "encoding/hex" "errors" "flag" + "fmt" "net/http" "os" "os/signal" @@ -42,6 +43,7 @@ import ( ) var installDepsOnly = flag.Bool("install-deps-only", false, "install dependencies and exit") +var printVersion = flag.Bool("version", false, "print version and exit") var ( version = "unknown" @@ -50,6 +52,10 @@ var ( func runApp() { flag.Parse() + if *printVersion { + fmt.Printf("backrest version: %s, commit: %s\n", version, commit) + return + } installLoggers(version, commit) // Install dependencies if requested