From 3cba226e2db3e5b3c5e077e60e095a5f3ec95448 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Tue, 24 Oct 2017 10:46:30 -0400 Subject: [PATCH] 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 --- cmd/helm/search.go | 4 ++-- cmd/helm/search_test.go | 8 ++++---- .../testdata/helmhome/repository/cache/testing-index.yaml | 2 ++ 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cmd/helm/search.go b/cmd/helm/search.go index 9f1398de3..fe572f46b 100644 --- a/cmd/helm/search.go +++ b/cmd/helm/search.go @@ -125,9 +125,9 @@ func (s *searchCmd) formatSearchResults(res []*search.Result) string { } table := uitable.New() table.MaxColWidth = 50 - table.AddRow("NAME", "VERSION", "DESCRIPTION") + table.AddRow("NAME", "CHART VERSION", "APP VERSION", "DESCRIPTION") 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() } diff --git a/cmd/helm/search_test.go b/cmd/helm/search_test.go index 26878fd0f..7dc222a8e 100644 --- a/cmd/helm/search_test.go +++ b/cmd/helm/search_test.go @@ -34,18 +34,18 @@ func TestSearchCmd(t *testing.T) { { name: "search for 'maria', expect one match", 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", 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", args: []string{"alpine"}, 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", @@ -56,7 +56,7 @@ func TestSearchCmd(t *testing.T) { name: "search for 'alp[a-z]+', expect two matches", args: []string{"alp[a-z]+"}, 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, }, { diff --git a/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml b/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml index df75878c1..96c98c38c 100644 --- a/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml +++ b/cmd/helm/testdata/helmhome/repository/cache/testing-index.yaml @@ -8,6 +8,7 @@ entries: sources: - https://github.com/kubernetes/helm version: 0.1.0 + appVersion: 1.2.3 description: Deploy a basic Alpine Linux pod keywords: [] maintainers: [] @@ -20,6 +21,7 @@ entries: sources: - https://github.com/kubernetes/helm version: 0.2.0 + appVersion: 2.3.4 description: Deploy a basic Alpine Linux pod keywords: [] maintainers: []