Skip to content

scripts: self-extracting usage() sed ranges drifted behind their headers, truncating --help #3424

Closed

Description

@kyle-sexton

Context

Found by the repo-wide /code-tidying:batch-simplify sweep (62 groups / 986 files, branch claude/repo-code-tidying-batch-twhddw). The sweep's doctrine files latent defects instead of fixing them mid-sweep, because the fix changes observable behavior; this issue is that filing.

Three scripts print usage by extracting their own header comment with a hardcoded sed -n 'A,Bp' "$0" range that no longer matches the header: scripts/affected-tests.sh:141-143 cuts off mid-sentence; plugins/source-control/skills/babysit-prs/scripts/fetch-all-pr-comments.sh:53-56 (and reap.sh:62, doctor.sh:76) truncate sections; plugins/songwriting/context/pat-pattison/scripts/datamuse.sh:42 uses sed -n '2,28p' so the five examples on lines 29-33 never print.

Proposed work

  • Replace the hardcoded ranges with a derived extraction (the pattern babysit-readiness-gate.sh already uses: awk to the end-of-header marker), or re-pin the ranges with a comment coupling them to the header.

Acceptance criteria

  • --help output for each listed script ends at its header's actual last line (verified by running each with --help).

References

  • scripts/affected-tests.sh:141-143
  • plugins/source-control/skills/babysit-prs/scripts/fetch-all-pr-comments.sh:53-56
  • plugins/source-control/skills/babysit-prs/scripts/reap.sh:62
  • plugins/source-control/skills/babysit-prs/scripts/doctor.sh:76
  • plugins/songwriting/context/pat-pattison/scripts/datamuse.sh:42

Filed by the /code-tidying:batch-simplify closeout (Phase 8).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triage

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions