|
24 | 24 | # Assumes sibling layout: |
25 | 25 | # ~/work/objectui |
26 | 26 | # ~/work/objectstack ← run from here |
| 27 | +# --help ends here |
| 28 | +# |
| 29 | +# ^ SENTINEL, not prose — `--help` prints from the shebang down to the line above |
| 30 | +# and stops there, so the terminator travels with the text it terminates. Add or |
| 31 | +# remove header lines freely; no line number tracks this block any more (#6425). |
| 32 | +# Spell it exactly: the --help branch below refuses to run without it. Everything |
| 33 | +# from here down is internal rationale and is NOT user-facing help. |
27 | 34 | # |
28 | 35 | # objectui ships @object-ui/console as a static SPA. The framework |
29 | 36 | # release pipeline reads .objectui-sha, clones objectui at that commit, |
@@ -63,10 +70,25 @@ for arg in "$@"; do |
63 | 70 | --no-commit) NO_COMMIT=1 ;; |
64 | 71 | --no-changeset) NO_CHANGESET=1 ;; |
65 | 72 | -h|--help) |
66 | | - # NOTE: this line range is coupled to the header block above (usage → env → |
67 | | - # sibling layout, ending at "run from here"). Editing the header means moving |
68 | | - # it — #5960 added the pin-update step and had to. |
69 | | - sed -n '2,26p' "$0" | sed 's/^# \{0,1\}//' |
| 73 | + # The header block above IS the help text, and the `# --help ends here` |
| 74 | + # sentinel is what ends it — no line range, so growing the header can no |
| 75 | + # longer truncate the help (#6425; #5960 grew it and PR #6421 had to move a |
| 76 | + # hand-kept `2,26p`). The leading `2` addresses the shebang, whose position |
| 77 | + # is fixed by execve rather than by the header's content, so it cannot drift. |
| 78 | + # |
| 79 | + # A missing sentinel EXITS 1 rather than running on to EOF: a truncated help |
| 80 | + # and a complete one both exit 0 and both print something, which is precisely |
| 81 | + # why the old coupling could fail in silence — same lesson as the `head -40` |
| 82 | + # this script used to truncate its changeset list with (#4731). Guarded here, |
| 83 | + # not at startup: a deleted comment must never stop an actual pin bump. |
| 84 | + if ! grep -qxF '# --help ends here' "$0"; then |
| 85 | + echo "✗ ${0##*/}: the '# --help ends here' sentinel is missing — cannot tell" >&2 |
| 86 | + echo " where the help text ends. Restore it at the end of the header block." >&2 |
| 87 | + exit 1 |
| 88 | + fi |
| 89 | + sed -n '2,/^# --help ends here$/p' "$0" \ |
| 90 | + | grep -vxF '# --help ends here' \ |
| 91 | + | sed 's/^# \{0,1\}//' |
70 | 92 | exit 0 |
71 | 93 | ;; |
72 | 94 | *) EXPLICIT_SHA="$arg" ;; |
|
0 commit comments