@@ -169,25 +169,25 @@ def _ask_config_path(self) -> Path:
169169 return Path (filename )
170170
171171 def _ask_name (self ) -> str :
172- def construct_choice_with_description (cz_name : str ) -> questionary .Choice :
173- cz_class = registry . get ( cz_name )
174- if cz_class :
172+ def construct_choice_with_description () -> list [ questionary .Choice ] :
173+ choices = []
174+ for cz_name , cz_class in registry . items () :
175175 try :
176176 cz_obj = cz_class (self .config )
177177 except MissingCzCustomizeConfigError :
178- return questionary .Choice (title = cz_name , value = cz_name )
178+ choices .append (questionary .Choice (title = cz_name , value = cz_name ))
179+ continue
179180 first_example = cz_obj .schema ().partition ("\n " )[0 ]
180- return questionary .Choice (
181- title = cz_name , value = cz_name , description = first_example
181+ choices .append (
182+ questionary .Choice (
183+ title = cz_name , value = cz_name , description = first_example
184+ )
182185 )
183- return questionary . Choice ( title = cz_name , value = cz_name )
186+ return choices
184187
185188 name : str = questionary .select (
186189 "Please choose a cz (commit rule): (default: cz_conventional_commits)" ,
187- choices = [
188- construct_choice_with_description (cz_name )
189- for cz_name in registry .keys ()
190- ],
190+ choices = construct_choice_with_description (),
191191 default = "cz_conventional_commits" ,
192192 style = self .cz .style ,
193193 ).unsafe_ask ()
0 commit comments