From 26f9d6ad31c1e56876e2634fbaa2f1eb217ac0c3 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 18 Sep 2026 17:08:37 +0200 Subject: feat: add a config verb printing effective settings Durations were unobservable at runtime: status reports phase and seconds left, not the configuration those came from, so 'did my config take effect' could only be answered by reading the script. It also gives the config test something to assert against without running a thirty minute work block. --- breaktimer.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/breaktimer.sh b/breaktimer.sh index 7c8bfa3..04dbaa9 100755 --- a/breaktimer.sh +++ b/breaktimer.sh @@ -247,6 +247,16 @@ case "$1" in echo "paused" > "$STATE_FILE"; echo "breaktimer: sospeso" fi ;; + config) + printf 'MICRO_MIN=%s\nBREAK_MIN=%s\nLONG_MIN=%s\nLONG_EVERY=%s\n' \ + "$MICRO_MIN" "$BREAK_MIN" "$LONG_MIN" "$LONG_EVERY" + printf 'WORK_START=%s\nWORK_STOP=%s\n' "$WORK_START" "$WORK_STOP" + printf 'URGENCY_MICRO=%s\nURGENCY_LONG=%s\n' "$URGENCY_MICRO" "$URGENCY_LONG" + printf 'SOUND_MICRO=%s\nSOUND_LONG=%s\nSOUND_BACK=%s\n' \ + "$SOUND_MICRO" "$SOUND_LONG" "$SOUND_BACK" + printf 'CONFIG_FILE=%s\n' "$CONFIG_FILE" + [ -f "$CONFIG_FILE" ] && printf 'CONFIG_LOADED=yes\n' || printf 'CONFIG_LOADED=no\n' + ;; status) if is_running; then echo "breaktimer: attivo (PID $(cat "$PID_FILE")), stato: $(cat "$STATE_FILE" 2>/dev/null), fase: $(cat "$PHASE_FILE" 2>/dev/null), rimane: $(cat "$REMAIN_FILE" 2>/dev/null)s" @@ -255,7 +265,7 @@ case "$1" in fi ;; *) - echo "uso: $0 [start|stop|restart|pause|resume|toggle|status]" + echo "uso: $0 [start|stop|restart|pause|resume|toggle|status|config]" exit 1 ;; esac -- cgit v1.2.3