fix options for machine list command

This commit is contained in:
Pavel Sviderski
2024-10-31 18:32:11 +10:00
parent 9dbcf1e902
commit e6df331fb8
+3 -3
View File
@@ -6,18 +6,18 @@ import (
) )
func NewListCommand() *cobra.Command { func NewListCommand() *cobra.Command {
opts := addOptions{} var cluster string
cmd := &cobra.Command{ cmd := &cobra.Command{
Use: "list", Use: "list",
Aliases: []string{"ls"}, Aliases: []string{"ls"},
Short: "List machines in a cluster", Short: "List machines in a cluster",
RunE: func(cmd *cobra.Command, args []string) error { RunE: func(cmd *cobra.Command, args []string) error {
uncli := cmd.Context().Value("cli").(*cli.CLI) uncli := cmd.Context().Value("cli").(*cli.CLI)
return uncli.ListMachines(cmd.Context(), opts.cluster) return uncli.ListMachines(cmd.Context(), cluster)
}, },
} }
cmd.Flags().StringVarP( cmd.Flags().StringVarP(
&opts.cluster, "cluster", "c", "", &cluster, "cluster", "c", "",
"Name of the cluster (default is the current cluster)", "Name of the cluster (default is the current cluster)",
) )
return cmd return cmd