From 20f39880b1c1126e8a99135829e4a533938f0952 Mon Sep 17 00:00:00 2001 From: Warren Fernandes Date: Tue, 21 Apr 2020 16:45:50 -0600 Subject: [PATCH] Fix output of clusterctl config provider Split the file name from the URL. Remove the version from the URL since we already have a separate field for it. --- cmd/clusterctl/cmd/config_provider.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/clusterctl/cmd/config_provider.go b/cmd/clusterctl/cmd/config_provider.go index ec12312c5eac..03c17689e167 100644 --- a/cmd/clusterctl/cmd/config_provider.go +++ b/cmd/clusterctl/cmd/config_provider.go @@ -19,6 +19,8 @@ package cmd import ( "fmt" "os" + "path/filepath" + "strings" "github.com/pkg/errors" "github.com/spf13/cobra" @@ -151,10 +153,15 @@ func runGetComponents() error { func printComponents(c client.Components, output string) error { switch output { case ComponentsOutputText: + dir, file := filepath.Split(c.URL()) + // Remove the version suffix from the URL since we already display it + // separately. + baseURL, _ := filepath.Split(strings.Trim(dir, "/")) fmt.Printf("Name: %s\n", c.Name()) fmt.Printf("Type: %s\n", c.Type()) - fmt.Printf("URL: %s\n", c.URL()) + fmt.Printf("URL: %s\n", baseURL) fmt.Printf("Version: %s\n", c.Version()) + fmt.Printf("File: %s\n", file) fmt.Printf("TargetNamespace: %s\n", c.TargetNamespace()) fmt.Printf("WatchingNamespace: %s\n", c.WatchingNamespace()) if len(c.Variables()) > 0 {