Skip to content

Commit

Permalink
Fix output of clusterctl config provider
Browse files Browse the repository at this point in the history
Split the file name from the URL.
Remove the version from the URL since we already have a separate field
for it.
  • Loading branch information
Warren Fernandes committed Apr 21, 2020
1 parent ba3bd5c commit 20f3988
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/clusterctl/cmd/config_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package cmd
import (
"fmt"
"os"
"path/filepath"
"strings"

"github.com/pkg/errors"
"github.com/spf13/cobra"
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 20f3988

Please sign in to comment.