Print resource labels as columns

This commit is contained in:
Anastasis Andronidis
2015-06-16 18:30:11 +02:00
parent ff0546da4f
commit b06ef70057
11 changed files with 268 additions and 103 deletions

View File

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