Files
kubevela/references/cli/template.go
Jianbo Sun dd222ac876 refactor cli/dashboard/apiserver to reference folder (#1084)
* refactor cli/dashboard/apiserver to reference folder

* address comments
2021-02-23 13:03:38 +08:00

46 lines
1.3 KiB
Go

package cli
import (
"github.com/spf13/cobra"
"github.com/oam-dev/kubevela/apis/types"
mycue "github.com/oam-dev/kubevela/pkg/cue"
cmdutil "github.com/oam-dev/kubevela/pkg/utils/util"
)
// NewTemplateCommand creates `template` command and its nested children command
func NewTemplateCommand(ioStream cmdutil.IOStreams) *cobra.Command {
cmd := &cobra.Command{
Use: "template",
DisableFlagsInUseLine: true,
Short: "Manage templates",
Long: "Manage templates",
Annotations: map[string]string{
types.TagCommandType: types.TypeCap,
},
}
cmd.SetOut(ioStream.Out)
cmd.AddCommand(NewTemplateContextCommand(ioStream))
return cmd
}
// NewTemplateContextCommand creates `context` command
func NewTemplateContextCommand(ioStream cmdutil.IOStreams) *cobra.Command {
cmd := &cobra.Command{
Use: "context",
DisableFlagsInUseLine: true,
Short: "Show context parameters",
Long: "Show context parameter",
Example: `vela template context`,
Annotations: map[string]string{
types.TagCommandType: types.TypeSystem,
},
RunE: func(cmd *cobra.Command, args []string) error {
ioStream.Info(mycue.BaseTemplate)
return nil
},
}
cmd.SetOut(ioStream.Out)
return cmd
}