Commit graph

22 commits

Author SHA1 Message Date
19ccb76235 fixing timesting examples and stripping "at" 2026-02-15 10:15:52 -07:00
f32bf5495b adding name option 2026-02-15 10:11:26 -07:00
308f9e6b11 adding FAQ with -f/-c 2026-02-15 01:21:27 -07:00
558d4046cd adding demo gifs 2026-02-15 00:58:11 -07:00
8319924139 Rename pause/resume to disable/enable to align with systemd terminology
-P/-R flags become -D/-E, -E (edit) becomes -e. Functions renamed to
disable_job_by_id/enable_job_by_id. Output messages, docs, tests, and
demo tapes updated accordingly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:41:21 -07:00
e636ea323c Add gum-styled annotations and less paging to VHS demo tapes
Annotations use demo/note.sh (gum style with clear) wrapped in
Hide/Show so only the styled box appears. Long output commands
pipe through less with search to highlight key fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 00:12:42 -07:00
d19709dc1f Add automated test suite for systab
44 tests covering job creation, status, logs, pause/resume,
notifications, time format parsing, error cases, and cleanup.
Tests run against real systemd user timers with automatic cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 22:50:17 -07:00
32ac2c3d5f Fix "in N minutes" parsing and VHS tape errors
- Strip "in " prefix before passing to date -d (was always broken)
- Fix quickstart tape: -B3 → -B4 for resume grep (Job: is 4 lines back)
- Fix notifications tape: -f ~/backup.sh → -c (file doesn't exist)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 22:24:06 -07:00
8781ac9f2f 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>
2026-02-14 21:49:18 -07:00
67528374cd Add -o flag to include job output in notifications
Fetches the last N lines of journal output (default 10) via
journalctl and includes them in desktop/email notification bodies.
Supports CLI (-o 5) and edit mode (o or o=5 flag syntax).

Also fixes systemd %s specifier expansion in email printf format
strings (must use %%s so systemd passes %s through to the shell).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 16:35:52 -07:00
c3c534f7ce Auto-detect sendmail/msmtp for email notifications
Resolve the mailer binary at job creation time and bake the full path
into the service file, so it works regardless of PATH in the systemd
service environment. Warns and skips if neither is found.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 15:51:31 -07:00
98b180a912 Refactor: deduplicate and simplify systab
Merge get_managed_services/get_managed_timers into get_managed_units
with a type parameter, drop unnecessary seen array. Extract shared
_write_unit_files core from create_job and create_job_from_edit. Add
get_job_command helper to replace triple-sed command extraction (3
call sites). Deduplicate list-timers call in show_status. Replace
rg/grep pipe in list_logs with journalctl --grep. Remove redundant
-h pre-scan loop in main. Net -97 lines.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 15:45:28 -07:00
ef442d464c Add status-aware notifications, edit mode flags, job ID filtering
Notifications now use ExecStopPost (fires on success and failure) with
status-aware icons/messages instead of ExecStartPost (success only).
Desktop uses dialog-information/dialog-error, email uses sendmail.
Flags (i, e=addr) are persisted as # SYSTAB_FLAGS= comments in service
files and exposed in edit mode via ID:flags syntax. Edit mode validates
schedules before applying (re-edit loop like crontab -e). -S and -L
accept an optional job ID to filter to a single job. Extract trim()
helper to replace inline whitespace-stripping idiom.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:43:06 -07:00
37efa43d0a first functional commit 2026-02-14 11:34:00 -07:00
5e961d70f4 Use short ID as unit filename instead of timestamp
Unit files are now named systab_<6-char-hex> (e.g., systab_a1b2c3),
so the ID is derived from the filename — no more SYSTAB_ID comments
in unit files, no id-to-jobname mappings in edit mode. Removes
generate_job_name, get_job_id, get_job_by_id, ensure_job_id.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:22:51 -07:00
b7e6a77ef5 Accept spaces or tabs as field separators in edit mode
Parse crontab lines by splitting on the first two whitespace
boundaries via regex, so both spaces and tabs work as delimiters.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 00:02:20 -07:00
661baf6c16 Add schedule format examples to edit mode header
Shows common OnCalendar patterns (hourly, every 15 min, specific
times, day-of-week) so users know what formats are available.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:25:11 -07:00
a231bc63e9 Fix edit mode job creation and unique name generation
- Handle multiple "new" lines in edit mode by collecting them in an
  array instead of an associative array (which collapsed duplicates)
- Use random hex suffix in job names instead of PID, avoiding
  collisions when multiple jobs are created in the same second
- Fix trap variable scoping in edit_jobs()

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:22:08 -07:00
941772dd5c Update CLAUDE.md to reflect edit mode and short IDs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:14:49 -07:00
ba875ac272 Add RemainAfterElapse=no to one-time timers
One-time timers now auto-unload from systemd after firing, so they
no longer linger as "elapsed" in list-timers. Unit files remain on
disk for ID/edit/status lookups; -C still cleans those up.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:12:57 -07:00
456111627d Implement full -E edit mode with short IDs
Add 6-char hex short IDs (SYSTAB_ID) embedded in unit files for
human-friendly job identification. The -E flag now opens a real
crontab-like editor where jobs can be created, updated, and deleted
by editing tab-separated ID/SCHEDULE/COMMAND lines. Legacy jobs
without IDs get one auto-assigned on first edit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-13 23:01:17 -07:00
bfb273dc66 initial commit 2026-02-01 22:59:06 -07:00