From f62519e9cd151c4aecb8940e64c00067ce3652fa Mon Sep 17 00:00:00 2001 From: kjuulh Date: Mon, 31 Oct 2022 22:03:50 +0100 Subject: [PATCH] with ls --- pkg/cli/templatecmd/ls.go | 23 +++++++++++++++++++++++ pkg/cli/templatecmd/template.go | 5 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 pkg/cli/templatecmd/ls.go diff --git a/pkg/cli/templatecmd/ls.go b/pkg/cli/templatecmd/ls.go new file mode 100644 index 0000000..616649d --- /dev/null +++ b/pkg/cli/templatecmd/ls.go @@ -0,0 +1,23 @@ +package templatecmd + +import ( + "fmt" + + "github.com/spf13/cobra" +) + +var templates = []string{"docker", "gobin_default"} + +func NewLsCmd() *cobra.Command { + return &cobra.Command{ + Use: "ls", + RunE: func(cmd *cobra.Command, args []string) error { + + for _, t := range templates { + fmt.Printf("%s\n", t) + } + + return nil + }, + } +} diff --git a/pkg/cli/templatecmd/template.go b/pkg/cli/templatecmd/template.go index dc6e0dc..8b06ca4 100644 --- a/pkg/cli/templatecmd/template.go +++ b/pkg/cli/templatecmd/template.go @@ -7,7 +7,10 @@ func NewTemplateCmd() *cobra.Command { Use: "template", } - cmd.AddCommand(NewInitCmd()) + cmd.AddCommand( + NewInitCmd(), + NewLsCmd(), + ) return cmd }