mirror of
https://github.com/Garmelon/PFERD.git
synced 2023-12-21 10:23:01 +01:00
Add deleted files to summary
This commit is contained in:
parent
f6fbd5e4bb
commit
6c034209b6
@ -111,6 +111,15 @@ class PrettyLogger:
|
||||
f"[bold green]Created {self._format_path(path)}.[/bold green]"
|
||||
)
|
||||
|
||||
def deleted_file(self, path: PathLike) -> None:
|
||||
"""
|
||||
A file has been deleted.
|
||||
"""
|
||||
|
||||
self.logger.info(
|
||||
f"[bold red]Deleted {self._format_path(path)}.[/bold red]"
|
||||
)
|
||||
|
||||
def ignored_file(self, path: PathLike, reason: str) -> None:
|
||||
"""
|
||||
File was not downloaded or modified.
|
||||
|
@ -26,6 +26,7 @@ class Organizer(Location):
|
||||
|
||||
new_files = []
|
||||
modified_files = []
|
||||
deleted_files = []
|
||||
|
||||
def __init__(self, path: Path):
|
||||
"""Create a new organizer for a given path."""
|
||||
@ -122,9 +123,9 @@ class Organizer(Location):
|
||||
if start_dir.resolve() not in self._known_files and dir_empty:
|
||||
start_dir.rmdir()
|
||||
|
||||
@staticmethod
|
||||
def _delete_file_if_confirmed(path: Path) -> None:
|
||||
def _delete_file_if_confirmed(self, path: Path) -> None:
|
||||
prompt = f"Do you want to delete {path}"
|
||||
|
||||
if prompt_yes_no(prompt, False):
|
||||
self.deleted_files.append(path)
|
||||
path.unlink()
|
||||
|
@ -36,6 +36,7 @@ class Pferd(Location):
|
||||
|
||||
new_files = []
|
||||
modified_files = []
|
||||
deleted_files = []
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
@ -157,13 +158,14 @@ class Pferd(Location):
|
||||
|
||||
self.new_files += organizer.new_files
|
||||
self.modified_files += organizer.modified_files
|
||||
self.deleted_files += organizer.deleted_files
|
||||
|
||||
return organizer
|
||||
|
||||
def print_summary(self):
|
||||
LOGGER.info("")
|
||||
LOGGER.info("Summary: ")
|
||||
if len(self.new_files) == 0 and len(self.modified_files) == 0:
|
||||
if len(self.new_files) == 0 and len(self.modified_files) == 0 and len(self.deleted_files) == 0:
|
||||
LOGGER.info("Nothing changed")
|
||||
|
||||
if len(self.new_files) > 0:
|
||||
@ -180,6 +182,13 @@ class Pferd(Location):
|
||||
|
||||
LOGGER.info("")
|
||||
|
||||
if len(self.deleted_files) > 0:
|
||||
LOGGER.info("Deleted Files:")
|
||||
for file in self.deleted_files:
|
||||
PRETTY.deleted_file(file)
|
||||
|
||||
LOGGER.info("")
|
||||
|
||||
@swallow_and_print_errors
|
||||
def ilias_kit_personal_desktop(
|
||||
self,
|
||||
|
Loading…
Reference in New Issue
Block a user