Repository: GoogleContainerTools/krew
Pull request #2 (2018-07-12 22:26:49)

Change Intro plugin index field
Change the "Intro" field to the more descriptive
"shortDescription" field.


Patch:
diff --git a/cmd/krew/cmd/search.go b/cmd/krew/cmd/search.go
index 09bdbdc..0c53a0e 100644
--- a/cmd/krew/cmd/search.go
+++ b/cmd/krew/cmd/search.go
@@ -76,7 +76,7 @@ Search accepts a list of words as options.`,
 			} else {
 				status = "unavailable"
 			}
-			fmt.Fprintf(w, rowPattern, name, limitString(plugin.Spec.Intro, 50), status)
+			fmt.Fprintf(w, rowPattern, name, limitString(plugin.Spec.ShortDescription, 50), status)
 		}
 		w.Flush()
 		return nil
diff --git a/pkg/index/types.go b/pkg/index/types.go
index fc074ec..82ea4fd 100644
--- a/pkg/index/types.go
+++ b/pkg/index/types.go
@@ -28,10 +28,10 @@ type Plugin struct {
 }
 
 type PluginSpec struct {
-	Version     string `json:"version,omitempty"`
-	Intro       string `json:"intro,omitempty"`
-	Description string `json:"description,omitempty"`
-	Caveats     string `json:"caveats,omitempty"`
+	Version          string `json:"version,omitempty"`
+	ShortDescription string `json:"shortDescription,omitempty"`
+	Description      string `json:"description,omitempty"`
+	Caveats          string `json:"caveats,omitempty"`
 
 	Platforms []Platform `json:"platforms,omitempty"`
 }
diff --git a/pkg/index/validate.go b/pkg/index/validate.go
index a25cf1f..36eafcd 100644
--- a/pkg/index/validate.go
+++ b/pkg/index/validate.go
@@ -46,7 +46,7 @@ func (p Plugin) Validate(name string) error {
 	if p.Name != name {
 		return fmt.Errorf("plugin should be named %q, not %q", name, p.Name)
 	}
-	if p.Spec.Intro == "" {
+	if p.Spec.ShortDescription == "" {
 		return fmt.Errorf("should have a short description")
 	}
 	if len(p.Spec.Platforms) == 0 {


Test patch:
diff --git a/pkg/index/indexscanner/testdata/testindex/dontscan.yaml b/pkg/index/indexscanner/testdata/testindex/dontscan.yaml
index 20c4eb5..ca49915 100644
--- a/pkg/index/indexscanner/testdata/testindex/dontscan.yaml
+++ b/pkg/index/indexscanner/testdata/testindex/dontscan.yaml
@@ -30,5 +30,5 @@ spec:
     selector:
       matchLabels:
         os: "windows"
-  intro: "exists"
+  shortDescription: "exists"
 
diff --git a/pkg/index/indexscanner/testdata/testindex/plugins/bar.yaml b/pkg/index/indexscanner/testdata/testindex/plugins/bar.yaml
index de42463..83256a3 100644
--- a/pkg/index/indexscanner/testdata/testindex/plugins/bar.yaml
+++ b/pkg/index/indexscanner/testdata/testindex/plugins/bar.yaml
@@ -25,4 +25,4 @@ spec:
     - from: "*"
     uri: https://example.com
     sha256: alsoSet
-  intro: "exists"
+  shortDescription: "exists"
diff --git a/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml b/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml
index a3b2300..a8431f6 100644
--- a/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml
+++ b/pkg/index/indexscanner/testdata/testindex/plugins/foo.yaml
@@ -30,5 +30,5 @@ spec:
     selector:
       matchLabels:
         os: "windows"
-  intro: "exists"
+  shortDescription: "exists"
 
diff --git a/pkg/index/validate_test.go b/pkg/index/validate_test.go
index 7324b4d..570a83f 100644
--- a/pkg/index/validate_test.go
+++ b/pkg/index/validate_test.go
@@ -87,10 +87,10 @@ func TestPlugin_Validate(t *testing.T) {
 			fields: fields{
 				ObjectMeta: metav1.ObjectMeta{Name: "foo"},
 				Spec: PluginSpec{
-					Version:     "",
-					Intro:       "short",
-					Description: "",
-					Caveats:     "",
+					Version:          "",
+					ShortDescription: "short",
+					Description:      "",
+					Caveats:          "",
 					Platforms: []Platform{{
 						Head:     "http://example.com",
 						URI:      "",
@@ -110,10 +110,10 @@ func TestPlugin_Validate(t *testing.T) {
 			fields: fields{
 				ObjectMeta: metav1.ObjectMeta{Name: "foo"},
 				Spec: PluginSpec{
-					Version:     "",
-					Intro:       "",
-					Description: "",
-					Caveats:     "",
+					Version:          "",
+					ShortDescription: "",
+					Description:      "",
+					Caveats:          "",
 					Platforms: []Platform{{
 						Head:     "http://example.com",
 						URI:      "",
@@ -133,10 +133,10 @@ func TestPlugin_Validate(t *testing.T) {
 			fields: fields{
 				ObjectMeta: metav1.ObjectMeta{Name: "foo"},
 				Spec: PluginSpec{
-					Version:     "",
-					Intro:       "short",
-					Description: "",
-					Caveats:     "",
+					Version:          "",
+					ShortDescription: "short",
+					Description:      "",
+					Caveats:          "",
 					Platforms: []Platform{{
 						Head:     "http://example.com",
 						URI:      "",
@@ -156,10 +156,10 @@ func TestPlugin_Validate(t *testing.T) {
 			fields: fields{
 				ObjectMeta: metav1.ObjectMeta{Name: "wrong-name"},
 				Spec: PluginSpec{
-					Version:     "",
-					Intro:       "short",
-					Description: "",
-					Caveats:     "",
+					Version:          "",
+					ShortDescription: "short",
+					Description:      "",
+					Caveats:          "",
 					Platforms: []Platform{{
 						Head:     "http://example.com",
 						URI:      "",
@@ -179,10 +179,10 @@ func TestPlugin_Validate(t *testing.T) {
 			fields: fields{
 				ObjectMeta: metav1.ObjectMeta{Name: "../foo"},
 				Spec: PluginSpec{
-					Version:     "",
-					Intro:       "short",
-					Description: "",
-					Caveats:     "",
+					Version:          "",
+					ShortDescription: "short",
+					Description:      "",
+					Caveats:          "",
 					Platforms: []Platform{{
 						Head:     "http://example.com",
 						URI:      "",