feat(search): Expose AppVersion in search results

Some would like to expose and see the application version in the
search results. This change displays it.

Closes #3010
pull/3059/head
Matt Farina 7 years ago
parent 4b6ecb459b
commit 3cba226e2d
No known key found for this signature in database
GPG Key ID: CDBDE65D3E544BF3

@ -125,9 +125,9 @@ func (s *searchCmd) formatSearchResults(res []*search.Result) string {
} }
table := uitable.New() table := uitable.New()
table.MaxColWidth = 50 table.MaxColWidth = 50
table.AddRow("NAME", "VERSION", "DESCRIPTION") table.AddRow("NAME", "CHART VERSION", "APP VERSION", "DESCRIPTION")
for _, r := range res { for _, r := range res {
table.AddRow(r.Name, r.Chart.Version, r.Chart.Description) table.AddRow(r.Name, r.Chart.Version, r.Chart.AppVersion, r.Chart.Description)
} }
return table.String() return table.String()
} }

@ -34,18 +34,18 @@ func TestSearchCmd(t *testing.T) {
{ {
name: "search for 'maria', expect one match", name: "search for 'maria', expect one match",
args: []string{"maria"}, args: []string{"maria"},
expect: "NAME \tVERSION\tDESCRIPTION \ntesting/mariadb\t0.3.0 \tChart for MariaDB", expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/mariadb\t0.3.0 \t \tChart for MariaDB",
}, },
{ {
name: "search for 'alpine', expect two matches", name: "search for 'alpine', expect two matches",
args: []string{"alpine"}, args: []string{"alpine"},
expect: "NAME \tVERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \tDeploy a basic Alpine Linux pod", expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod",
}, },
{ {
name: "search for 'alpine' with versions, expect three matches", name: "search for 'alpine' with versions, expect three matches",
args: []string{"alpine"}, args: []string{"alpine"},
flags: []string{"--versions"}, flags: []string{"--versions"},
expect: "NAME \tVERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \tDeploy a basic Alpine Linux pod", expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod\ntesting/alpine\t0.1.0 \t1.2.3 \tDeploy a basic Alpine Linux pod",
}, },
{ {
name: "search for 'syzygy', expect no matches", name: "search for 'syzygy', expect no matches",
@ -56,7 +56,7 @@ func TestSearchCmd(t *testing.T) {
name: "search for 'alp[a-z]+', expect two matches", name: "search for 'alp[a-z]+', expect two matches",
args: []string{"alp[a-z]+"}, args: []string{"alp[a-z]+"},
flags: []string{"--regexp"}, flags: []string{"--regexp"},
expect: "NAME \tVERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \tDeploy a basic Alpine Linux pod", expect: "NAME \tCHART VERSION\tAPP VERSION\tDESCRIPTION \ntesting/alpine\t0.2.0 \t2.3.4 \tDeploy a basic Alpine Linux pod",
regexp: true, regexp: true,
}, },
{ {

@ -8,6 +8,7 @@ entries:
sources: sources:
- https://github.com/kubernetes/helm - https://github.com/kubernetes/helm
version: 0.1.0 version: 0.1.0
appVersion: 1.2.3
description: Deploy a basic Alpine Linux pod description: Deploy a basic Alpine Linux pod
keywords: [] keywords: []
maintainers: [] maintainers: []
@ -20,6 +21,7 @@ entries:
sources: sources:
- https://github.com/kubernetes/helm - https://github.com/kubernetes/helm
version: 0.2.0 version: 0.2.0
appVersion: 2.3.4
description: Deploy a basic Alpine Linux pod description: Deploy a basic Alpine Linux pod
keywords: [] keywords: []
maintainers: [] maintainers: []

Loading…
Cancel
Save