mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 23:17:50 +00:00
Print resource labels as columns
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/clientcmd"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime"
|
||||
"github.com/GoogleCloudPlatform/kubernetes/pkg/util"
|
||||
utilerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/util/errors"
|
||||
"github.com/evanphx/json-patch"
|
||||
|
||||
@@ -250,6 +251,15 @@ func GetFlagString(cmd *cobra.Command, flag string) string {
|
||||
return f.Value.String()
|
||||
}
|
||||
|
||||
// GetFlagStringList can be used to accept multiple argument with flag repetition (e.g. -f arg1 -f arg2 ...)
|
||||
func GetFlagStringList(cmd *cobra.Command, flag string) util.StringList {
|
||||
f := cmd.Flags().Lookup(flag)
|
||||
if f == nil {
|
||||
return util.StringList{}
|
||||
}
|
||||
return *f.Value.(*util.StringList)
|
||||
}
|
||||
|
||||
func GetFlagBool(cmd *cobra.Command, flag string) bool {
|
||||
f := getFlag(cmd, flag)
|
||||
result, err := strconv.ParseBool(f.Value.String())
|
||||
|
||||
Reference in New Issue
Block a user