Skip to content

Commit 43eede2

Browse files
author
Warren Fernandes
committed
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.
1 parent ba3bd5c commit 43eede2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Diff for: cmd/clusterctl/cmd/config_provider.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ package cmd
1919
import (
2020
"fmt"
2121
"os"
22+
"path/filepath"
23+
"strings"
2224

2325
"github.com/pkg/errors"
2426
"github.com/spf13/cobra"
@@ -151,10 +153,15 @@ func runGetComponents() error {
151153
func printComponents(c client.Components, output string) error {
152154
switch output {
153155
case ComponentsOutputText:
156+
dir, file := filepath.Split(c.URL())
157+
// Remove the version suffix from the URL since we already display it
158+
// separately.
159+
baseURL, _ := filepath.Split(strings.TrimSuffix(dir, "/"))
154160
fmt.Printf("Name: %s\n", c.Name())
155161
fmt.Printf("Type: %s\n", c.Type())
156-
fmt.Printf("URL: %s\n", c.URL())
162+
fmt.Printf("URL: %s\n", baseURL)
157163
fmt.Printf("Version: %s\n", c.Version())
164+
fmt.Printf("File: %s\n", file)
158165
fmt.Printf("TargetNamespace: %s\n", c.TargetNamespace())
159166
fmt.Printf("WatchingNamespace: %s\n", c.WatchingNamespace())
160167
if len(c.Variables()) > 0 {

0 commit comments

Comments
 (0)