Fix test cleanup destroying user jobs, consolidate code
Some checks failed
CI / shellcheck (push) Failing after 2s

- Test cleanup now only removes jobs it created (tracked via
  test_job_ids array) instead of nuking all systab_* units.
  Fixes bug where running tests would delete real user jobs.
- Fix extract_id subshell issue: array appends in $() don't
  propagate to parent, so use _extracted_id variable instead.
- Merge disable_job_by_id/enable_job_by_id into toggle_job_by_id.
- Update usage text: -D/-E/-L/-S now show <id|name> consistently.
- Fix pre-commit hook sed regex that only captured last digit of
  multi-digit numbers; replaced with grep -oP.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matthias Johnson 2026-02-15 21:55:09 -07:00
parent 96d7d6179a
commit be47247da7
4 changed files with 56 additions and 57 deletions

View file

@ -167,12 +167,12 @@ Job Creation:
-m <email> Send email notification to address (via sendmail)
-o [lines] Include job output in notifications (default: 10 lines)
Management:
-D <id> Disable a job
-E <id> Enable a disabled job
Management (accept hex ID or name):
-D <id|name> Disable a job
-E <id|name> Enable a disabled job
-e Edit jobs in crontab-like format
-L [id] [filter] List job logs (optionally for a specific job and/or filtered)
-S [id] Show status of all managed jobs (or a specific job)
-L [id|name] [filter] List job logs (optionally for a specific job and/or filtered)
-S [id|name] Show status of all managed jobs (or a specific job)
-C Clean up completed one-time jobs
-h Show help
```