From ad10c7b5d2417ac26b169d5ba13a2865ce4546fa Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 3 Nov 2025 01:50:45 +0100 Subject: [PATCH] Improve Files log messages --- pasch/modules/files.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/pasch/modules/files.py b/pasch/modules/files.py index 6e7b224..7480d5a 100644 --- a/pasch/modules/files.py +++ b/pasch/modules/files.py @@ -121,10 +121,13 @@ class Files(Module): return relative_path = path.relative_to(self._root, walk_up=True) - self.c.print(f"[bold green]+[/] {escape(str(relative_path))}", highlight=False) + if cur_hash is None: + self.c.print(f"[bold green]+[/] {escape(str(relative_path))}") + else: + self.c.print(f"[bold yellow]~[/] {escape(str(relative_path))}") if reason := self._file_db.verify_hash(path, cur_hash): - self.c.print(f"[red]Error:[/] {escape(reason)}", highlight=False) + self.c.print(f"[red]Error:[/] {escape(reason)}") # We want to avoid scenarios where we fail to remember a file we've # written. It is better to remember a file with an incorrect hash than @@ -135,11 +138,11 @@ class Files(Module): def _remove_file(self, path: Path) -> None: relative_path = path.relative_to(self._root, walk_up=True) - self.c.print(f"[bold red]-[/] {escape(str(relative_path))}", highlight=False) + self.c.print(f"[bold red]-[/] {escape(str(relative_path))}") cur_hash = hash_file(path) if reason := self._file_db.verify_hash(path, cur_hash): - self.c.print(f"[red]Error:[/] {escape(reason)}", highlight=False) + self.c.print(f"[red]Error:[/] {escape(reason)}") try: path.unlink()