From 9dd8d858a17c600152c8b1a4bd97fc6e0c2b61de Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Thu, 29 Dec 2016 17:39:44 +0200 Subject: [PATCH] cli: --check-flag --- go/cmd/gh-ost/main.go | 5 +++++ 1 file changed, 5 insertions(+) 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()