From 8409ffff47c392eec514978a1b93e865097be8f2 Mon Sep 17 00:00:00 2001 From: atridadl Date: Tue, 16 Jan 2024 09:57:07 -0700 Subject: [PATCH] 1.0.1 --- main.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index 18b137e..7729491 100644 --- a/main.go +++ b/main.go @@ -7,7 +7,8 @@ import ( "os" ) -// parseCommandLine parses the command-line flags and returns the parsed values. +var version string = "1.0.1" + func parseCommandLine() (float64, int, string, string, string, string) { requestsPerSecond := flag.Float64("rate", 10, "Number of requests per second") maxRequests := flag.Int("max", 50, "Maximum number of requests to send (0 for unlimited)") @@ -15,10 +16,18 @@ func parseCommandLine() (float64, int, string, string, string, string) { requestType := flag.String("type", "GET", "Type of HTTP request (GET, POST, PUT, DELETE, etc.)") jsonFilePath := flag.String("json", "", "Path to the JSON file with request data") bearerToken := flag.String("token", "", "Bearer token for authorization") + versionFlag := flag.Bool("version", false, "Print the version and exit") + versionFlagShort := flag.Bool("v", false, "Print the version and exit") // Parse the command-line flags. flag.Parse() + // If the version flag is present, print the version number and exit. + if *versionFlag || *versionFlagShort { + fmt.Println("Version:", version) + os.Exit(0) + } + return *requestsPerSecond, *maxRequests, *url, *requestType, *jsonFilePath, *bearerToken }