diff options
Diffstat (limited to 'pkgs')
| -rw-r--r-- | pkgs/claude-remote.nix | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/pkgs/claude-remote.nix b/pkgs/claude-remote.nix index d21fe7f..55a6648 100644 --- a/pkgs/claude-remote.nix +++ b/pkgs/claude-remote.nix @@ -121,7 +121,8 @@ let the remote's. Kept across reboots; a one-time one missed then runs after the boot (but missed recurring ones don't). --schedules [NAME] - The tasks (of NAME): id, when, next, last run, and how it went. + The tasks (of NAME): id, when, the next run and how long till + then, the last and how long ago, and how it went. --unschedule NAME --id=ID The task, gone, its timer stopped. A remote with tasks can't be renamed or removed: unschedule them first. @@ -815,14 +816,24 @@ let ;; schedules) test ''${#words[@]} -le 1 || die "--schedules [NAME] (claude-remote -h)" - printf '%-30s %-5s %-32s %-32s %-26s %s\n' TASK KIND WHEN NEXT LAST RESULT + # how far from now, like systemctl list-timers' LEFT and PASSED + from_now() { + local d= + test -z "$1" || d=$(systemd-analyze timestamp "$1" 2>/dev/null | + sed -n '/^ *From now: /{s///; s/ \(left\|ago\)$//; p}') + echo "''${d:--}" + } + f='%-30s %-5s %-32s %-32s %-12s %-26s %-12s %s\n' + printf "$f" TASK KIND WHEN NEXT LEFT LAST PASSED RESULT for t in "$tasks"/*/; do test -d "$t" || continue t=''${t%/} if test ''${#words[@]} = 1 && test "$(cat "$t"/remote)" != "''${words[0]}"; then continue; fi next=$(systemctl show --value -p NextElapseUSecRealtime "claude-task@''${t##*/}.timer" 2>/dev/null || :) - printf '%-30s %-5s %-32s %-32s %-26s %s\n' "''${t##*/}" "$(cat "$t"/kind)" "$(cat "$t"/when)" \ - "''${next:--}" "$(cat "$t"/last 2>/dev/null || echo -)" "$(cat "$t"/result 2>/dev/null || echo -)" + last=$(cat "$t"/last 2>/dev/null || :) + printf "$f" "''${t##*/}" "$(cat "$t"/kind)" "$(cat "$t"/when)" \ + "''${next:--}" "$(from_now "$next")" "''${last:--}" "$(from_now "$last")" \ + "$(cat "$t"/result 2>/dev/null || echo -)" done ;; unschedule) |
