Skip to content

Commit

Permalink
only print the first comment block of a long script
Browse files Browse the repository at this point in the history
This is a longstanding bug: if you had multiple blocks of comments in a
script, sd would print all of them, despite the documented behavior of
only printing the first one.

Thanks to @wolfmah for finding the bug.
  • Loading branch information
ianthehenry committed Oct 30, 2022
1 parent ecd1ab8 commit dd12019
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sd
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ __sd_help() {
elif [[ -f "$target.help" ]]; then
__sd_cat "$target.help"
else
help=$(sed -nE -e '/^#!/d' -e $':start\n /^#/{ s/^# ?//; p; \nb start\n }' "$target")
help=$(sed -nE -e '/^#!/d' -e $':start\n/^#/{ s/^# ?//; p; n; /^#/!q; b start\n}' "$target")
if [[ -z "$help" ]]; then
echo "there is no help for you here" >&2
exit 1
Expand Down

0 comments on commit dd12019

Please sign in to comment.