diff --git a/go/cmd/gh-ost/main.go b/go/cmd/gh-ost/main.go index 6491f579f..fdfa91952 100644 --- a/go/cmd/gh-ost/main.go +++ b/go/cmd/gh-ost/main.go @@ -115,8 +115,13 @@ func main() { stack := flag.Bool("stack", false, "add stack trace upon error") help := flag.Bool("help", false, "Display usage") version := flag.Bool("version", false, "Print version & exit") + checkFlag := flag.Bool("check-flag", false, "Check if another flag exists/supported. This allows for cross-version scripting. Exits with 0 when all additional provided flags exist, nonzero otherwise. You must provide (dummy) values for flags that require a value. Example: gh-ost --check-flag --cut-over-lock-timeout-seconds --nice-ratio 0") + flag.Parse() + if *checkFlag { + return + } if *help { fmt.Fprintf(os.Stderr, "Usage of gh-ost:\n") flag.PrintDefaults()