bump spf13/cobra(c439c4): Terminate the stripping of flags when -- is found

pull/8/head
Di Xu 2018-03-19 15:23:41 +08:00
parent ebae09e741
commit 87cfc33b14
6 changed files with 16 additions and 12 deletions

8
Godeps/Godeps.json generated
View File

@ -2582,13 +2582,13 @@
},
{
"ImportPath": "github.com/spf13/cobra",
"Comment": "v0.0.1-32-g6644d46",
"Rev": "6644d46b81fa1831979c4cded0106e774e0ef0ab"
"Comment": "v0.0.1-34-gc439c4f",
"Rev": "c439c4fa093711d42e1b01acb1235b52004753c1"
},
{
"ImportPath": "github.com/spf13/cobra/doc",
"Comment": "v0.0.1-32-g6644d46",
"Rev": "6644d46b81fa1831979c4cded0106e774e0ef0ab"
"Comment": "v0.0.1-34-gc439c4f",
"Rev": "c439c4fa093711d42e1b01acb1235b52004753c1"
},
{
"ImportPath": "github.com/spf13/jwalterweatherman",

View File

@ -584,7 +584,7 @@
},
{
"ImportPath": "github.com/spf13/cobra",
"Rev": "6644d46b81fa1831979c4cded0106e774e0ef0ab"
"Rev": "c439c4fa093711d42e1b01acb1235b52004753c1"
},
{
"ImportPath": "github.com/spf13/pflag",

View File

@ -268,7 +268,7 @@
},
{
"ImportPath": "github.com/spf13/cobra",
"Rev": "6644d46b81fa1831979c4cded0106e774e0ef0ab"
"Rev": "c439c4fa093711d42e1b01acb1235b52004753c1"
},
{
"ImportPath": "github.com/spf13/pflag",

View File

@ -252,7 +252,7 @@
},
{
"ImportPath": "github.com/spf13/cobra",
"Rev": "6644d46b81fa1831979c4cded0106e774e0ef0ab"
"Rev": "c439c4fa093711d42e1b01acb1235b52004753c1"
},
{
"ImportPath": "github.com/spf13/pflag",

View File

@ -6,15 +6,16 @@ Generating bash completions from a cobra command is incredibly easy. An actual p
package main
import (
"io/ioutil"
"os"
"io/ioutil"
"os"
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl/cmd"
"k8s.io/kubernetes/pkg/kubectl/cmd"
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
)
func main() {
kubectl := cmd.NewFactory(nil).NewKubectlCommand(os.Stdin, ioutil.Discard, ioutil.Discard)
kubectl.GenBashCompletionFile("out.sh")
kubectl := cmd.NewKubectlCommand(util.NewFactory(nil), os.Stdin, ioutil.Discard, ioutil.Discard)
kubectl.GenBashCompletionFile("out.sh")
}
```

View File

@ -475,6 +475,9 @@ Loop:
s := args[0]
args = args[1:]
switch {
case s == "--":
// "--" terminates the flags
break Loop
case strings.HasPrefix(s, "--") && !strings.Contains(s, "=") && !hasNoOptDefVal(s[2:], flags):
// If '--flag arg' then
// delete arg from args.