vitess-gh/go/cmd/zkctld
Andrew Mason c3f4a998b2
[cmd/*] Switch to pflag for all CLI flag parsing (#10619)
* Switch to `pflag` for all parsing

This transparently swaps the cli parsing library used by `internal/flag`
from the standard library `flag` package to `spf13/pflag`.

It also introduces hook points for packages throughout the vitess codebase
to register their flags for either all commands using `servenv` or a
particular subset of commands. This allows these packages to continue to
define their flag variables in a package-private way, but without
polluting the global flagset.

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Workaround exit code difference between stdlib `flag` and `pflag`

tl;dr stdlib `flag` has [this][1] and `pflag` does not

[1]: dcf0929de6

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* adjust test data for difference in spacing between pflag/stdflag

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* update lingering legacy flag tests

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* Update vtgate/tabletgateway.go to use new interface to isolate flags, update test data

Signed-off-by: Andrew Mason <andrew@planetscale.com>

* update flags in java test code

Signed-off-by: Andrew Mason <andrew@planetscale.com>
2022-07-25 15:12:09 -04:00
..
zkctld.go [cmd/*] Switch to pflag for all CLI flag parsing (#10619) 2022-07-25 15:12:09 -04:00