Added user-facing messages when deleting via sync

This commit is contained in:
2022-02-16 16:10:37 -05:00
parent bde243c644
commit ef828b88a0
+3
View File
@@ -225,11 +225,13 @@ def sync(): # calls sshync to sync changes to the user's server
for _file in _deletion_database:
if _file[:-1].endswith('/'):
try:
print(f"Removing folder {path.expanduser('~/.password-pasture/')}{_file[:-1]}...\n")
rmtree(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}")
except FileNotFoundError:
print('Folder does not exist locally.\n')
else:
try:
print(f"Removing entry {path.expanduser('~/.password-pasture/')}{_file[:-1]}...\n")
remove(f"{path.expanduser('~/.password-pasture/')}{_file[:-1]}.gpg")
except (FileNotFoundError, IsADirectoryError):
print('File does not exist locally.\n')
@@ -248,6 +250,7 @@ def sync(): # calls sshync to sync changes to the user's server
if Path(f"{path.expanduser('~')}{_folder[:-1]}").is_dir():
pass
else:
print(f"Adding folder {path.expanduser('~')}{_folder[:-1]}...\n")
Path(f"{path.expanduser('~')}{_folder[:-1]}").mkdir(0o700, parents=True, exist_ok=True)
# set permissions before uploading
system('find ' + directory + ' -type d -exec chmod -R 700 {} +')