Skip to content

Commit

Permalink
Move list to get clusters command, matching Kind
Browse files Browse the repository at this point in the history
Signed-off-by: Greg Haynes <[email protected]>
  • Loading branch information
greghaynes committed May 21, 2024
1 parent d19749c commit 0c50a02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
14 changes: 8 additions & 6 deletions pkg/cmd/list/root.go → pkg/cmd/get/clusters/clusters.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package list
package clusters

import (
"flag"
Expand All @@ -11,9 +11,9 @@ import (
"sigs.k8s.io/kind/pkg/cluster"
)

var ListCmd = &cobra.Command{
Use: "list",
Short: "List idp clusters",
var ClustersCmd = &cobra.Command{
Use: "clusters",
Short: "Get idp clusters",
Long: ``,
RunE: list,
}
Expand All @@ -24,7 +24,7 @@ func init() {
Development: true,
}
opts.BindFlags(zapfs)
ListCmd.Flags().AddGoFlagSet(zapfs)
ClustersCmd.Flags().AddGoFlagSet(zapfs)

ctrl.SetLogger(zap.New(zap.UseFlagOptions(&opts)))
}
Expand All @@ -36,6 +36,8 @@ func list(cmd *cobra.Command, args []string) error {
return errors.Wrapf(err, "failed to list clusters")
}

fmt.Printf("Clusters: %v\n", clusters)
for _, cluster := range clusters {
fmt.Println(cluster)
}
return nil
}
2 changes: 2 additions & 0 deletions pkg/cmd/get/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package get
import (
"fmt"

"github.com/cnoe-io/idpbuilder/pkg/cmd/get/clusters"
"github.com/spf13/cobra"
)

Expand All @@ -19,6 +20,7 @@ var (
)

func init() {
GetCmd.AddCommand(clusters.ClustersCmd)
GetCmd.AddCommand(SecretsCmd)
GetCmd.PersistentFlags().StringSliceVarP(&packages, "packages", "p", []string{}, "names of packages.")
GetCmd.PersistentFlags().StringVarP(&outputFormat, "output", "o", "", "Output format. json or yaml.")
Expand Down
2 changes: 0 additions & 2 deletions pkg/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"github.com/cnoe-io/idpbuilder/pkg/cmd/delete"
"github.com/cnoe-io/idpbuilder/pkg/cmd/get"
"github.com/cnoe-io/idpbuilder/pkg/cmd/helpers"
"github.com/cnoe-io/idpbuilder/pkg/cmd/list"
"github.com/cnoe-io/idpbuilder/pkg/cmd/version"
"github.com/spf13/cobra"
)
Expand All @@ -24,7 +23,6 @@ func init() {
rootCmd.AddCommand(create.CreateCmd)
rootCmd.AddCommand(get.GetCmd)
rootCmd.AddCommand(delete.DeleteCmd)
rootCmd.AddCommand(list.ListCmd)
rootCmd.AddCommand(version.VersionCmd)
}

Expand Down

0 comments on commit 0c50a02

Please sign in to comment.