Upgrade k8s package verison (#5358)
* upgrade k8s package version Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> * Script upgrade and code formatting. Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io> Signed-off-by: hongzhouzi <hongzhouzi@kubesphere.io>
This commit is contained in:
19
vendor/k8s.io/component-base/cli/flag/sectioned.go
generated
vendored
19
vendor/k8s.io/component-base/cli/flag/sectioned.go
generated
vendored
@@ -22,9 +22,14 @@ import (
|
||||
"io"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
)
|
||||
|
||||
const (
|
||||
usageFmt = "Usage:\n %s\n"
|
||||
)
|
||||
|
||||
// NamedFlagSets stores named flag sets in the order of calling FlagSet.
|
||||
type NamedFlagSets struct {
|
||||
// Order is an ordered list of flag set names.
|
||||
@@ -84,3 +89,17 @@ func PrintSections(w io.Writer, fss NamedFlagSets, cols int) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// SetUsageAndHelpFunc set both usage and help function.
|
||||
// Print the flag sets we need instead of all of them.
|
||||
func SetUsageAndHelpFunc(cmd *cobra.Command, fss NamedFlagSets, cols int) {
|
||||
cmd.SetUsageFunc(func(cmd *cobra.Command) error {
|
||||
fmt.Fprintf(cmd.OutOrStderr(), usageFmt, cmd.UseLine())
|
||||
PrintSections(cmd.OutOrStderr(), fss, cols)
|
||||
return nil
|
||||
})
|
||||
cmd.SetHelpFunc(func(cmd *cobra.Command, args []string) {
|
||||
fmt.Fprintf(cmd.OutOrStdout(), "%s\n\n"+usageFmt, cmd.Long, cmd.UseLine())
|
||||
PrintSections(cmd.OutOrStdout(), fss, cols)
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user