cli: --check-flag

This commit is contained in:
Shlomi Noach 2016-12-29 17:39:44 +02:00
parent d21bd3f18c
commit 9dd8d858a1

View File

@ -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()