From b23a8dc0e805e53e5b7576dd1f88775b75133be5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E6=97=AD=E4=B8=9C?= Date: Mon, 5 Aug 2019 17:06:01 +0800 Subject: [PATCH] fix yaml format --- cmd/add.go | 19 ++++++++++--------- example.yaml | 3 ++- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/cmd/add.go b/cmd/add.go index 1e1d0846..f167d875 100644 --- a/cmd/add.go +++ b/cmd/add.go @@ -31,12 +31,12 @@ var cover bool type ( Config struct { - ApiVersion string `yaml:"apiVersion"` - Kind string `yaml:"kind"` - Clusters []Clusters `yaml:"clusters"` - Contexts []Contexts `yaml:"contexts"` - CurrentContext string `yaml:"current-context"` - Users []Users `yaml:"users"` + ApiVersion string `yaml:"apiVersion"` + Kind string `yaml:"kind"` + Clusters []Clusters `yaml:"clusters"` + Contexts []Contexts `yaml:"contexts"` + CurrentContext string `yaml:"current-context"` + Users []Users `yaml:"users"` } Clusters struct { Cluster Cluster `yaml:"cluster"` @@ -47,12 +47,13 @@ type ( CertificateAuthorityData string `yaml:"certificate-authority-data"` } Contexts struct { - Context Context `yaml:"context"` - Name string `yaml:"name"` + Context Context `yaml:"context"` + Name string `yaml:"name"` } Context struct { Cluster string `yaml:"cluster"` User string `yaml:"user"` + NameSpace string `yaml:"namespace,omitempty"` } Users struct { Name string `yaml:"name"` @@ -185,4 +186,4 @@ func (c *Config) Check(name string) error { } } return nil -} \ No newline at end of file +} diff --git a/example.yaml b/example.yaml index 051cbd45..eb698334 100644 --- a/example.yaml +++ b/example.yaml @@ -8,10 +8,11 @@ contexts: - context: cluster: development user: developer + namespace: frontend name: dev-frontend current-context: dev-frontend kind: Config -preferences: {} +preferences: {123} users: - name: developer user: