From 03cb30d5edb280f78b5ff1441048fcc5bfcdd6c5 Mon Sep 17 00:00:00 2001 From: GaspardCulis Date: Fri, 5 Jan 2024 14:31:49 +0100 Subject: [PATCH] sync: change save and restore function parameters --- sync | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sync b/sync index 36b7a89..0b28ad1 100755 --- a/sync +++ b/sync @@ -45,22 +45,22 @@ synced_files = [ ] -def save(): - for p in synced_files: - folder = "/".join(p[0].split("/")[0:-1]) - if not os.path.exists(folder): - os.mkdir(folder) - os.system(f"rsync -r {p[1]} {p[0]}") +def save(fd: tuple[str, str]): + folder = "/".join(fd[0].split("/")[0:-1]) + if not os.path.exists(folder): + os.mkdir(folder) + os.system(f"rsync -r {fd[1]} {fd[0]}") -def restore(): - for p in synced_files: - os.system(f"rsync -r {p[0]} {p[1]}") +def restore(fd: tuple[str, str]): + os.system(f"rsync -r {fd[0]} {fd[1]}") if __name__ == "__main__": args = parser.parse_args() if args.action == "save": - save() + for p in synced_files: + save(p) elif args.action == "restore": - restore() + for p in synced_files: + restore(p)