@@ -63,16 +63,6 @@ def is_npm_package(self) -> bool:
63
63
def is_php_composer (self ) -> bool :
64
64
return os .path .isfile ("composer.json" )
65
65
66
- @property
67
- def latest_tag (self ) -> str | None :
68
- return get_latest_tag_name ()
69
-
70
- def tags (self ) -> list | None :
71
- """Not a property, only use if necessary"""
72
- if self .latest_tag is None :
73
- return None
74
- return get_tag_names ()
75
-
76
66
@property
77
67
def is_pre_commit_installed (self ) -> bool :
78
68
return bool (shutil .which ("pre-commit" ))
@@ -181,30 +171,34 @@ def _ask_name(self) -> str:
181
171
return name
182
172
183
173
def _ask_tag (self ) -> str :
184
- latest_tag = self . project_info . latest_tag
174
+ latest_tag = get_latest_tag_name ()
185
175
if not latest_tag :
186
176
out .error ("No Existing Tag. Set tag to v0.0.1" )
187
177
return "0.0.1"
188
178
189
179
is_correct_tag = questionary .confirm (
190
180
f"Is { latest_tag } the latest tag?" , style = self .cz .style , default = False
191
181
).unsafe_ask ()
192
- if not is_correct_tag :
193
- tags = self .project_info .tags ()
194
- if not tags :
195
- out .error ("No Existing Tag. Set tag to v0.0.1" )
196
- return "0.0.1"
197
-
198
- # the latest tag is most likely with the largest number. Thus list the tags in reverse order makes more sense
199
- sorted_tags = sorted (tags , reverse = True )
200
- latest_tag = questionary .select (
182
+ if is_correct_tag :
183
+ return latest_tag
184
+
185
+ tags = get_tag_names ()
186
+ if not tags :
187
+ out .error ("No Existing Tag. Set tag to v0.0.1" )
188
+ return "0.0.1"
189
+
190
+ latest_tag = str (
191
+ questionary .select (
201
192
"Please choose the latest tag: " ,
202
- choices = sorted_tags ,
193
+ # The latest tag is most likely with the largest number.
194
+ # Thus, listing the tags in reverse order makes more sense.
195
+ choices = sorted (tags , reverse = True ),
203
196
style = self .cz .style ,
204
197
).unsafe_ask ()
198
+ )
205
199
206
- if not latest_tag :
207
- raise NoAnswersError ("Tag is required!" )
200
+ if not latest_tag :
201
+ raise NoAnswersError ("Tag is required!" )
208
202
return latest_tag
209
203
210
204
def _ask_tag_format (self , latest_tag : str ) -> str :
0 commit comments