Merge branch 'installer'

This commit is contained in:
phernandez
2025-02-12 23:23:30 -06:00
18 changed files with 601 additions and 99 deletions
+3 -1
View File
@@ -1,4 +1,6 @@
from .file_change_scanner import FileChangeScanner
from .sync_service import SyncService
from .watch_service import WatchService
__all__ = ["SyncService", "FileChangeScanner", "WatchService"]
__all__ = ["SyncService", "FileChangeScanner"]
+27 -5
View File
@@ -130,13 +130,36 @@ class WatchService:
return table
async def run(self):
async def run(self, console_status: bool = False): # pragma: no cover
"""Watch for file changes and sync them"""
logger.info("Watching for sync changes")
self.state.running = True
self.state.start_time = datetime.now()
await self.write_status()
with Live(self.generate_table(), refresh_per_second=4, console=self.console) as live:
if console_status:
with Live(self.generate_table(), refresh_per_second=4, console=self.console) as live:
try:
async for changes in awatch(
self.config.home,
watch_filter=self.filter_changes,
debounce=self.config.sync_delay,
recursive=True,
):
# Process changes
await self.handle_changes(self.config.home)
# Update display
live.update(self.generate_table())
except Exception as e:
self.state.record_error(str(e))
await self.write_status()
raise
finally:
self.state.running = False
await self.write_status()
else:
try:
async for changes in awatch(
self.config.home,
@@ -145,11 +168,10 @@ class WatchService:
recursive=True,
):
# Process changes
await self.handle_changes(self.config.home) # pragma: no cover
await self.handle_changes(self.config.home)
# Update display
live.update(self.generate_table()) # pragma: no cover
except Exception as e: # pragma: no cover
except Exception as e:
self.state.record_error(str(e))
await self.write_status()
raise