Skip to content

Commit 2a9091d

Browse files
authored
fix(cli): skip non-assert headings in 'bashunit doc' output (#717)
1 parent 2085189 commit 2a9091d

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/doc.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ function bashunit::doc::print_asserts() {
1818
local line
1919
while IFS='' read -r line || [ -n "$line" ]; do
2020
fn=$(echo "$line" | sed -n 's/^## \([A-Za-z0-9_]*\).*/\1/p')
21+
# Only treat assertion headings as doc entries; skip prose sections
22+
# like "## Related" that are part of the documentation page but not asserts.
23+
case "$fn" in
24+
assert* | bashunit*) ;;
25+
*) fn="" ;;
26+
esac
2127
if [ -n "$fn" ]; then
2228
local _match=0
2329
if [ -z "$filter" ]; then

0 commit comments

Comments
 (0)