@@ -111,16 +111,6 @@ def is_npm_package(self) -> bool:
111
111
def is_php_composer (self ) -> bool :
112
112
return os .path .isfile ("composer.json" )
113
113
114
- @property
115
- def latest_tag (self ) -> str | None :
116
- return get_latest_tag_name ()
117
-
118
- def tags (self ) -> list | None :
119
- """Not a property, only use if necessary"""
120
- if self .latest_tag is None :
121
- return None
122
- return get_tag_names ()
123
-
124
114
@property
125
115
def is_pre_commit_installed (self ) -> bool :
126
116
return bool (shutil .which ("pre-commit" ))
@@ -231,31 +221,32 @@ def _ask_name(self) -> str:
231
221
return name
232
222
233
223
def _ask_tag (self ) -> str :
234
- latest_tag = self . project_info . latest_tag
224
+ latest_tag = get_latest_tag_name ()
235
225
if not latest_tag :
236
226
out .error ("No Existing Tag. Set tag to v0.0.1" )
237
227
return "0.0.1"
238
228
239
- is_correct_tag = questionary .confirm (
229
+ if questionary .confirm (
240
230
f"Is { latest_tag } the latest tag?" , style = self .cz .style , default = False
231
+ ).unsafe_ask ():
232
+ return latest_tag
233
+
234
+ existing_tags = get_tag_names ()
235
+ if not existing_tags :
236
+ out .error ("No Existing Tag. Set tag to v0.0.1" )
237
+ return "0.0.1"
238
+
239
+ answer : str = questionary .select (
240
+ "Please choose the latest tag: " ,
241
+ # The latest tag is most likely with the largest number.
242
+ # Thus, listing the existing_tags in reverse order makes more sense.
243
+ choices = sorted (existing_tags , reverse = True ),
244
+ style = self .cz .style ,
241
245
).unsafe_ask ()
242
- if not is_correct_tag :
243
- tags = self .project_info .tags ()
244
- if not tags :
245
- out .error ("No Existing Tag. Set tag to v0.0.1" )
246
- return "0.0.1"
247
-
248
- # the latest tag is most likely with the largest number. Thus list the tags in reverse order makes more sense
249
- sorted_tags = sorted (tags , reverse = True )
250
- latest_tag = questionary .select (
251
- "Please choose the latest tag: " ,
252
- choices = sorted_tags ,
253
- style = self .cz .style ,
254
- ).unsafe_ask ()
255
-
256
- if not latest_tag :
257
- raise NoAnswersError ("Tag is required!" )
258
- return latest_tag
246
+
247
+ if not answer :
248
+ raise NoAnswersError ("Tag is required!" )
249
+ return answer
259
250
260
251
def _ask_tag_format (self , latest_tag : str ) -> str :
261
252
if latest_tag .startswith ("v" ):
0 commit comments