PT-2236 - pt-secure-collect, pt-pg-summary do not follow PT standard (#652)

* PT-2236 - pt-secure-collect, pt-pg-summary do not follow PT standard for option --version

- Redirected UsageWriter to os.Stdout for kingpin, so --version output
  goes to STDOUT, not to STDERR
- Adjusted text, printed by the --version flag
- Added test cases to check how --version flag works
- Adjusted test cases, so they use TOOLNAME constant

* PT-2236 - pt-secure-collect, pt-pg-summary do not follow PT standard for option --version

Run go mod tidy as requested by Artem Gavrilov

* PT-2236 - pt-secure-collect, pt-pg-summary do not follow PT standard for option --version

Renamed const TOOLNAME to toolname to follow Go coding standards
This commit is contained in:
Sveta Smirnova
2023-07-31 16:59:30 +03:00
committed by GitHub
parent 91f9e27255
commit ab4bf1b1c6
11 changed files with 70 additions and 29 deletions

View File

@@ -42,7 +42,7 @@ type response struct {
}
const (
TOOLNAME = "pt-mongodb-index-check"
toolname = "pt-mongodb-index-check"
)
// We do not set anything here, these variables are defined by the Makefile
@@ -58,7 +58,7 @@ func main() {
kongctx := kong.Parse(&args, kong.UsageOnError())
if kongctx.Command() == "version" {
fmt.Println(TOOLNAME)
fmt.Println(toolname)
fmt.Printf("Version %s\n", Version)
fmt.Printf("Build: %s using %s\n", Build, GoVersion)
fmt.Printf("Commit: %s\n", Commit)