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

@ -27,7 +27,7 @@ fi
echo "Running tests..."
if output=$(./test.sh 2>&1); then
echo "$output"
count=$(sed -n 's/.*\([0-9]\+\) tests: \([0-9]\+\) passed.*/\2 passed/p' <<< "$output")
count=$(grep -oP '\d+ passed' <<< "$output" | tail -1)
write_badge "${count:-passing}" "brightgreen"
else
echo "$output"