Merge pull request #62505 from mtaufen/show-deprecated-help

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>.

Show help for deprecated Kubelet flags

We recently deprecated a bunch of Kubelet flags, which caused them to disappear from `--help` output. This PR unhides these flags, so that the deprecation notice is clearly visible in `--help`.

Fixes: #62009

```release-note
NONE
```

/cc @eparis

Kubernetes-commit: ee4d90aaa61150139cdcd67a73e22da8cb226dc6
This commit is contained in:
Kubernetes Publisher 2018-04-14 12:21:01 -07:00
commit 32ad1389a8
19 changed files with 894 additions and 241 deletions

382
Godeps/Godeps.json generated
View File

@ -84,7 +84,7 @@
},
{
"ImportPath": "github.com/spf13/pflag",
"Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea"
"Rev": "583c0c0531f06d5278b7d917446061adc344b5cd"
},
{
"ImportPath": "golang.org/x/crypto/ssh/terminal",
@ -148,763 +148,763 @@
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1alpha1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/admissionregistration/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/apps/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/apps/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/apps/v1beta2",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/authentication/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/authentication/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/authorization/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/authorization/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/autoscaling/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/autoscaling/v2beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/batch/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/batch/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/batch/v2alpha1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/certificates/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/core/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/events/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/extensions/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/networking/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/policy/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/rbac/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/rbac/v1alpha1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/rbac/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/scheduling/v1alpha1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/settings/v1alpha1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/storage/v1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/storage/v1alpha1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/api/storage/v1beta1",
"Rev": "847e24b2c0e587a6a097d187ebd72e1ca24de001"
"Rev": "6fb8575d8ac324ad9f9605dec64b7a4b8a632e79"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/errors",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/meta",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/api/resource",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/internalversion",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/apis/meta/v1beta1",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/conversion/queryparams",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/fields",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/labels",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/schema",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/json",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/protobuf",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/recognizer",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/streaming",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/runtime/serializer/versioning",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/selection",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/types",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/cache",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/clock",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/diff",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/errors",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/framer",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/intstr",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/json",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/mergepatch",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/net",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/runtime",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/sets",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/strategicpatch",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/validation/field",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/wait",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/util/yaml",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/version",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/pkg/watch",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/json",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/apimachinery/third_party/forked/golang/reflect",
"Rev": "895b82eadff27f5a6b19d80628a04645823c1e46"
"Rev": "ba81bc69c72dde92d5f1fefa2fa6d82aa83a6676"
},
{
"ImportPath": "k8s.io/client-go/discovery",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/discovery/fake",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/admissionregistration",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/admissionregistration/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/admissionregistration/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/apps",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/apps/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/apps/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/apps/v1beta2",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/autoscaling",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/autoscaling/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/autoscaling/v2beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/batch",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/batch/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/batch/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/batch/v2alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/certificates",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/certificates/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/core",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/core/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/events",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/events/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/extensions",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/extensions/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/internalinterfaces",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/networking",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/networking/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/policy",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/policy/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/rbac/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/scheduling",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/scheduling/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/settings",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/settings/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/storage",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/storage/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/storage/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/informers/storage/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/scheme",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/admissionregistration/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/admissionregistration/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/apps/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/apps/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/apps/v1beta2",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authentication/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/authorization/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/autoscaling/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/batch/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/batch/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/batch/v2alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/certificates/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/core/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/events/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/extensions/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/networking/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/policy/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/rbac/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/rbac/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/rbac/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/scheduling/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/settings/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/storage/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/storage/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/kubernetes/typed/storage/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/admissionregistration/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/apps/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/apps/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/apps/v1beta2",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/autoscaling/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/autoscaling/v2beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/batch/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/batch/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/batch/v2alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/certificates/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/core/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/events/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/extensions/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/networking/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/policy/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/rbac/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/rbac/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/rbac/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/scheduling/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/settings/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/storage/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/storage/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/listers/storage/v1beta1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/pkg/apis/clientauthentication",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/pkg/apis/clientauthentication/v1alpha1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/pkg/version",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/plugin/pkg/client/auth/exec",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/rest",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/rest/watch",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/testing",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/auth",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/cache",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/latest",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/clientcmd/api/v1",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/metrics",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/pager",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/record",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/tools/reference",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/transport",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/buffer",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/cert",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/flowcontrol",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/homedir",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/integer",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/retry",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/client-go/util/workqueue",
"Rev": "92a7e0590135445af85d49e68630552180bd9e0a"
"Rev": "11179e1670c367e523060709f0b35a878fa9de9a"
},
{
"ImportPath": "k8s.io/kube-openapi/pkg/util/proto",

105
vendor/github.com/spf13/pflag/bytes.go generated vendored Normal file
View File

@ -0,0 +1,105 @@
package pflag
import (
"encoding/hex"
"fmt"
"strings"
)
// BytesHex adapts []byte for use as a flag. Value of flag is HEX encoded
type bytesHexValue []byte
func (bytesHex bytesHexValue) String() string {
return fmt.Sprintf("%X", []byte(bytesHex))
}
func (bytesHex *bytesHexValue) Set(value string) error {
bin, err := hex.DecodeString(strings.TrimSpace(value))
if err != nil {
return err
}
*bytesHex = bin
return nil
}
func (*bytesHexValue) Type() string {
return "bytesHex"
}
func newBytesHexValue(val []byte, p *[]byte) *bytesHexValue {
*p = val
return (*bytesHexValue)(p)
}
func bytesHexConv(sval string) (interface{}, error) {
bin, err := hex.DecodeString(sval)
if err == nil {
return bin, nil
}
return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err)
}
// GetBytesHex return the []byte value of a flag with the given name
func (f *FlagSet) GetBytesHex(name string) ([]byte, error) {
val, err := f.getFlagType(name, "bytesHex", bytesHexConv)
if err != nil {
return []byte{}, err
}
return val.([]byte), nil
}
// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
// The argument p points to an []byte variable in which to store the value of the flag.
func (f *FlagSet) BytesHexVar(p *[]byte, name string, value []byte, usage string) {
f.VarP(newBytesHexValue(value, p), name, "", usage)
}
// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
f.VarP(newBytesHexValue(value, p), name, shorthand, usage)
}
// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
// The argument p points to an []byte variable in which to store the value of the flag.
func BytesHexVar(p *[]byte, name string, value []byte, usage string) {
CommandLine.VarP(newBytesHexValue(value, p), name, "", usage)
}
// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
func BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
CommandLine.VarP(newBytesHexValue(value, p), name, shorthand, usage)
}
// BytesHex defines an []byte flag with specified name, default value, and usage string.
// The return value is the address of an []byte variable that stores the value of the flag.
func (f *FlagSet) BytesHex(name string, value []byte, usage string) *[]byte {
p := new([]byte)
f.BytesHexVarP(p, name, "", value, usage)
return p
}
// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
p := new([]byte)
f.BytesHexVarP(p, name, shorthand, value, usage)
return p
}
// BytesHex defines an []byte flag with specified name, default value, and usage string.
// The return value is the address of an []byte variable that stores the value of the flag.
func BytesHex(name string, value []byte, usage string) *[]byte {
return CommandLine.BytesHexP(name, "", value, usage)
}
// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
func BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
return CommandLine.BytesHexP(name, shorthand, value, usage)
}

