From 581956c8ec416a9990ddf412f6e02b1855a00116 Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Wed, 5 Nov 2025 19:55:35 +0100 Subject: [PATCH] giv it a version --- main.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 4e4b585..c2dfb58 100644 --- a/main.go +++ b/main.go @@ -32,6 +32,7 @@ import ( "database/sql" "fmt" "log" + "os" "sync" "time" @@ -39,6 +40,8 @@ import ( flag "github.com/spf13/pflag" ) +const version = "v0.0.2" + type Tableschema struct { Name string } @@ -60,7 +63,7 @@ func main() { var optPort int var optMaxconnections int var optTimeout int - var optIdleTransaction bool + var optIdleTransaction, shversion bool var ctx context.Context var cancel context.CancelFunc var conn string @@ -71,11 +74,17 @@ func main() { flag.StringVarP(&optServer, "server", "s", "localhost", "Server") flag.IntVarP(&optMaxconnections, "client", "c", 500, "Number of concurrent users") flag.IntVarP(&optPort, "port", "P", 5432, "TCP Port") - flag.IntVarP(&optTimeout, "timeout", "t", 0, "Wether to stop the clients after N seconds") + flag.IntVarP(&optTimeout, "timeout", "t", 0, "Whether to stop the clients after N seconds") flag.BoolVarP(&optIdleTransaction, "idletransaction", "i", false, "Wether to stay in idle in transaction state") + flag.BoolVarP(&shversion, "version", "v", false, "show version") flag.Parse() + if shversion { + fmt.Printf("pgidler version %s\n", version) + os.Exit(0) + } + if optServer != "" { conn = fmt.Sprintf(NetConnection, optUser, optDatabase, optPasswd, optServer, optPort) } else {