Skip to content

Commit

Permalink
chore(scripts): Fix sort order of sources files
Browse files Browse the repository at this point in the history
  • Loading branch information
alerque committed Aug 19, 2024
1 parent ca25e5e commit 7d0ec22
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions scripts/list_related_files.zsh.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ case $cmd in
;;
mds)
alias git="@GIT@"
# Separate commands to set our own sort priority
git ls-files "$PROJECT.md" ||:
git ls-files "$PROJECT-*.md" ||:
git ls-files "$bookid.md" ||:
git ls-files "$bookid-**.md" ||:
alias sed="@SED@"
alias sort="@SORT@"
# wrangle our own sorting so NNN.md comes before NNN-foo/bar.md
git ls-files "$PROJECT.md" "$PROJECT-*.md" "$bookid.md" "$bookid-**.md" |
sed -E 's/\.md$/,md/' |
LANG=c sort -n |
sed -E 's/,md$/.md/'
exit 0
;;
srcid)
Expand Down

0 comments on commit 7d0ec22

Please sign in to comment.