feat(cli): watch files with event streams
Build and Push Docker Container / build-and-push (push) Successful in 2m3s
Build and Push Docker Container / build-and-push (push) Successful in 2m3s
- Add a private SSE endpoint that emits file change events for authenticated clients. - Replace the watch sleep loop with watchdog local file events and remote SSE triggers. - Debounce local event bursts and keep watch running after transient sync failures. - Add watchdog as a standalone CLI dependency and cover watch behavior in tests. - Bump NanoShare to 1.25.0 and the standalone CLI to 0.4.0.
This commit is contained in:
@@ -3,7 +3,6 @@ from __future__ import annotations
|
||||
import argparse
|
||||
import json
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
from .app import make_client
|
||||
@@ -14,6 +13,7 @@ from .config import DEFAULT_CONFIG
|
||||
from .remote_path import join_remote_path
|
||||
from .sync import sync_once
|
||||
from .table import format_table
|
||||
from .watch import watch_loop
|
||||
|
||||
DEFAULT_NODE = 'picoshare'
|
||||
|
||||
@@ -99,12 +99,7 @@ def _cmd_sync(args) -> int:
|
||||
client.close()
|
||||
|
||||
def _cmd_watch(args) -> int:
|
||||
print(f'watching {args.folder} every {args.interval}s')
|
||||
while True:
|
||||
code = _cmd_sync(args)
|
||||
if code:
|
||||
return code
|
||||
time.sleep(args.interval)
|
||||
return watch_loop(args, _cmd_sync)
|
||||
|
||||
def _cmd_completion(args) -> int:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user