Skip to content

Commit

Permalink
Remove cobra vars
Browse files Browse the repository at this point in the history
  • Loading branch information
cmmarslender committed Oct 16, 2024
1 parent 7a21672 commit 4456448
Showing 1 changed file with 9 additions and 21 deletions.
30 changes: 9 additions & 21 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,28 +25,16 @@ func Execute() {
}

func init() {
var (
cfgFile string
templateDir string
githubOrg string
committerName string
committerEmail string
reviewTeamName string
githubToken string
signCommits bool
push bool
)

cobra.OnInitialize(initConfig)
rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "config.yaml", "template config file (default is config.yaml)")
rootCmd.PersistentFlags().StringVar(&templateDir, "templates", "templates", "Path to templates defined in the config. Defaults to ./templates")
rootCmd.PersistentFlags().StringVar(&githubOrg, "github-org", "Chia-Network", "The org to process")
rootCmd.PersistentFlags().StringVar(&committerName, "committer-name", "Chia Automation", "The git user to use when making commits")
rootCmd.PersistentFlags().StringVar(&committerEmail, "committer-email", "[email protected]", "The git email to use when making commits")
rootCmd.PersistentFlags().StringVar(&reviewTeamName, "review-team", "content-updater-reviewers", "The default team to assigned to the PRs if a repo override is not set")
rootCmd.PersistentFlags().StringVar(&githubToken, "github-token", "", "The token to use to auth to GitHub API and Push to Repos")
rootCmd.PersistentFlags().BoolVar(&signCommits, "sign-commits", true, "Whether or not to sign commits")
rootCmd.PersistentFlags().BoolVar(&push, "push", true, "Whether or not to push and create the pull request")
rootCmd.PersistentFlags().String("config", "config.yaml", "template config file (default is config.yaml)")
rootCmd.PersistentFlags().String("templates", "templates", "Path to templates defined in the config. Defaults to ./templates")
rootCmd.PersistentFlags().String("github-org", "Chia-Network", "The org to process")
rootCmd.PersistentFlags().String("committer-name", "Chia Automation", "The git user to use when making commits")
rootCmd.PersistentFlags().String("committer-email", "[email protected]", "The git email to use when making commits")
rootCmd.PersistentFlags().String("review-team", "content-updater-reviewers", "The default team to assigned to the PRs if a repo override is not set")
rootCmd.PersistentFlags().String("github-token", "", "The token to use to auth to GitHub API and Push to Repos")
rootCmd.PersistentFlags().Bool("sign-commits", true, "Whether or not to sign commits")
rootCmd.PersistentFlags().Bool("push", true, "Whether or not to push and create the pull request")

cobra.CheckErr(viper.BindPFlag("config", rootCmd.PersistentFlags().Lookup("config")))
cobra.CheckErr(viper.BindPFlag("templates", rootCmd.PersistentFlags().Lookup("templates")))
Expand Down

0 comments on commit 4456448

Please sign in to comment.