first commit

This commit is contained in:
i.smyshlyaev
2025-10-16 12:46:23 +03:00
commit 9c813d4754
37 changed files with 1671 additions and 0 deletions

29
cli/cmd/cli.go Normal file
View File

@@ -0,0 +1,29 @@
package cmd
import (
"os"
"github.com/spf13/cobra"
)
var (
RootCmd = &cobra.Command{
Use: "acli",
Short: "Интерфейс командной строки",
CompletionOptions: cobra.CompletionOptions{
HiddenDefaultCmd: true,
},
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
cmd.Help()
os.Exit(0)
}
},
}
)
func Execute() {
if err := RootCmd.Execute(); err != nil {
panic(err)
}
}

26
cli/cmd/list.go Normal file
View File

@@ -0,0 +1,26 @@
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
}