sync: Added BOT_MISSING SyncStatus
This commit is contained in:
parent
7d394abcd3
commit
d46aef8fcb
1 changed files with 6 additions and 1 deletions
7
sync
7
sync
|
@ -11,6 +11,7 @@ class SyncStatus:
|
|||
DIFF = 2
|
||||
SRC_MISSING = 3
|
||||
DEST_MISSING = 4
|
||||
BOTH_MISSING = 5
|
||||
|
||||
|
||||
# https://stackoverflow.com/a/287944
|
||||
|
@ -93,7 +94,9 @@ def get_sync_status(fd: tuple[str, str]) -> SyncStatus:
|
|||
return True
|
||||
return any([has_differences(subdcmp) for subdcmp in dcmp.subdirs.values()])
|
||||
|
||||
if not os.path.exists(f1):
|
||||
if not (os.path.exists(f1) or os.path.exists(f2)):
|
||||
return SyncStatus.BOTH_MISSING
|
||||
elif not os.path.exists(f1):
|
||||
return SyncStatus.SRC_MISSING
|
||||
elif not os.path.exists(f2):
|
||||
return SyncStatus.DEST_MISSING
|
||||
|
@ -122,6 +125,8 @@ def list_files(reverse: bool = False) -> list[int]:
|
|||
elif status == SyncStatus.DEST_MISSING:
|
||||
f1_c = bcolors.RED if reverse else f1_c
|
||||
f2_c = bcolors.RED if not reverse else f2_c
|
||||
elif status == SyncStatus.BOTH_MISSING:
|
||||
f1_c, f2_c = bcolors.RED, bcolors.RED
|
||||
|
||||
print(
|
||||
f"{bcolors.PURPLE}{i} {f1_c}{f[int(reverse)]} {bcolors.ENDC}-> {f2_c}{f[int(not reverse)]}{bcolors.ENDC}"
|
||||
|
|
Loading…
Reference in a new issue