Use a generic method instead of creating an additional special case

This commit is contained in:
Hoang Hong Quan
2024-09-30 12:28:47 +07:00
parent e263c1fab9
commit 6c2c1acb06
2 changed files with 2 additions and 9 deletions
+2 -2
View File
@@ -97,8 +97,8 @@ class OCPE:
while True:
self.u.head("Select macOS Version")
print("")
for index, macos_version_name in enumerate(os_data.get_macos_names(supported_macos_version[0], supported_macos_version[-1]), start=int(supported_macos_version[0][:2])):
print("{}. {}".format(index, macos_version_name))
for darwin_version in range(int(supported_macos_version[0][:2]), int(supported_macos_version[-1][:2]) + 1):
print("{}. {}".format(darwin_version, os_data.get_macos_name_by_darwin(str(darwin_version))))
print("")
print("Please enter the macOS version you want to select:")
print("- To select a major version, enter the number (e.g., 19).")
-7
View File
@@ -22,13 +22,6 @@ def get_latest_darwin_version():
def get_lowest_darwin_version():
return "{}.{}.{}".format(macos_versions[0].darwin_version, 0, 0)
def get_macos_names(min_darwin, max_darwin):
return [
"macOS {} {}{}".format(data.name, data.macos_version, "" if data.release_status == "final" else " (Beta)")
for data in macos_versions
if int(min_darwin[:2]) <= data.darwin_version <= int(max_darwin[:2])
]
def get_macos_name_by_darwin(darwin_version):
for data in macos_versions:
if data.darwin_version == int(darwin_version[:2]):