28 lines
618 B
Go
28 lines
618 B
Go
|
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)
|
||
|
}
|