published by bot

(https://github.com/kubernetes/contrib/tree/master/mungegithub)

copied from https://github.com/kubernetes/kubernetes.git, branch master,
last commit is 238ffdd0d6d79d610cea2ebe3a03868a197283c8
This commit is contained in:
Kubernetes Publisher
2016-12-03 08:16:09 +00:00
parent 5d8c36c93c
commit 41a99d711a
13 changed files with 370 additions and 69 deletions

View File

@@ -416,7 +416,7 @@ func Set(name, value string) error {
// otherwise, the default values of all defined flags in the set.
func (f *FlagSet) PrintDefaults() {
usages := f.FlagUsages()
fmt.Fprint(f.out(), usages)
fmt.Fprintf(f.out(), "%s", usages)
}
// defaultIsZeroValue returns true if the default value for this flag represents
@@ -514,7 +514,7 @@ func (f *FlagSet) FlagUsages() string {
if len(flag.NoOptDefVal) > 0 {
switch flag.Value.Type() {
case "string":
line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
line += fmt.Sprintf("[=%q]", flag.NoOptDefVal)
case "bool":
if flag.NoOptDefVal != "true" {
line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
@@ -534,7 +534,7 @@ func (f *FlagSet) FlagUsages() string {
line += usage
if !flag.defaultIsZeroValue() {
if flag.Value.Type() == "string" {
line += fmt.Sprintf(" (default \"%s\")", flag.DefValue)
line += fmt.Sprintf(" (default %q)", flag.DefValue)
} else {
line += fmt.Sprintf(" (default %s)", flag.DefValue)
}

View File

@@ -2,6 +2,7 @@ package pflag
import (
"fmt"
"strings"
)
var _ = fmt.Fprint
@@ -39,7 +40,7 @@ func (s *stringArrayValue) String() string {
}
func stringArrayConv(sval string) (interface{}, error) {
sval = sval[1 : len(sval)-1]
sval = strings.Trim(sval, "[]")
// An empty string would cause a array with one (empty) string
if len(sval) == 0 {
return []string{}, nil

View File

@@ -66,7 +66,7 @@ func (s *stringSliceValue) String() string {
}
func stringSliceConv(sval string) (interface{}, error) {
sval = sval[1 : len(sval)-1]
sval = strings.Trim(sval, "[]")
// An empty string would cause a slice with one (empty) string
if len(sval) == 0 {
return []string{}, nil