Refactor: deduplicate notifications, fix timer parsing, -o optional arg

- Extract build_job_list helper (shared by show_status/list_logs)
- clean_jobs now calls remove_job instead of inline stop/disable/rm
- Extract status preamble in write_notify_lines (icon_pre/status_pre)
- Replace fragile list-timers tail/awk with systemctl show properties
- Combine consecutive sed -i calls into single invocations
- Simplify is_manage_mode check to use existing manage_count
- Make -o accept optional line count arg (-o 20 or just -o for default 10)
- Fix %%s escaping in unit files and document in CLAUDE.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthias Johnson 2026-02-14 21:49:18 -07:00
parent 67528374cd
commit 8781ac9f2f
3 changed files with 62 additions and 71 deletions

View file

@ -75,7 +75,7 @@ systab -t "in 1 hour" -c "make build" -i
systab -t "every day at 6am" -c "df -h" -m user@example.com
# Include last 10 lines of output in notification
systab -t "every day at 6am" -c "df -h" -i -o 10
systab -t "every day at 6am" -c "df -h" -i -o
```
### Managing jobs
@ -145,7 +145,7 @@ Job Creation:
-f <script> Script file to execute (reads stdin if neither -c nor -f)
-i Send desktop notification on completion (success/failure)
-m <email> Send email notification to address (via sendmail)
-o <lines> Include last N lines of job output in notifications (default: 10)
-o [lines] Include job output in notifications (default: 10 lines)
Management:
-P <id> Pause (disable) a job