| author | Jesse Armand <jesse@jessearmand.com> | 2026-08-22 16:38:16 +0800 |
|---|---|---|
| committer | Jesse Armand <jesse@jessearmand.com> | 2026-08-22 16:38:16 +0800 |
| commit | e97196e0ea068beb6a3ba593d1cf13b8dc8d2f3e (patch) | |
| tree | 95d7f1c825beb9ecbfdacd400081c67ac6b6a3f4 | |
| parent | bde7246d3445cc7aebf9110a88dbaa55bb72eae3 (diff) | |
| download | dgit-e97196e0ea.tar.gz zip | |
fix(scripts): dgit-repo --help printed the script body
The sed range for the usage block matched the second "# Usage:" comment
inside config_json and ran to end of file. Stop at the first non-comment
line instead.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rhJxS6WcjmMZFETjqLv1D
Diffstat
| scripts/dgit-repo | +3 | -1 |
1 file changed, 3 insertions(+), 1 deletions(-)
diff --git a/scripts/dgit-repo b/scripts/dgit-repo @@ -21,7 +21,9 @@ die() { printf 'dgit-repo: %s\n' "$*" >&2; exit 1; } usage() { - sed -n '/^# Usage:/,/^set -euo/p' "$0" | sed '$d' | sed 's/^# \{0,1\}//' + # Print the header comment's Usage block: from "# Usage:" up to the first + # non-comment line, so a later "# Usage:" inside a function can't match. + awk '/^# Usage:/ { p = 1 } p && !/^#/ { exit } p { sub(/^# ?/, ""); print }' "$0" exit "${1:-0}" } |