Skip to content

Commit 0d15f1a

Browse files
committed
Rename readme to markdown in toc.sh
this is for @thompson-shaun specifically
1 parent 3be5a2a commit 0d15f1a

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

toc.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ usage() {
1212
EOU
1313
}
1414

15-
readme="${1:-}"
16-
if ! shift || [ ! -f "$readme" ]; then usage >&2; exit 1; fi
15+
markdown="${1:-}"
16+
if ! shift || [ ! -f "$markdown" ]; then usage >&2; exit 1; fi
1717

1818
toc="$(
1919
gawk '
@@ -44,10 +44,10 @@ toc="$(
4444
4545
printf "%s[%s](#%s)\n", prefix, $0, hash
4646
}
47-
' "$readme"
47+
' "$markdown"
4848
)"
4949

50-
toFile="${readme}.bak"
50+
toFile="${markdown}.bak"
5151
gawk -v toFile="$toFile" -v toc="$toc" '
5252
BEGIN { printf "" > toFile }
5353
/^<!-- AUTOGENERATED TOC -->$/ {
@@ -64,10 +64,10 @@ gawk -v toFile="$toFile" -v toc="$toc" '
6464
}
6565
!inToc { print >> toFile }
6666
END { if (!seenToc) { close(toFile); printf "" > toFile } }
67-
' "$readme"
67+
' "$markdown"
6868

6969
if [ -s "$toFile" ]; then
70-
mv "$toFile" "$readme"
70+
mv "$toFile" "$markdown"
7171
else
7272
rm "$toFile"
7373
echo "$toc"

0 commit comments

Comments
 (0)