package cmd

import (
	"awesome_cli/internal/service"
	"awesome_cli/internal/views"

	"github.com/spf13/cobra"
)

func init() {
	RootCmd.AddCommand(list())
}

func list() *cobra.Command {
	c := &cobra.Command{
		Use:     "list",
		Aliases: []string{"l"},
		Short:   "Вывод списка",
		Run: func(cmd *cobra.Command, args []string) {
			vms := service.VMService().List()
			views.List(vms)
		},
	}

	return c
}