128
vendor/github.com/spf13/pflag/duration_slice.go generated vendored Normal file
View File

@ -0,0 +1,128 @@
package pflag
import (
"fmt"
"strings"
"time"
)
// -- durationSlice Value
type durationSliceValue struct {
value *[]time.Duration
changed bool
}
func newDurationSliceValue(val []time.Duration, p *[]time.Duration) *durationSliceValue {
dsv := new(durationSliceValue)
dsv.value = p
*dsv.value = val
return dsv
}
func (s *durationSliceValue) Set(val string) error {
ss := strings.Split(val, ",")
out := make([]time.Duration, len(ss))
for i, d := range ss {
var err error
out[i], err = time.ParseDuration(d)
if err != nil {
return err
}
}
if !s.changed {
*s.value = out
} else {
*s.value = append(*s.value, out...)
}
s.changed = true
return nil
}
func (s *durationSliceValue) Type() string {
return "durationSlice"
}
func (s *durationSliceValue) String() string {
out := make([]string, len(*s.value))
for i, d := range *s.value {
out[i] = fmt.Sprintf("%s", d)
}
return "[" + strings.Join(out, ",") + "]"
}
func durationSliceConv(val string) (interface{}, error) {
val = strings.Trim(val, "[]")
// Empty string would cause a slice with one (empty) entry
if len(val) == 0 {
return []time.Duration{}, nil
}
ss := strings.Split(val, ",")
out := make([]time.Duration, len(ss))
for i, d := range ss {
var err error
out[i], err = time.ParseDuration(d)
if err != nil {
return nil, err
}
}
return out, nil
}
// GetDurationSlice returns the []time.Duration value of a flag with the given name
func (f *FlagSet) GetDurationSlice(name string) ([]time.Duration, error) {
val, err := f.getFlagType(name, "durationSlice", durationSliceConv)
if err != nil {
return []time.Duration{}, err
}
return val.([]time.Duration), nil
}
// DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string.
// The argument p points to a []time.Duration variable in which to store the value of the flag.
func (f *FlagSet) DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
f.VarP(newDurationSliceValue(value, p), name, "", usage)
}
// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
f.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
}
// DurationSliceVar defines a duration[] flag with specified name, default value, and usage string.
// The argument p points to a duration[] variable in which to store the value of the flag.
func DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
CommandLine.VarP(newDurationSliceValue(value, p), name, "", usage)
}
// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
func DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
CommandLine.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
}
// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
// The return value is the address of a []time.Duration variable that stores the value of the flag.
func (f *FlagSet) DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
p := []time.Duration{}
f.DurationSliceVarP(&p, name, "", value, usage)
return &p
}
// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
p := []time.Duration{}
f.DurationSliceVarP(&p, name, shorthand, value, usage)
return &p
}
// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
// The return value is the address of a []time.Duration variable that stores the value of the flag.
func DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
return CommandLine.DurationSliceP(name, "", value, usage)
}
// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
func DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
return CommandLine.DurationSliceP(name, shorthand, value, usage)
}

