Use pflag functions instead of ours.

This commit is contained in:
Eric Paris
2015-08-16 23:33:44 -07:00
parent 681ee126ff
commit bcf912667b
7 changed files with 20 additions and 126 deletions

View File

@@ -271,11 +271,11 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
// BindFlags adds any flags that are common to all kubectl sub commands.
func (f *Factory) BindFlags(flags *pflag.FlagSet) {
// any flags defined by external projects (not part of pflags)
util.AddFlagSetToPFlagSet(flag.CommandLine, flags)
flags.AddGoFlagSet(flag.CommandLine)
// This is necessary as github.com/spf13/cobra doesn't support "global"
// pflags currently. See https://github.com/spf13/cobra/issues/44.
util.AddPFlagSetToPFlagSet(pflag.CommandLine, flags)
flags.AddFlagSet(pflag.CommandLine)
// Hack for global access to validation flag.
// TODO: Refactor out after configuration flag overhaul.
@@ -284,7 +284,7 @@ func (f *Factory) BindFlags(flags *pflag.FlagSet) {
}
// Merge factory's flags
util.AddPFlagSetToPFlagSet(f.flags, flags)
flags.AddFlagSet(f.flags)
// Globally persistent flags across all subcommands.
// TODO Change flag names to consts to allow safer lookup from subcommands.