Files
kubevela/pkg/commands/template.go
Hongchao Deng b08c6b9441 Appfile: Extensible, User-friendly Application Config Format (#390)
* design doc

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* Support deployment via appfile

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* design update

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* comments

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* update

Signed-off-by: Hongchao Deng <hongchaodeng1@gmail.com>

* refactor

* add multi services example in design doc
2020-10-18 11:22:17 +08:00

44 lines
1.2 KiB
Go

package commands
import (
"github.com/spf13/cobra"
"github.com/oam-dev/kubevela/api/types"
cmdutil "github.com/oam-dev/kubevela/pkg/commands/util"
mycue "github.com/oam-dev/kubevela/pkg/cue"
)
func NewTemplateCommand(c types.Args, 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.TypeSystem,
},
}
cmd.SetOut(ioStream.Out)
cmd.AddCommand(NewTemplateContextCommand(ioStream))
return cmd
}
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
}