@@ -10,34 +10,35 @@ import (
1010
1111// Config is a complete set of app configuration
1212type Config struct {
13- Token string
14- ProviderPlugin string
15- ProviderOpts map [string ]string
16- CommitAnalyzerPlugin string
17- CommitAnalyzerOpts map [string ]string
18- CIConditionPlugin string
19- CIConditionOpts map [string ]string
20- ChangelogGeneratorPlugin string
21- ChangelogGeneratorOpts map [string ]string
22- Changelog string
23- FilesUpdaterPlugins []string
24- FilesUpdaterOpts map [string ]string
25- HooksPlugins []string
26- HooksOpts map [string ]string
27- UpdateFiles []string
28- Match string
29- VersionFile bool
30- Prerelease bool
31- Ghr bool
32- NoCI bool
33- Dry bool
34- AllowInitialDevelopmentVersions bool
35- AllowNoChanges bool
36- ForceBumpPatchVersion bool
37- MaintainedVersion string
38- PrependChangelog bool
39- DownloadPlugins bool
40- ShowProgress bool
13+ Token string
14+ ProviderPlugin string
15+ ProviderOpts map [string ]string
16+ CommitAnalyzerPlugin string
17+ CommitAnalyzerOpts map [string ]string
18+ CIConditionPlugin string
19+ CIConditionOpts map [string ]string
20+ ChangelogGeneratorPlugin string
21+ ChangelogGeneratorOpts map [string ]string
22+ Changelog string
23+ FilesUpdaterPlugins []string
24+ FilesUpdaterOpts map [string ]string
25+ HooksPlugins []string
26+ HooksOpts map [string ]string
27+ UpdateFiles []string
28+ Match string
29+ VersionFile bool
30+ Prerelease bool
31+ Ghr bool
32+ NoCI bool
33+ Dry bool
34+ AllowInitialDevelopmentVersions bool
35+ AllowNoChanges bool
36+ ForceBumpPatchVersion bool
37+ MaintainedVersion string
38+ PrependChangelog bool
39+ DownloadPlugins bool
40+ ShowProgress bool
41+ AllowMaintainedVersionOnDefaultBranch bool
4142}
4243
4344func mustGetString (cmd * cobra.Command , name string ) string {
@@ -100,34 +101,35 @@ func NewConfig(cmd *cobra.Command) (*Config, error) {
100101 mustGetStringArray (cmd , "hooks-opt" ))
101102
102103 conf := & Config {
103- Token : mustGetString (cmd , "token" ),
104- ProviderPlugin : viper .GetString ("plugins.provider.name" ),
105- ProviderOpts : provOpts ,
106- CommitAnalyzerPlugin : viper .GetString ("plugins.commit-analyzer.name" ),
107- CommitAnalyzerOpts : caOpts ,
108- CIConditionPlugin : viper .GetString ("plugins.ci-condition.name" ),
109- CIConditionOpts : ciOpts ,
110- ChangelogGeneratorPlugin : viper .GetString ("plugins.changelog-generator.name" ),
111- ChangelogGeneratorOpts : cgOpts ,
112- Changelog : mustGetString (cmd , "changelog" ),
113- FilesUpdaterPlugins : viper .GetStringSlice ("plugins.files-updater.names" ),
114- FilesUpdaterOpts : fuOpts ,
115- HooksPlugins : viper .GetStringSlice ("plugins.hooks.names" ),
116- HooksOpts : hoOpts ,
117- UpdateFiles : mustGetStringArray (cmd , "update" ),
118- Match : mustGetString (cmd , "match" ),
119- VersionFile : mustGetBool (cmd , "version-file" ),
120- Prerelease : mustGetBool (cmd , "prerelease" ),
121- Ghr : mustGetBool (cmd , "ghr" ),
122- NoCI : mustGetBool (cmd , "no-ci" ),
123- Dry : mustGetBool (cmd , "dry" ),
124- AllowInitialDevelopmentVersions : mustGetBool (cmd , "allow-initial-development-versions" ),
125- AllowNoChanges : mustGetBool (cmd , "allow-no-changes" ),
126- ForceBumpPatchVersion : mustGetBool (cmd , "force-bump-patch-version" ),
127- MaintainedVersion : viper .GetString ("maintainedVersion" ),
128- PrependChangelog : mustGetBool (cmd , "prepend-changelog" ),
129- DownloadPlugins : mustGetBool (cmd , "download-plugins" ),
130- ShowProgress : mustGetBool (cmd , "show-progress" ),
104+ Token : mustGetString (cmd , "token" ),
105+ ProviderPlugin : viper .GetString ("plugins.provider.name" ),
106+ ProviderOpts : provOpts ,
107+ CommitAnalyzerPlugin : viper .GetString ("plugins.commit-analyzer.name" ),
108+ CommitAnalyzerOpts : caOpts ,
109+ CIConditionPlugin : viper .GetString ("plugins.ci-condition.name" ),
110+ CIConditionOpts : ciOpts ,
111+ ChangelogGeneratorPlugin : viper .GetString ("plugins.changelog-generator.name" ),
112+ ChangelogGeneratorOpts : cgOpts ,
113+ Changelog : mustGetString (cmd , "changelog" ),
114+ FilesUpdaterPlugins : viper .GetStringSlice ("plugins.files-updater.names" ),
115+ FilesUpdaterOpts : fuOpts ,
116+ HooksPlugins : viper .GetStringSlice ("plugins.hooks.names" ),
117+ HooksOpts : hoOpts ,
118+ UpdateFiles : mustGetStringArray (cmd , "update" ),
119+ Match : mustGetString (cmd , "match" ),
120+ VersionFile : mustGetBool (cmd , "version-file" ),
121+ Prerelease : mustGetBool (cmd , "prerelease" ),
122+ Ghr : mustGetBool (cmd , "ghr" ),
123+ NoCI : mustGetBool (cmd , "no-ci" ),
124+ Dry : mustGetBool (cmd , "dry" ),
125+ AllowInitialDevelopmentVersions : mustGetBool (cmd , "allow-initial-development-versions" ),
126+ AllowNoChanges : mustGetBool (cmd , "allow-no-changes" ),
127+ ForceBumpPatchVersion : mustGetBool (cmd , "force-bump-patch-version" ),
128+ MaintainedVersion : viper .GetString ("maintainedVersion" ),
129+ PrependChangelog : mustGetBool (cmd , "prepend-changelog" ),
130+ DownloadPlugins : mustGetBool (cmd , "download-plugins" ),
131+ ShowProgress : mustGetBool (cmd , "show-progress" ),
132+ AllowMaintainedVersionOnDefaultBranch : mustGetBool (cmd , "allow-maintained-version-on-default-branch" ),
131133 }
132134 return conf , nil
133135}
@@ -184,6 +186,7 @@ func SetFlags(cmd *cobra.Command) {
184186 cmd .Flags ().Bool ("download-plugins" , false , "downloads all required plugins if needed" )
185187 cmd .Flags ().Bool ("show-progress" , false , "shows the plugin download progress" )
186188 cmd .Flags ().String ("config" , "" , "config file (default is .semrelrc)" )
189+ cmd .Flags ().Bool ("allow-maintained-version-on-default-branch" , false , "allow configuring the maintained version on the default branch" )
187190 cmd .Flags ().SortFlags = true
188191
189192 must (viper .BindPFlag ("maintainedVersion" , cmd .Flags ().Lookup ("maintained-version" )))
0 commit comments