Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/devstream/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ Examples:
Run: showStatusCMDFunc,
}

func showConfigCMDFunc(cmd *cobra.Command, args []string) {
func showConfigCMDFunc(_ *cobra.Command, _ []string) {
log.Debug("Show configuration information.")
if err := config.Show(); err != nil {
log.Fatal(err)
}
}

func showStatusCMDFunc(cmd *cobra.Command, args []string) {
func showStatusCMDFunc(_ *cobra.Command, _ []string) {
log.Debug("Show status information.")
if err := status.Show(configFile); err != nil {
log.Fatal(err)
Expand All @@ -61,7 +61,7 @@ func init() {
showCMD.AddCommand(showStatusCMD)

showConfigCMD.Flags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
showConfigCMD.Flags().StringVarP(&template, "template", "t", "quickstart", "print a template config, e.g. quickstart/gitops/...")
showConfigCMD.Flags().StringVarP(&template, "template", "t", "", "print a template config, e.g. quickstart/gitops/...")
completion.FlagPluginsCompletion(showConfigCMD, "plugin")

showStatusCMD.Flags().StringVarP(&plugin, "plugin", "p", "", "specify name with the plugin")
Expand Down
18 changes: 12 additions & 6 deletions internal/pkg/show/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,21 @@ import (
"github.com/spf13/viper"
)

var templates = map[string]string{
"quickstart": QuickStart,
"gitops": GitOps,
}

//go:generate go run gen_embed_var.go
func Show() error {
// at first, check is template arg is set
template := viper.GetString("template")
if template == "quickstart" {
fmt.Println(QuickStart)
return nil
} else if template == "gitops" {
fmt.Println(GitOps)
return nil
if template != "" {
if tmpl, ok := templates[template]; ok {
fmt.Println(tmpl)
return nil
}
return fmt.Errorf("illegal template name : < %s >", template)
}

plugin := viper.GetString("plugin")
Expand Down