Refactor the code to use more modular and testable approach.

This commit is contained in:
2025-02-25 19:11:19 +00:00
parent 5964da3cef
commit 942e648d56
18 changed files with 1719 additions and 595 deletions
+4 -3
View File
@@ -32,11 +32,14 @@ Visit https://github.com/lukaszraczylo/semver-generator for more information, do
},
}
// Execute executes the root command
func Execute() {
cobra.CheckErr(rootCmd.Execute())
}
// setupCobra sets up the cobra command flags
func (r *Setup) setupCobra() {
var err error
r.RepositoryName, err = rootCmd.Flags().GetString("repository")
if err != nil {
panic(err)
@@ -50,11 +53,9 @@ func (r *Setup) setupCobra() {
panic(err)
}
r.UseLocal = params.varUseLocal
if err != nil {
panic(err)
}
}
// myParams holds the command line parameters
type myParams struct {
varRepoName string
varRepoBranch string