View File

@ -101,6 +101,7 @@ package pflag
import (
"bytes"
"errors"
goflag "flag"
"fmt"
"io"
"os"
@ -123,6 +124,12 @@ const (
PanicOnError
)
// ParseErrorsWhitelist defines the parsing errors that can be ignored
type ParseErrorsWhitelist struct {
// UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags
UnknownFlags bool
}
// NormalizedName is a flag name that has been normalized according to rules
// for the FlagSet (e.g. making '-' and '_' equivalent).
type NormalizedName string
@ -138,6 +145,9 @@ type FlagSet struct {
// help/usage messages.
SortFlags bool
// ParseErrorsWhitelist is used to configure a whitelist of errors
ParseErrorsWhitelist ParseErrorsWhitelist
name string
parsed bool
actual map[NormalizedName]*Flag
@ -153,6 +163,8 @@ type FlagSet struct {
output io.Writer // nil means stderr; use out() accessor
interspersed bool // allow interspersed option/non-option args
normalizeNameFunc func(f *FlagSet, name string) NormalizedName
addedGoFlagSets []*goflag.FlagSet
}
// A Flag represents the state of a flag.
@ -267,16 +279,16 @@ func (f *FlagSet) VisitAll(fn func(*Flag)) {
}
}
// HasFlags returns a bool to indicate if the FlagSet has any flags definied.
// HasFlags returns a bool to indicate if the FlagSet has any flags defined.
func (f *FlagSet) HasFlags() bool {
return len(f.formal) > 0
}
// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags
// definied that are not hidden or deprecated.
// that are not hidden.
func (f *FlagSet) HasAvailableFlags() bool {
for _, flag := range f.formal {
if !flag.Hidden && len(flag.Deprecated) == 0 {
if !flag.Hidden {
return true
}
}
@ -386,6 +398,7 @@ func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
return fmt.Errorf("deprecated message for flag %q must be set", name)
}
flag.Deprecated = usageMessage
flag.Hidden = true
return nil
}
@ -586,11 +599,14 @@ func wrapN(i, slop int, s string) (string, string) {
return s, ""
}
w := strings.LastIndexAny(s[:i], " \t")
w := strings.LastIndexAny(s[:i], " \t\n")
if w <= 0 {
return s, ""
}
nlPos := strings.LastIndex(s[:i], "\n")
if nlPos > 0 && nlPos < w {
return s[:nlPos], s[nlPos+1:]
}
return s[:w], s[w+1:]
}
@ -599,7 +615,7 @@ func wrapN(i, slop int, s string) (string, string) {
// caller). Pass `w` == 0 to do no wrapping
func wrap(i, w int, s string) string {
if w == 0 {
return s
return strings.Replace(s, "\n", "\n"+strings.Repeat(" ", i), -1)
}
// space between indent i and end of line width w into which
@ -617,7 +633,7 @@ func wrap(i, w int, s string) string {
}
// If still not enough space then don't even try to wrap.
if wrap < 24 {
return s
return strings.Replace(s, "\n", r, -1)
}
// Try to avoid short orphan words on the final line, by
@ -629,14 +645,14 @@ func wrap(i, w int, s string) string {
// Handle first line, which is indented by the caller (or the
// special case above)
l, s = wrapN(wrap, slop, s)
r = r + l
r = r + strings.Replace(l, "\n", "\n"+strings.Repeat(" ", i), -1)
// Now wrap the rest
for s != "" {
var t string
t, s = wrapN(wrap, slop, s)
r = r + "\n" + strings.Repeat(" ", i) + t
r = r + "\n" + strings.Repeat(" ", i) + strings.Replace(t, "\n", "\n"+strings.Repeat(" ", i), -1)
}
return r
@ -653,7 +669,7 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
maxlen := 0
f.VisitAll(func(flag *Flag) {
if flag.Deprecated != "" || flag.Hidden {
if flag.Hidden {
return
}
@ -700,6 +716,9 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
line += fmt.Sprintf(" (default %s)", flag.DefValue)
}
}
if len(flag.Deprecated) != 0 {
line += fmt.Sprintf(" (DEPRECATED: %s)", flag.Deprecated)
}
lines = append(lines, line)
})
@ -896,6 +915,25 @@ func (f *FlagSet) usage() {
}
}
//--unknown (args will be empty)
//--unknown --next-flag ... (args will be --next-flag ...)
//--unknown arg ... (args will be arg ...)
func stripUnknownFlagValue(args []string) []string {
if len(args) == 0 {
//--unknown
return args
}
first := args[0]
if first[0] == '-' {
//--unknown --next-flag ...
return args
}
//--unknown arg ... (args will be arg ...)
return args[1:]
}
func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
a = args
name := s[2:]
@ -907,14 +945,25 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
split := strings.SplitN(name, "=", 2)
name = split[0]
flag, exists := f.formal[f.normalizeFlagName(name)]
if !exists {
if name == "help" { // special case for nice help message.
switch {
case name == "help":
f.usage()
return a, ErrHelp
case f.ParseErrorsWhitelist.UnknownFlags:
// --unknown=unknownval arg ...
// we do not want to lose arg in this case
if len(split) >= 2 {
return a, nil
}
return stripUnknownFlagValue(a), nil
default:
err = f.failf("unknown flag: --%s", name)
return
}
}
var value string
if len(split) == 2 {
@ -951,14 +1000,26 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
flag, exists := f.shorthands[c]
if !exists {
if c == 'h' { // special case for nice help message.
switch {
case c == 'h':
f.usage()
err = ErrHelp
return
case f.ParseErrorsWhitelist.UnknownFlags:
// '-f=arg arg ...'
// we do not want to lose arg in this case
if len(shorthands) > 2 && shorthands[1] == '=' {
outShorts = ""
return
}
outArgs = stripUnknownFlagValue(outArgs)
return
default:
err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
return
}
}
var value string
if len(shorthands) > 2 && shorthands[1] == '=' {
@ -1044,6 +1105,11 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
// are defined and before flags are accessed by the program.
// The return value will be ErrHelp if -help was set but not defined.
func (f *FlagSet) Parse(arguments []string) error {
if f.addedGoFlagSets != nil {
for _, goFlagSet := range f.addedGoFlagSets {
goFlagSet.Parse(nil)
}
}
f.parsed = true
if len(arguments) < 0 {

View File

@ -98,4 +98,8 @@ func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
newSet.VisitAll(func(goflag *goflag.Flag) {
f.AddGoFlag(goflag)
})
if f.addedGoFlagSets == nil {
f.addedGoFlagSets = make([]*goflag.FlagSet, 0)
}
f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
}

View File

@ -52,7 +52,7 @@ func (f *FlagSet) GetStringArray(name string) ([]string, error) {
// StringArrayVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the values of the multiple flags.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
f.VarP(newStringArrayValue(value, p), name, "", usage)
}
@ -64,7 +64,7 @@ func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []s
// StringArrayVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func StringArrayVar(p *[]string, name string, value []string, usage string) {
CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
}
@ -76,7 +76,7 @@ func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage
// StringArray defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
p := []string{}
f.StringArrayVarP(&p, name, "", value, usage)
@ -92,7 +92,7 @@ func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage str
// StringArray defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func StringArray(name string, value []string, usage string) *[]string {
return CommandLine.StringArrayP(name, "", value, usage)
}

View File

@ -82,6 +82,11 @@ func (f *FlagSet) GetStringSlice(name string) ([]string, error) {
// StringSliceVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) {
f.VarP(newStringSliceValue(value, p), name, "", usage)
}
@ -93,6 +98,11 @@ func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []s
// StringSliceVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceVar(p *[]string, name string, value []string, usage string) {
CommandLine.VarP(newStringSliceValue(value, p), name, "", usage)
}
@ -104,6 +114,11 @@ func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage
// StringSlice defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string {
p := []string{}
f.StringSliceVarP(&p, name, "", value, usage)
@ -119,6 +134,11 @@ func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage str
// StringSlice defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSlice(name string, value []string, usage string) *[]string {
return CommandLine.StringSliceP(name, "", value, usage)
}

View File

@ -250,9 +250,7 @@ message WebhookClientConfig {
//
// If the webhook is running within the cluster, then you should use `service`.
//
// If there is only one port open for the service, that port will be
// used. If there are multiple ports open, port 443 will be used if it
// is open, otherwise it is an error.
// Port 443 will be used if it is open, otherwise it is an error.
//
// +optional
optional ServiceReference service = 1;

View File

@ -254,9 +254,7 @@ type WebhookClientConfig struct {
//
// If the webhook is running within the cluster, then you should use `service`.
//
// If there is only one port open for the service, that port will be
// used. If there are multiple ports open, port 443 will be used if it
// is open, otherwise it is an error.
// Port 443 will be used if it is open, otherwise it is an error.
//
// +optional
Service *ServiceReference `json:"service" protobuf:"bytes,1,opt,name=service"`

View File

@ -114,7 +114,7 @@ func (Webhook) SwaggerDoc() map[string]string {
var map_WebhookClientConfig = map[string]string{
"": "WebhookClientConfig contains the information to make a TLS connection with the webhook",
"url": "`url` gives the location of the webhook, in standard URL form (`[scheme://]host:port/path`). Exactly one of `url` or `service` must be specified.\n\nThe `host` should not refer to a service running in the cluster; use the `service` field instead. The host might be resolved via external DNS in some apiservers (e.g., `kube-apiserver` cannot resolve in-cluster DNS as that would be a layering violation). `host` may also be an IP address.\n\nPlease note that using `localhost` or `127.0.0.1` as a `host` is risky unless you take great care to run this webhook on all hosts which run an apiserver which might need to make calls to this webhook. Such installs are likely to be non-portable, i.e., not easy to turn up in a new cluster.\n\nThe scheme must be \"https\"; the URL must begin with \"https://\".\n\nA path is optional, and if present may be any string permissible in a URL. You may use the path to pass an arbitrary string to the webhook, for example, a cluster identifier.\n\nAttempting to use a user or basic auth e.g. \"user:password@\" is not allowed. Fragments (\"#...\") and query parameters (\"?...\") are not allowed, either.",
"service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.\n\nIf there is only one port open for the service, that port will be used. If there are multiple ports open, port 443 will be used if it is open, otherwise it is an error.",
"service": "`service` is a reference to the service for this webhook. Either `service` or `url` must be specified.\n\nIf the webhook is running within the cluster, then you should use `service`.\n\nPort 443 will be used if it is open, otherwise it is an error.",
"caBundle": "`caBundle` is a PEM encoded CA bundle which will be used to validate the webhook's server certificate. Required.",
}

6
vendor/k8s.io/api/core/v1/types.go generated vendored
View File

@ -1624,6 +1624,12 @@ type VolumeMount struct {
type MountPropagationMode string
const (
// MountPropagationNone means that the volume in a container will
// not receive new mounts from the host or other containers, and filesystems
// mounted inside the container won't be propagated to the host or other
// containers.
// Note that this mode corresponds to "private" in Linux terminology.
MountPropagationNone MountPropagationMode = "None"
// MountPropagationHostToContainer means that the volume in a container will
// receive new mounts from the host or other containers, but filesystems
// mounted inside the container won't be propagated to the host or other

View File

@ -144,8 +144,11 @@ func NewRESTMapper(groupResources []*APIGroupResources, versionInterfaces meta.V
func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
apiGroups, err := cl.ServerGroups()
if err != nil {
if apiGroups == nil || len(apiGroups.Groups) == 0 {
return nil, err
}
// TODO track the errors and update callers to handle partial errors.
}
var result []*APIGroupResources
for _, group := range apiGroups.Groups {
groupResources := &APIGroupResources{
@ -157,8 +160,10 @@ func GetAPIGroupResources(cl DiscoveryInterface) ([]*APIGroupResources, error) {
if err != nil {
// continue as best we can
// TODO track the errors and update callers to handle partial errors.
if resources == nil || len(resources.APIResources) == 0 {
continue
}
}
groupResources.VersionedResources[version.Version] = resources.APIResources
}
result = append(result, groupResources)

View File

@ -156,7 +156,7 @@
},
{
"ImportPath": "github.com/spf13/pflag",
"Rev": "4c012f6dcd9546820e378d0bdda4d8fc772cdfea"
"Rev": "583c0c0531f06d5278b7d917446061adc344b5cd"
},
{
"ImportPath": "golang.org/x/net/idna",

View File

@ -0,0 +1,105 @@
package pflag
import (
"encoding/hex"
"fmt"
"strings"
)
// BytesHex adapts []byte for use as a flag. Value of flag is HEX encoded
type bytesHexValue []byte
func (bytesHex bytesHexValue) String() string {
return fmt.Sprintf("%X", []byte(bytesHex))
}
func (bytesHex *bytesHexValue) Set(value string) error {
bin, err := hex.DecodeString(strings.TrimSpace(value))
if err != nil {
return err
}
*bytesHex = bin
return nil
}
func (*bytesHexValue) Type() string {
return "bytesHex"
}
func newBytesHexValue(val []byte, p *[]byte) *bytesHexValue {
*p = val
return (*bytesHexValue)(p)
}
func bytesHexConv(sval string) (interface{}, error) {
bin, err := hex.DecodeString(sval)
if err == nil {
return bin, nil
}
return nil, fmt.Errorf("invalid string being converted to Bytes: %s %s", sval, err)
}
// GetBytesHex return the []byte value of a flag with the given name
func (f *FlagSet) GetBytesHex(name string) ([]byte, error) {
val, err := f.getFlagType(name, "bytesHex", bytesHexConv)
if err != nil {
return []byte{}, err
}
return val.([]byte), nil
}
// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
// The argument p points to an []byte variable in which to store the value of the flag.
func (f *FlagSet) BytesHexVar(p *[]byte, name string, value []byte, usage string) {
f.VarP(newBytesHexValue(value, p), name, "", usage)
}
// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
f.VarP(newBytesHexValue(value, p), name, shorthand, usage)
}
// BytesHexVar defines an []byte flag with specified name, default value, and usage string.
// The argument p points to an []byte variable in which to store the value of the flag.
func BytesHexVar(p *[]byte, name string, value []byte, usage string) {
CommandLine.VarP(newBytesHexValue(value, p), name, "", usage)
}
// BytesHexVarP is like BytesHexVar, but accepts a shorthand letter that can be used after a single dash.
func BytesHexVarP(p *[]byte, name, shorthand string, value []byte, usage string) {
CommandLine.VarP(newBytesHexValue(value, p), name, shorthand, usage)
}
// BytesHex defines an []byte flag with specified name, default value, and usage string.
// The return value is the address of an []byte variable that stores the value of the flag.
func (f *FlagSet) BytesHex(name string, value []byte, usage string) *[]byte {
p := new([]byte)
f.BytesHexVarP(p, name, "", value, usage)
return p
}
// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
p := new([]byte)
f.BytesHexVarP(p, name, shorthand, value, usage)
return p
}
// BytesHex defines an []byte flag with specified name, default value, and usage string.
// The return value is the address of an []byte variable that stores the value of the flag.
func BytesHex(name string, value []byte, usage string) *[]byte {
return CommandLine.BytesHexP(name, "", value, usage)
}
// BytesHexP is like BytesHex, but accepts a shorthand letter that can be used after a single dash.
func BytesHexP(name, shorthand string, value []byte, usage string) *[]byte {
return CommandLine.BytesHexP(name, shorthand, value, usage)
}

View File

@ -0,0 +1,128 @@
package pflag
import (
"fmt"
"strings"
"time"
)
// -- durationSlice Value
type durationSliceValue struct {
value *[]time.Duration
changed bool
}
func newDurationSliceValue(val []time.Duration, p *[]time.Duration) *durationSliceValue {
dsv := new(durationSliceValue)
dsv.value = p
*dsv.value = val
return dsv
}
func (s *durationSliceValue) Set(val string) error {
ss := strings.Split(val, ",")
out := make([]time.Duration, len(ss))
for i, d := range ss {
var err error
out[i], err = time.ParseDuration(d)
if err != nil {
return err
}
}
if !s.changed {
*s.value = out
} else {
*s.value = append(*s.value, out...)
}
s.changed = true
return nil
}
func (s *durationSliceValue) Type() string {
return "durationSlice"
}
func (s *durationSliceValue) String() string {
out := make([]string, len(*s.value))
for i, d := range *s.value {
out[i] = fmt.Sprintf("%s", d)
}
return "[" + strings.Join(out, ",") + "]"
}
func durationSliceConv(val string) (interface{}, error) {
val = strings.Trim(val, "[]")
// Empty string would cause a slice with one (empty) entry
if len(val) == 0 {
return []time.Duration{}, nil
}
ss := strings.Split(val, ",")
out := make([]time.Duration, len(ss))
for i, d := range ss {
var err error
out[i], err = time.ParseDuration(d)
if err != nil {
return nil, err
}
}
return out, nil
}
// GetDurationSlice returns the []time.Duration value of a flag with the given name
func (f *FlagSet) GetDurationSlice(name string) ([]time.Duration, error) {
val, err := f.getFlagType(name, "durationSlice", durationSliceConv)
if err != nil {
return []time.Duration{}, err
}
return val.([]time.Duration), nil
}
// DurationSliceVar defines a durationSlice flag with specified name, default value, and usage string.
// The argument p points to a []time.Duration variable in which to store the value of the flag.
func (f *FlagSet) DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
f.VarP(newDurationSliceValue(value, p), name, "", usage)
}
// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
f.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
}
// DurationSliceVar defines a duration[] flag with specified name, default value, and usage string.
// The argument p points to a duration[] variable in which to store the value of the flag.
func DurationSliceVar(p *[]time.Duration, name string, value []time.Duration, usage string) {
CommandLine.VarP(newDurationSliceValue(value, p), name, "", usage)
}
// DurationSliceVarP is like DurationSliceVar, but accepts a shorthand letter that can be used after a single dash.
func DurationSliceVarP(p *[]time.Duration, name, shorthand string, value []time.Duration, usage string) {
CommandLine.VarP(newDurationSliceValue(value, p), name, shorthand, usage)
}
// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
// The return value is the address of a []time.Duration variable that stores the value of the flag.
func (f *FlagSet) DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
p := []time.Duration{}
f.DurationSliceVarP(&p, name, "", value, usage)
return &p
}
// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
func (f *FlagSet) DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
p := []time.Duration{}
f.DurationSliceVarP(&p, name, shorthand, value, usage)
return &p
}
// DurationSlice defines a []time.Duration flag with specified name, default value, and usage string.
// The return value is the address of a []time.Duration variable that stores the value of the flag.
func DurationSlice(name string, value []time.Duration, usage string) *[]time.Duration {
return CommandLine.DurationSliceP(name, "", value, usage)
}
// DurationSliceP is like DurationSlice, but accepts a shorthand letter that can be used after a single dash.
func DurationSliceP(name, shorthand string, value []time.Duration, usage string) *[]time.Duration {
return CommandLine.DurationSliceP(name, shorthand, value, usage)
}

View File

@ -101,6 +101,7 @@ package pflag
import (
"bytes"
"errors"
goflag "flag"
"fmt"
"io"
"os"
@ -123,6 +124,12 @@ const (
PanicOnError
)
// ParseErrorsWhitelist defines the parsing errors that can be ignored
type ParseErrorsWhitelist struct {
// UnknownFlags will ignore unknown flags errors and continue parsing rest of the flags
UnknownFlags bool
}
// NormalizedName is a flag name that has been normalized according to rules
// for the FlagSet (e.g. making '-' and '_' equivalent).
type NormalizedName string
@ -138,6 +145,9 @@ type FlagSet struct {
// help/usage messages.
SortFlags bool
// ParseErrorsWhitelist is used to configure a whitelist of errors
ParseErrorsWhitelist ParseErrorsWhitelist
name string
parsed bool
actual map[NormalizedName]*Flag
@ -153,6 +163,8 @@ type FlagSet struct {
output io.Writer // nil means stderr; use out() accessor
interspersed bool // allow interspersed option/non-option args
normalizeNameFunc func(f *FlagSet, name string) NormalizedName
addedGoFlagSets []*goflag.FlagSet
}
// A Flag represents the state of a flag.
@ -267,16 +279,16 @@ func (f *FlagSet) VisitAll(fn func(*Flag)) {
}
}
// HasFlags returns a bool to indicate if the FlagSet has any flags definied.
// HasFlags returns a bool to indicate if the FlagSet has any flags defined.
func (f *FlagSet) HasFlags() bool {
return len(f.formal) > 0
}
// HasAvailableFlags returns a bool to indicate if the FlagSet has any flags
// definied that are not hidden or deprecated.
// that are not hidden.
func (f *FlagSet) HasAvailableFlags() bool {
for _, flag := range f.formal {
if !flag.Hidden && len(flag.Deprecated) == 0 {
if !flag.Hidden {
return true
}
}
@ -386,6 +398,7 @@ func (f *FlagSet) MarkDeprecated(name string, usageMessage string) error {
return fmt.Errorf("deprecated message for flag %q must be set", name)
}
flag.Deprecated = usageMessage
flag.Hidden = true
return nil
}
@ -586,11 +599,14 @@ func wrapN(i, slop int, s string) (string, string) {
return s, ""
}
w := strings.LastIndexAny(s[:i], " \t")
w := strings.LastIndexAny(s[:i], " \t\n")
if w <= 0 {
return s, ""
}
nlPos := strings.LastIndex(s[:i], "\n")
if nlPos > 0 && nlPos < w {
return s[:nlPos], s[nlPos+1:]
}
return s[:w], s[w+1:]
}
@ -599,7 +615,7 @@ func wrapN(i, slop int, s string) (string, string) {
// caller). Pass `w` == 0 to do no wrapping
func wrap(i, w int, s string) string {
if w == 0 {
return s
return strings.Replace(s, "\n", "\n"+strings.Repeat(" ", i), -1)
}
// space between indent i and end of line width w into which
@ -617,7 +633,7 @@ func wrap(i, w int, s string) string {
}
// If still not enough space then don't even try to wrap.
if wrap < 24 {
return s
return strings.Replace(s, "\n", r, -1)
}
// Try to avoid short orphan words on the final line, by
@ -629,14 +645,14 @@ func wrap(i, w int, s string) string {
// Handle first line, which is indented by the caller (or the
// special case above)
l, s = wrapN(wrap, slop, s)
r = r + l
r = r + strings.Replace(l, "\n", "\n"+strings.Repeat(" ", i), -1)
// Now wrap the rest
for s != "" {
var t string
t, s = wrapN(wrap, slop, s)
r = r + "\n" + strings.Repeat(" ", i) + t
r = r + "\n" + strings.Repeat(" ", i) + strings.Replace(t, "\n", "\n"+strings.Repeat(" ", i), -1)
}
return r
@ -653,7 +669,7 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
maxlen := 0
f.VisitAll(func(flag *Flag) {
if flag.Deprecated != "" || flag.Hidden {
if flag.Hidden {
return
}
@ -700,6 +716,9 @@ func (f *FlagSet) FlagUsagesWrapped(cols int) string {
line += fmt.Sprintf(" (default %s)", flag.DefValue)
}
}
if len(flag.Deprecated) != 0 {
line += fmt.Sprintf(" (DEPRECATED: %s)", flag.Deprecated)
}
lines = append(lines, line)
})
@ -896,6 +915,25 @@ func (f *FlagSet) usage() {
}
}
//--unknown (args will be empty)
//--unknown --next-flag ... (args will be --next-flag ...)
//--unknown arg ... (args will be arg ...)
func stripUnknownFlagValue(args []string) []string {
if len(args) == 0 {
//--unknown
return args
}
first := args[0]
if first[0] == '-' {
//--unknown --next-flag ...
return args
}
//--unknown arg ... (args will be arg ...)
return args[1:]
}
func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []string, err error) {
a = args
name := s[2:]
@ -907,14 +945,25 @@ func (f *FlagSet) parseLongArg(s string, args []string, fn parseFunc) (a []strin
split := strings.SplitN(name, "=", 2)
name = split[0]
flag, exists := f.formal[f.normalizeFlagName(name)]
if !exists {
if name == "help" { // special case for nice help message.
switch {
case name == "help":
f.usage()
return a, ErrHelp
case f.ParseErrorsWhitelist.UnknownFlags:
// --unknown=unknownval arg ...
// we do not want to lose arg in this case
if len(split) >= 2 {
return a, nil
}
return stripUnknownFlagValue(a), nil
default:
err = f.failf("unknown flag: --%s", name)
return
}
}
var value string
if len(split) == 2 {
@ -951,14 +1000,26 @@ func (f *FlagSet) parseSingleShortArg(shorthands string, args []string, fn parse
flag, exists := f.shorthands[c]
if !exists {
if c == 'h' { // special case for nice help message.
switch {
case c == 'h':
f.usage()
err = ErrHelp
return
case f.ParseErrorsWhitelist.UnknownFlags:
// '-f=arg arg ...'
// we do not want to lose arg in this case
if len(shorthands) > 2 && shorthands[1] == '=' {
outShorts = ""
return
}
outArgs = stripUnknownFlagValue(outArgs)
return
default:
err = f.failf("unknown shorthand flag: %q in -%s", c, shorthands)
return
}
}
var value string
if len(shorthands) > 2 && shorthands[1] == '=' {
@ -1044,6 +1105,11 @@ func (f *FlagSet) parseArgs(args []string, fn parseFunc) (err error) {
// are defined and before flags are accessed by the program.
// The return value will be ErrHelp if -help was set but not defined.
func (f *FlagSet) Parse(arguments []string) error {
if f.addedGoFlagSets != nil {
for _, goFlagSet := range f.addedGoFlagSets {
goFlagSet.Parse(nil)
}
}
f.parsed = true
if len(arguments) < 0 {

View File

@ -98,4 +98,8 @@ func (f *FlagSet) AddGoFlagSet(newSet *goflag.FlagSet) {
newSet.VisitAll(func(goflag *goflag.Flag) {
f.AddGoFlag(goflag)
})
if f.addedGoFlagSets == nil {
f.addedGoFlagSets = make([]*goflag.FlagSet, 0)
}
f.addedGoFlagSets = append(f.addedGoFlagSets, newSet)
}

View File

@ -52,7 +52,7 @@ func (f *FlagSet) GetStringArray(name string) ([]string, error) {
// StringArrayVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the values of the multiple flags.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func (f *FlagSet) StringArrayVar(p *[]string, name string, value []string, usage string) {
f.VarP(newStringArrayValue(value, p), name, "", usage)
}
@ -64,7 +64,7 @@ func (f *FlagSet) StringArrayVarP(p *[]string, name, shorthand string, value []s
// StringArrayVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func StringArrayVar(p *[]string, name string, value []string, usage string) {
CommandLine.VarP(newStringArrayValue(value, p), name, "", usage)
}
@ -76,7 +76,7 @@ func StringArrayVarP(p *[]string, name, shorthand string, value []string, usage
// StringArray defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func (f *FlagSet) StringArray(name string, value []string, usage string) *[]string {
p := []string{}
f.StringArrayVarP(&p, name, "", value, usage)
@ -92,7 +92,7 @@ func (f *FlagSet) StringArrayP(name, shorthand string, value []string, usage str
// StringArray defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// The value of each argument will not try to be separated by comma
// The value of each argument will not try to be separated by comma. Use a StringSlice for that.
func StringArray(name string, value []string, usage string) *[]string {
return CommandLine.StringArrayP(name, "", value, usage)
}

View File

@ -82,6 +82,11 @@ func (f *FlagSet) GetStringSlice(name string) ([]string, error) {
// StringSliceVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func (f *FlagSet) StringSliceVar(p *[]string, name string, value []string, usage string) {
f.VarP(newStringSliceValue(value, p), name, "", usage)
}
@ -93,6 +98,11 @@ func (f *FlagSet) StringSliceVarP(p *[]string, name, shorthand string, value []s
// StringSliceVar defines a string flag with specified name, default value, and usage string.
// The argument p points to a []string variable in which to store the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSliceVar(p *[]string, name string, value []string, usage string) {
CommandLine.VarP(newStringSliceValue(value, p), name, "", usage)
}
@ -104,6 +114,11 @@ func StringSliceVarP(p *[]string, name, shorthand string, value []string, usage
// StringSlice defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func (f *FlagSet) StringSlice(name string, value []string, usage string) *[]string {
p := []string{}
f.StringSliceVarP(&p, name, "", value, usage)
@ -119,6 +134,11 @@ func (f *FlagSet) StringSliceP(name, shorthand string, value []string, usage str
// StringSlice defines a string flag with specified name, default value, and usage string.
// The return value is the address of a []string variable that stores the value of the flag.
// Compared to StringArray flags, StringSlice flags take comma-separated value as arguments and split them accordingly.
// For example:
// --ss="v1,v2" -ss="v3"
// will result in
// []string{"v1", "v2", "v3"}
func StringSlice(name string, value []string, usage string) *[]string {
return CommandLine.StringSliceP(name, "", value, usage)
}