Merge pull request #53631 from dixudx/enforce_cobra_required_flags

Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

update vendor spf13/cobra to enforce required flags

**What this PR does / why we need it**:

spf13/cobra#502 has enforced checking flags that marked as required, an error will be raised if unset.

**Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*:fixes #54855
xref #48400
fixes kubernetes/kubectl#121

**Special notes for your reviewer**:
/assign @liggitt @eparis

**Release note**:

```release-note
kubectl now enforces required flags at a more fundamental level
```

Kubernetes-commit: 048757b8a51333f59d3112d2b228d2f0102a4afc
This commit is contained in:
Kubernetes Publisher 2018-01-18 02:00:27 -08:00
commit 4a1ec65955
6 changed files with 507 additions and 303 deletions

374
Godeps/Godeps.json generated
View File

@ -92,7 +92,7 @@
},
{
"ImportPath": "github.com/spf13/pflag",
"Rev": "9ff6c6923cfffbcd502984b8e0c80539a94968b7"
"Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea"
},
{
"ImportPath": "golang.org/x/crypto/ssh/terminal",
@ -152,747 +152,747 @@
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/apps/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/authentication/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/authorization/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/batch/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/core/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/networking/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/rbac/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/storage/v1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "17e8c4ddcf485c837950b38d9509bfcadfd0c8e1"
"Rev": "e81ae94485e04294ce22cc89b480edb2a4f7f575"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1alpha1",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "bc918d4f73e11cb3110730ec8e8ee02c58d6267c"
"Rev": "baafc3365acf1aa0c6c9c9aa169340d9fc2d3c6c"
},
{
"ImportPath": "k8s.io/client-go/discovery",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/discovery/fake",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/admissionregistration",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/admissionregistration/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/admissionregistration/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/apps",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/apps/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/apps/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/apps/v1beta2",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/autoscaling",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/autoscaling/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/autoscaling/v2beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/batch",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/batch/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/batch/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/batch/v2alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/certificates",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/certificates/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/core",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/core/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/events",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/events/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/extensions",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/extensions/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/internalinterfaces",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/networking",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/networking/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/policy",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/policy/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/scheduling",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/scheduling/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/settings",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/settings/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/storage",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/storage/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/storage/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/informers/storage/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/scheme",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/apps/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/apps/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/apps/v1beta2",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/autoscaling/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/batch/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/batch/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/batch/v2alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/certificates/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/core/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/events/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/extensions/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/networking/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/policy/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/rbac/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/rbac/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/settings/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/storage/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/storage/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/storage/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/apps/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/apps/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/apps/v1beta2",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/autoscaling/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/autoscaling/v2beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/batch/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/batch/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/batch/v2alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/certificates/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/core/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/events/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/extensions/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/networking/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/policy/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/rbac/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/rbac/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/rbac/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/scheduling/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/settings/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/storage/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/storage/v1alpha1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/listers/storage/v1beta1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/pkg/version",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/rest",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/rest/watch",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/testing",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/auth",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/cache",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/latest",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/v1",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/metrics",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/pager",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/record",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/tools/reference",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/transport",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/util/buffer",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/util/cert",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/util/flowcontrol",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/util/homedir",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/util/integer",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/client-go/util/workqueue",
"Rev": "e9556070fb13ce356af1ae66fd7f77e1b5815338"
"Rev": "8a28689b296bec0a8a7a422043195a2251386977"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",

View File

@ -3,13 +3,14 @@ sudo: false
language: go
go:
- 1.6.3
- 1.7.3
- 1.8.1
- tip
matrix:
allow_failures:
- go: tip
install:
- go get github.com/golang/lint/golint
- export PATH=$GOPATH/bin:$PATH

View File

@ -246,6 +246,25 @@ It is possible to mark a flag as hidden, meaning it will still function as norma
flags.MarkHidden("secretFlag")
```
## Disable sorting of flags
`pflag` allows you to disable sorting of flags for help and usage message.
**Example**:
```go
flags.BoolP("verbose", "v", false, "verbose output")
flags.String("coolflag", "yeaah", "it's really cool flag")
flags.Int("usefulflag", 777, "sometimes it's very useful")
flags.SortFlags = false
flags.PrintDefaults()
```
**Output**:
```
-v, --verbose verbose output
--coolflag string it's really cool flag (default "yeaah")
--usefulflag int sometimes it's very useful (default 777)
```
## Supporting Go flags when using pflag
In order to support flags defined using Go's `flag` package, they must be added to the `pflag` flagset. This is usually necessary
to support flags defined by third-party dependencies (e.g. `golang/glog`).
@ -270,8 +289,8 @@ func main() {
You can see the full reference documentation of the pflag package
[at godoc.org][3], or through go's standard documentation system by
running `godoc -http=:6060` and browsing to
[http://localhost:6060/pkg/github.com/ogier/pflag][2] after
[http://localhost:6060/pkg/github.com/spf13/pflag][2] after
installation.
[2]: http://localhost:6060/pkg/github.com/ogier/pflag
[3]: http://godoc.org/github.com/ogier/pflag
[2]: http://localhost:6060/pkg/github.com/spf13/pflag
[3]: http://godoc.org/github.com/spf13/pflag

View File

@ -11,13 +11,13 @@ func newCountValue(val int, p *int) *countValue {
}
func (i *countValue) Set(s string) error {
v, err := strconv.ParseInt(s, 0, 64)
// -1 means that no specific value was passed, so increment
if v == -1 {
// "+1" means that no specific value was passed, so increment
if s == "+1" {
*i = countValue(*i + 1)
} else {
*i = countValue(v)
return nil
}
v, err := strconv.ParseInt(s, 0, 0)
*i = countValue(v)
return err
}
@ -54,7 +54,7 @@ func (f *FlagSet) CountVar(p *int, name string, usage string) {
// CountVarP is like CountVar only take a shorthand for the flag name.
func (f *FlagSet) CountVarP(p *int, name, shorthand string, usage string) {
flag := f.VarPF(newCountValue(0, p), name, shorthand, usage)
flag.NoOptDefVal = "-1"
flag.NoOptDefVal = "+1"
}
// CountVar like CountVar only the flag is placed on the CommandLine instead of a given flag set
@ -83,7 +83,9 @@ func (f *FlagSet) CountP(name, shorthand string, usage string) *int {
return p
}
// Count like Count only the flag is placed on the CommandLine isntead of a given flag set
// Count defines a count flag with specified name, default value, and usage string.
// The return value is the address of an int variable that stores the value of the flag.
// A count flag will add 1 to its value evey time it is found on the command line
func Count(name string, usage string) *int {
return CommandLine.CountP(name, "", usage)
}

270
vendor/github.com/spf13/pflag/flag.go generated vendored
View File

@ -16,7 +16,7 @@ pflag is a drop-in replacement of Go's native flag package. If you import
pflag under the name "flag" then all code should continue to function
with no changes.
import flag "github.com/ogier/pflag"
import flag "github.com/spf13/pflag"
There is one exception to this: if you directly instantiate the Flag struct
there is one more field "Shorthand" that you will need to set.
@ -134,14 +134,21 @@ type FlagSet struct {
// a custom error handler.
Usage func()
// SortFlags is used to indicate, if user wants to have sorted flags in
// help/usage messages.
SortFlags bool
name string
parsed bool
actual map[NormalizedName]*Flag
orderedActual []*Flag
sortedActual []*Flag
formal map[NormalizedName]*Flag
orderedFormal []*Flag
sortedFormal []*Flag
shorthands map[byte]*Flag
args []string // arguments after flags
argsLenAtDash int // len(args) when a '--' was located when parsing, or -1 if no --
exitOnError bool // does the program exit if there's an error?
errorHandling ErrorHandling
output io.Writer // nil means stderr; use out() accessor
interspersed bool // allow interspersed option/non-option args
@ -194,11 +201,19 @@ func sortFlags(flags map[NormalizedName]*Flag) []*Flag {
// "--getUrl" which may also be translated to "geturl" and everything will work.
func (f *FlagSet) SetNormalizeFunc(n func(f *FlagSet, name string) NormalizedName) {
f.normalizeNameFunc = n
for k, v := range f.formal {
delete(f.formal, k)
nname := f.normalizeFlagName(string(k))
f.formal[nname] = v
v.Name = string(nname)
f.sortedFormal = f.sortedFormal[:0]
for fname, flag := range f.formal {
nname := f.normalizeFlagName(flag.Name)
if fname == nname {
continue
}
flag.Name = string(nname)
delete(f.formal, fname)
f.formal[nname] = flag
if _, set := f.actual[fname]; set {
delete(f.actual, fname)
f.actual[nname] = flag
}
}
}
@ -229,10 +244,25 @@ func (f *FlagSet) SetOutput(output io.Writer) {
f.output = output
}
// VisitAll visits the flags in lexicographical order, calling fn for each.
// VisitAll visits the flags in lexicographical order or
// in primordial order if f.SortFlags is false, calling fn for each.
// It visits all flags, even those not set.
func (f *FlagSet) VisitAll(fn func(*Flag)) {
for _, flag := range sortFlags(f.formal) {
if len(f.formal) == 0 {
return
}
var flags []*Flag
if f.SortFlags {
if len(f.formal) != len(f.sortedFormal) {
f.sortedFormal = sortFlags(f.formal)
}
flags = f.sortedFormal
} else {
flags = f.orderedFormal
}
for _, flag := range flags {
fn(flag)
}
}
@ -253,22 +283,39 @@ func (f *FlagSet) HasAvailableFlags() bool {
return false
}
// VisitAll visits the command-line flags in lexicographical order, calling
// fn for each. It visits all flags, even those not set.
// VisitAll visits the command-line flags in lexicographical order or
// in primordial order if f.SortFlags is false, calling fn for each.
// It visits all flags, even those not set.
func VisitAll(fn func(*Flag)) {
CommandLine.VisitAll(fn)
}
// Visit visits the flags in lexicographical order, calling fn for each.
// Visit visits the flags in lexicographical order or
// in primordial order if f.SortFlags is false, calling fn for each.
// It visits only those flags that have been set.
func (f *FlagSet) Visit(fn func(*Flag)) {
for _, flag := range sortFlags(f.actual) {
if len(f.actual) == 0 {
return
}
var flags []*Flag
if f.SortFlags {
if len(f.actual) != len(f.sortedActual) {
f.sortedActual = sortFlags(f.actual)
}
flags = f.sortedActual
} else {
flags = f.orderedActual
}
for _, flag := range flags {
fn(flag)
}
}
// Visit visits the command-line flags in lexicographical order, calling fn
// for each. It visits only those flags that have been set.
// Visit visits the command-line flags in lexicographical order or
// in primordial order if f.SortFlags is false, calling fn for each.
// It visits only those flags that have been set.
func Visit(fn func(*Flag)) {
CommandLine.Visit(fn)
}
@ -278,6 +325,22 @@ func (f *FlagSet) Lookup(name string) *Flag {
return f.lookup(f.normalizeFlagName(name))
}
// ShorthandLookup returns the Flag structure of the short handed flag,
// returning nil if none exists.
// It panics, if len(name) > 1.
func (f *FlagSet) ShorthandLookup(name string) *Flag {
if name == "" {
return nil
}
if len(name) > 1 {
msg := fmt.Sprintf("can not look up shorthand which is more than one ASCII character: %q", name)
fmt.Fprintf(f.out(), msg)
panic(msg)
}
c := name[0]
return f.shorthands[c]
}
// lookup returns the Flag structure of the named flag, returning nil if none exists.
func (f *FlagSet) lookup(name NormalizedName) *Flag {
return f.formal[name]
@ -319,7 +382,7 @@ func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
if flag == nil {
return fmt.Errorf("flag %q does not exist", name)
}
if len(usageMessage) == 0 {
if usageMessage == "" {
return fmt.Errorf("deprecated message for flag %q must be set", name)
}
flag.Deprecated = usageMessage
@ -334,7 +397,7 @@ func (f *FlagSet) MarkShorthandDeprecated(name string, usageMessage string) erro
if flag == nil {
return fmt.Errorf("flag %q does not exist", name)
}
if len(usageMessage) == 0 {
if usageMessage == "" {
return fmt.Errorf("deprecated message for flag %q must be set", name)
}
flag.ShorthandDeprecated = usageMessage
@ -358,6 +421,12 @@ func Lookup(name string) *Flag {
return CommandLine.Lookup(name)
}
// ShorthandLookup returns the Flag structure of the short handed flag,
// returning nil if none exists.
func ShorthandLookup(name string) *Flag {
return CommandLine.ShorthandLookup(name)
}
// Set sets the value of the named flag.
func (f *FlagSet) Set(name, value string) error {
normalName := f.normalizeFlagName(name)
@ -365,17 +434,30 @@ func (f *FlagSet) Set(name, value string) error {
if !ok {
return fmt.Errorf("no such flag -%v", name)
}
err := flag.Value.Set(value)
if err != nil {
return err
var flagName string
if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
flagName = fmt.Sprintf("-%s, --%s", flag.Shorthand, flag.Name)
} else {
flagName = fmt.Sprintf("--%s", flag.Name)
}
return fmt.Errorf("invalid argument %q for %q flag: %v", value, flagName, err)
}
if !flag.Changed {
if f.actual == nil {
f.actual = make(map[NormalizedName]*Flag)
}
f.actual[normalName] = flag
f.orderedActual = append(f.orderedActual, flag)
flag.Changed = true
if len(flag.Deprecated) > 0 {
fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
}
if flag.Deprecated != "" {
fmt.Fprintf(f.out(), "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
}
return nil
}
@ -482,6 +564,14 @@ func UnquoteUsage(flag *Flag) (name string, usage string) {
name = "int"
case "uint64":
name = "uint"
case "stringSlice":
name = "strings"
case "intSlice":
name = "ints"
case "uintSlice":
name = "uints"
case "boolSlice":
name = "bools"
}
return
@ -557,28 +647,28 @@ func wrap(i, w int, s string) string {
// for all flags in the FlagSet. Wrapped to `cols` columns (0 for no
// wrapping)
func (f *FlagSet) FlagUsagesWrapped(cols int) string {
x := new(bytes.Buffer)
buf := new(bytes.Buffer)
lines := make([]string, 0, len(f.formal))
maxlen := 0
f.VisitAll(func(flag *Flag) {
if len(flag.Deprecated) > 0 || flag.Hidden {
if flag.Deprecated != "" || flag.Hidden {
return
}
line := ""
if len(flag.Shorthand) > 0 && len(flag.ShorthandDeprecated) == 0 {
if flag.Shorthand != "" && flag.ShorthandDeprecated == "" {
line = fmt.Sprintf(" -%s, --%s", flag.Shorthand, flag.Name)
} else {
line = fmt.Sprintf(" --%s", flag.Name)
}
varname, usage := UnquoteUsage(flag)
if len(varname) > 0 {
if varname != "" {
line += " " + varname
}
if len(flag.NoOptDefVal) > 0 {
if flag.NoOptDefVal != "" {
switch flag.Value.Type() {
case "string":
line += fmt.Sprintf("[=\"%s\"]", flag.NoOptDefVal)
@ -586,6 +676,10 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
if flag.NoOptDefVal != "true" {
line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
}
case "count":
if flag.NoOptDefVal != "+1" {
line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
}
default:
line += fmt.Sprintf("[=%s]", flag.NoOptDefVal)
}
@ -601,7 +695,7 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) 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)
}
@ -614,10 +708,10 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
sidx := strings.Index(line, "\x00")
spacing := strings.Repeat(" ", maxlen-sidx)
// maxlen + 2 comes from + 1 for the \x00 and + 1 for the (deliberate) off-by-one in maxlen-sidx
fmt.Fprintln(x, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
fmt.Fprintln(buf, line[:sidx], spacing, wrap(maxlen+2, cols, line[sidx+1:]))
}
return x.String()
return buf.String()
}
// FlagUsages returns a string containing the usage information for all flags in
@ -714,11 +808,10 @@ func (f *FlagSet) VarP(value Value, name, shorthand, usage string) {
// AddFlag will add the flag to the FlagSet
func (f *FlagSet) AddFlag(flag *Flag) {
// Call normalizeFlagName function only once
normalizedFlagName := f.normalizeFlagName(flag.Name)
_, alreadythere := f.formal[normalizedFlagName]
if alreadythere {
_, alreadyThere := f.formal[normalizedFlagName]
if alreadyThere {
msg := fmt.Sprintf("%s flag redefined: %s", f.name, flag.Name)
fmt.Fprintln(f.out(), msg)
panic(msg) // Happens only if flags are declared with identical names
@ -729,28 +822,31 @@ func (f *FlagSet) AddFlag(flag *Flag) {
flag.Name = string(normalizedFlagName)
f.formal[normalizedFlagName] = flag
f.orderedFormal = append(f.orderedFormal, flag)
if len(flag.Shorthand) == 0 {
if flag.Shorthand == "" {
return
}
if len(flag.Shorthand) > 1 {
fmt.Fprintf(f.out(), "%s shorthand more than ASCII character: %s\n", f.name, flag.Shorthand)
panic("shorthand is more than one character")
msg := fmt.Sprintf("%q shorthand is more than one ASCII character", flag.Shorthand)
fmt.Fprintf(f.out(), msg)
panic(msg)
}
if f.shorthands == nil {
f.shorthands = make(map[byte]*Flag)
}
c := flag.Shorthand[0]
old, alreadythere := f.shorthands[c]
if alreadythere {
fmt.Fprintf(f.out(), "%s shorthand reused: %q for %s already used for %s\n", f.name, c, flag.Name, old.Name)
panic("shorthand redefinition")
used, alreadyThere := f.shorthands[c]
if alreadyThere {
msg := fmt.Sprintf("unable to redefine %q shorthand in %q flagset: it's already used for %q flag", c, f.name, used.Name)
fmt.Fprintf(f.out(), msg)
panic(msg)
}
f.shorthands[c] = flag
}
// AddFlagSet adds one FlagSet to another. If a flag is already present in f
// the flag from newSet will be ignored
// the flag from newSet will be ignored.
func (f *FlagSet) AddFlagSet(newSet *FlagSet) {
if newSet == nil {
return
@ -781,8 +877,10 @@ func VarP(value Value, name, shorthand, usage string) {
// returns the error.
func (f *FlagSet) failf(format string, a ...interface{}) error {
err := fmt.Errorf(format, a...)
if f.errorHandling != ContinueOnError {
fmt.Fprintln(f.out(), err)
f.usage()
}
return err
}
@ -798,34 +896,6 @@ func (f *FlagSet) usage() {
}
}
func (f *FlagSet) setFlag(flag *Flag, value string, origArg string) error {
if err := flag.Value.Set(value); err != nil {
return f.failf("invalid argument %q for %s: %v", value, origArg, err)
}
// mark as visited for Visit()
if f.actual == nil {
f.actual = make(map[NormalizedName]*Flag)
}
f.actual[f.normalizeFlagName(flag.Name)] = flag
flag.Changed = true
if len(flag.Deprecated) > 0 {
fmt.Fprintf(os.Stderr, "Flag --%s has been deprecated, %s\n", flag.Name, flag.Deprecated)
}
if len(flag.ShorthandDeprecated) > 0 && containsShorthand(origArg, flag.Shorthand) {
fmt.Fprintf(os.Stderr, "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
}
return nil
}
func containsShorthand(arg, shorthand string) bool {
// filter out flags --<flag_name>
if strings.HasPrefix(arg, "-") {
return false
}
arg = strings.SplitN(arg, "=", 2)[0]
return strings.Contains(arg, shorthand)
}
func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
a = args
name := s[2:]
@ -833,10 +903,11 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
err = f.failf("bad flag syntax: %s", s)
return
}
split := strings.SplitN(name, "=", 2)
name = split[0]
flag, alreadythere := f.formal[f.normalizeFlagName(name)]
if !alreadythere {
flag, exists := f.formal[f.normalizeFlagName(name)]
if !exists {
if name == "help" { // special case for nice help message.
f.usage()
return a, ErrHelp
@ -844,11 +915,12 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
err = f.failf("unknown flag: --%s", name)
return
}
var value string
if len(split) == 2 {
// '--flag=arg'
value = split[1]
} else if len(flag.NoOptDefVal) > 0 {
} else if flag.NoOptDefVal != "" {
// '--flag' (arg was optional)
value = flag.NoOptDefVal
} else if len(a) > 0 {
@ -860,7 +932,11 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
err = f.failf("flag needs an argument: %s", s)
return
}
err = fn(flag, value, s)
err = fn(flag, value)
if err != nil {
f.failf(err.Error())
}
return
}
@ -868,38 +944,52 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
if strings.HasPrefix(shorthands, "test.") {
return
}
outArgs = args
outShorts = shorthands[1:]
c := shorthands[0]
flag, alreadythere := f.shorthands[c]
if !alreadythere {
flag, exists := f.shorthands[c]
if !exists {
if c == 'h' { // special case for nice help message.
f.usage()
err = ErrHelp
return
}
//TODO continue on error
err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
return
}
var value string
if len(shorthands) > 2 && shorthands[1] == '=' {
// '-f=arg'
value = shorthands[2:]
outShorts = ""
} else if len(flag.NoOptDefVal) > 0 {
} else if flag.NoOptDefVal != "" {
// '-f' (arg was optional)
value = flag.NoOptDefVal
} else if len(shorthands) > 1 {
// '-farg'
value = shorthands[1:]
outShorts = ""
} else if len(args) > 0 {
// '-f arg'
value = args[0]
outArgs = args[1:]
} else {
// '-f' (arg was required)
err = f.failf("flag needs an argument: %q in -%s", c, shorthands)
return
}
err = fn(flag, value, shorthands)
if flag.ShorthandDeprecated != "" {
fmt.Fprintf(f.out(), "Flag shorthand -%s has been deprecated, %s\n", flag.Shorthand, flag.ShorthandDeprecated)
}
err = fn(flag, value)
if err != nil {
f.failf(err.Error())
}
return
}
@ -907,6 +997,7 @@ func (f *FlagSet) parseShortArg(s string, args []string, fn parseFunc) (a []stri
a = args
shorthands := s[1:]
// "shorthands" can be a series of shorthand letters of flags (e.g. "-vvv").
for len(shorthands) > 0 {
shorthands, a, err = f.parseSingleShortArg(shorthands, args, fn)
if err != nil {
@ -954,18 +1045,24 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
// The return value will be ErrHelp if -help was set but not defined.
func (f *FlagSet) Parse(arguments []string) error {
f.parsed = true
f.args = make([]string, 0, len(arguments))
assign := func(flag *Flag, value, origArg string) error {
return f.setFlag(flag, value, origArg)
if len(arguments) < 0 {
return nil
}
err := f.parseArgs(arguments, assign)
f.args = make([]string, 0, len(arguments))
set := func(flag *Flag, value string) error {
return f.Set(flag.Name, value)
}
err := f.parseArgs(arguments, set)
if err != nil {
switch f.errorHandling {
case ContinueOnError:
return err
case ExitOnError:
fmt.Println(err)
os.Exit(2)
case PanicOnError:
panic(err)
@ -974,7 +1071,7 @@ func (f *FlagSet) Parse(arguments []string) error {
return nil
}
type parseFunc func(flag *Flag, value, origArg string) error
type parseFunc func(flag *Flag, value string) error
// ParseAll parses flag definitions from the argument list, which should not
// include the command name. The arguments for fn are flag and value. Must be
@ -985,11 +1082,7 @@ func (f *FlagSet) ParseAll(arguments []string, fn func(flag *Flag, value string)
f.parsed = true
f.args = make([]string, 0, len(arguments))
assign := func(flag *Flag, value, origArg string) error {
return fn(flag, value)
}
err := f.parseArgs(arguments, assign)
err := f.parseArgs(arguments, fn)
if err != nil {
switch f.errorHandling {
case ContinueOnError:
@ -1036,14 +1129,15 @@ func Parsed() bool {
// CommandLine is the default set of command-line flags, parsed from os.Args.
var CommandLine = NewFlagSet(os.Args[0], ExitOnError)
// NewFlagSet returns a new, empty flag set with the specified name and
// error handling property.
// NewFlagSet returns a new, empty flag set with the specified name,
// error handling property and SortFlags set to true.
func NewFlagSet(name string, errorHandling ErrorHandling) *FlagSet {
f := &FlagSet{
name: name,
errorHandling: errorHandling,
argsLenAtDash: -1,
interspersed: true,
SortFlags: true,
}
return f
}

88
vendor/github.com/spf13/pflag/int16.go generated vendored Normal file
View File

@ -0,0 +1,88 @@
package pflag
import "strconv"
// -- int16 Value
type int16Value int16
func newInt16Value(val int16, p *int16) *int16Value {
*p = val
return (*int16Value)(p)
}
func (i *int16Value) Set(s string) error {
v, err := strconv.ParseInt(s, 0, 16)
*i = int16Value(v)
return err
}
func (i *int16Value) Type() string {
return "int16"
}
func (i *int16Value) String() string { return strconv.FormatInt(int64(*i), 10) }
func int16Conv(sval string) (interface{}, error) {
v, err := strconv.ParseInt(sval, 0, 16)
if err != nil {
return 0, err
}
return int16(v), nil
}
// GetInt16 returns the int16 value of a flag with the given name
func (f *FlagSet) GetInt16(name string) (int16, error) {
val, err := f.getFlagType(name, "int16", int16Conv)
if err != nil {
return 0, err
}
return val.(int16), nil
}
// Int16Var defines an int16 flag with specified name, default value, and usage string.
// The argument p points to an int16 variable in which to store the value of the flag.
func (f *FlagSet) Int16Var(p *int16, name string, value int16, usage string) {
f.VarP(newInt16Value(value, p), name, "", usage)
}
// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) Int16VarP(p *int16, name, shorthand string, value int16, usage string) {
f.VarP(newInt16Value(value, p), name, shorthand, usage)
}
// Int16Var defines an int16 flag with specified name, default value, and usage string.
// The argument p points to an int16 variable in which to store the value of the flag.
func Int16Var(p *int16, name string, value int16, usage string) {
CommandLine.VarP(newInt16Value(value, p), name, "", usage)
}
// Int16VarP is like Int16Var, but accepts a shorthand letter that can be used after a single dash.
func Int16VarP(p *int16, name, shorthand string, value int16, usage string) {
CommandLine.VarP(newInt16Value(value, p), name, shorthand, usage)
}
// Int16 defines an int16 flag with specified name, default value, and usage string.
// The return value is the address of an int16 variable that stores the value of the flag.
func (f *FlagSet) Int16(name string, value int16, usage string) *int16 {
p := new(int16)
f.Int16VarP(p, name, "", value, usage)
return p
}
// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) Int16P(name, shorthand string, value int16, usage string) *int16 {
p := new(int16)
f.Int16VarP(p, name, shorthand, value, usage)
return p
}
// Int16 defines an int16 flag with specified name, default value, and usage string.
// The return value is the address of an int16 variable that stores the value of the flag.
func Int16(name string, value int16, usage string) *int16 {
return CommandLine.Int16P(name, "", value, usage)
}
// Int16P is like Int16, but accepts a shorthand letter that can be used after a single dash.
func Int16P(name, shorthand string, value int16, usage string) *int16 {
return CommandLine.Int16P(name, shorthand, value, usage)
}