sync: Added empty user_action check

This commit is contained in:
GaspardCulis 2024-01-05 17:58:42 +01:00
parent d46aef8fcb
commit f2123bef04

6
sync
View file

@ -135,11 +135,13 @@ def list_files(reverse: bool = False) -> list[int]:
colon = ":" * len_len colon = ":" * len_len
user_action = input( user_action = input(
f"{bcolors.BOLD}{bcolors.BLUE}{colon}{bcolors.ENDC} {bcolors.BOLD}Files to sync (eg: 1 2 3, 1-3):\n{bcolors.BLUE}{colon}{bcolors.ENDC} " f"{bcolors.BOLD}{bcolors.BLUE}{colon}{bcolors.ENDC} {bcolors.BOLD}Files to sync (eg: 1 2 3, 1-3):\n{bcolors.BLUE}{colon}{bcolors.ENDC} "
) ).strip()
# Parse input # Parse input
out = [] out = []
if user_action.count("-") == 0: if user_action == "":
pass
elif user_action.count("-") == 0:
out = list(map(lambda x: int(x), user_action.split())) out = list(map(lambda x: int(x), user_action.split()))
elif user_action.count("-") == 1: elif user_action.count("-") == 1:
out = list(range(*map(lambda x: int(x), user_action.split("-")))) out = list(range(*map(lambda x: int(x), user_action.split("-"))))