Skip to content

Commit

Permalink
fix multiselect
Browse files Browse the repository at this point in the history
  • Loading branch information
pepeloni-away committed Nov 7, 2023
1 parent 536b354 commit 0371c80
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions revanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,9 @@ def select_item(message: str, item_list: list):
except ValueError:
print("Please enter a valid number.")

def select_multiple_items(message: str, item_list: list):
for index, item in enumerate(item_list, start=1):
def select_multiple_items(message: str, item_list: list, map_function=None):
printable_item_list = list(map(map_function, item_list)) if map_function else None
for index, item in enumerate(printable_item_list or item_list, start=1):
print(f"{index:{len(str(len(item_list)))}}. {item}")

selected_items = []
Expand Down Expand Up @@ -427,9 +428,8 @@ def main():
if not args.local:
get_apk(args.app, recomended_version)

all_options = list(map(lambda x: f'{x["name"]} - {x["description"]}' if x["use"] else f'(-) {x["name"]} - {x["description"]}', app_patches))

selected_options = select_multiple_items("Select patches (e.g. 4,7-12,1) or empty for default: ", all_options)
filter_function = lambda x: f'{x["name"]} - {x["description"]}' if x["use"] else f'(-) {x["name"]} - {x["description"]}'
selected_options = select_multiple_items("Select patches (e.g. 4,7-12,1) or empty for default: ", app_patches, filter_function)

keystore_file = "../revanced.keystore" if os.path.exists(os.path.join(os.path.dirname(os.getcwd()), "revanced.keystore")) else "revanced.keystore"
output_file = f'../_builds/revanced({args.repository})[{args.app.replace(".", "_")}].apk'
Expand Down

0 comments on commit 0371c80

Please sign in to comment.