@@ -160,21 +160,6 @@ def __call__(self) -> None:
160160 self .config = JsonConfig (data = "{}" , path = config_path )
161161 elif "yaml" in config_path :
162162 self .config = YAMLConfig (data = "" , path = config_path )
163- values_to_add : dict [str , Any ] = {}
164- values_to_add ["name" ] = cz_name
165- values_to_add ["tag_format" ] = tag_format
166- values_to_add ["version_scheme" ] = version_scheme
167-
168- if version_provider == "commitizen" :
169- values_to_add ["version" ] = version .public
170- else :
171- values_to_add ["version_provider" ] = version_provider
172-
173- if update_changelog_on_bump :
174- values_to_add ["update_changelog_on_bump" ] = update_changelog_on_bump
175-
176- if major_version_zero :
177- values_to_add ["major_version_zero" ] = major_version_zero
178163
179164 # Collect hook data
180165 hook_types = questionary .checkbox (
@@ -192,7 +177,18 @@ def __call__(self) -> None:
192177
193178 # Create and initialize config
194179 self .config .init_empty_config_content ()
195- self ._update_config_file (values_to_add )
180+
181+ self .config .set_key ("name" , cz_name )
182+ self .config .set_key ("tag_format" , tag_format )
183+ self .config .set_key ("version_scheme" , version_scheme )
184+ if version_provider == "commitizen" :
185+ self .config .set_key ("version" , version .public )
186+ else :
187+ self .config .set_key ("version_provider" , version_provider )
188+ if update_changelog_on_bump :
189+ self .config .set_key ("update_changelog_on_bump" , update_changelog_on_bump )
190+ if major_version_zero :
191+ self .config .set_key ("major_version_zero" , major_version_zero )
196192
197193 out .write ("\n You can bump the version running:\n " )
198194 out .info ("\t cz bump\n " )
@@ -387,7 +383,3 @@ def _install_pre_commit_hook(self, hook_types: list[str] | None = None) -> None:
387383 hook_types = ["commit-msg" , "pre-push" ]
388384 self ._exec_install_pre_commit_hook (hook_types )
389385 out .write ("commitizen pre-commit hook is now installed in your '.git'\n " )
390-
391- def _update_config_file (self , values : dict [str , Any ]) -> None :
392- for key , value in values .items ():
393- self .config .set_key (key , value )
0 commit comments