git-project-manager/cmd/config_generate.go

28 lines
618 B
Go
Raw Normal View History

2023-12-10 15:10:46 +00:00
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"gitlab.sweetwater.com/it/devops/tools/gitlab-project-manager/internal/config"
"gopkg.in/yaml.v3"
)
var configGenerateCmd = &cobra.Command{
Use: "generate",
Short: "Generate a default configuration",
Aliases: []string{"gen", "new", "default"},
Long: configGenCmdLong,
Run: runConfigGenerateCmd,
}
func runConfigGenerateCmd(cmd *cobra.Command, args []string) {
plog.Info("Suggest running with > " + defConfigPath)
c, _ := yaml.Marshal(config.DefaultConfig)
fmt.Print(string(c))
}
func init() {
configCmd.AddCommand(configGenerateCmd)
}