From c65361560a1f31b3334711c65ec059b3a2e13900 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Mon, 26 Jun 2023 15:50:34 +1000 Subject: [PATCH] Tweaks to web-watch - Fix warning on Linux about conflicting args - Use clear instead of printing a control char - Print the rebuild time - Perform a rebuild on initial invocation --- tools/reload_webviews.py | 2 +- tools/web-watch | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/reload_webviews.py b/tools/reload_webviews.py index 7afda5616..948401d9b 100755 --- a/tools/reload_webviews.py +++ b/tools/reload_webviews.py @@ -41,7 +41,7 @@ try: chrome = PyChromeDevTools.ChromeInterface(host=args.host, port=args.port) except Exception as e: print_error( - f"Could not establish connection to Chromium remote debugger. Exception:\n{e}" + f"Could not establish connection to Chromium remote debugger. Is Anki Open? Exception:\n{e}" ) exit(1) diff --git a/tools/web-watch b/tools/web-watch index 9e6820d7a..f1b822041 100755 --- a/tools/web-watch +++ b/tools/web-watch @@ -10,14 +10,16 @@ set -e MONITORED_FOLDERS=("ts/" "sass/" "qt/aqt/data/web/") MONITORED_EVENTS=("Created" "Updated" "Removed") -on_change_detected="printf \\033c\\n; \"./tools/rebuild-web\"" +on_change_detected="clear; ./tools/rebuild-web; echo Rebuilt at $(date +%H:%M:%S)" event_args="" for event in "${MONITORED_EVENTS[@]}"; do event_args+="--event ${event} " done +bash -c "$on_change_detected" + # poll_monitor comes with a slight performance penalty, but seems to more # reliably identify file system events across both macOS and Linux fswatch -r -o -m poll_monitor ${event_args[@]} \ - "${MONITORED_FOLDERS[@]}" | xargs -n1 -I{} sh -c "$on_change_detected" + "${MONITORED_FOLDERS[@]}" | xargs -I{} bash -c "$on_change_detected"