Skip to content

Commit 09b18df

Browse files
hjh320ccreutzi
authored andcommitted
Fix the pre-commit hook mlx-to-md export for multiple Live Scripts
* Fix the pre-commit hook mlx to md conversion when multiple Live Scripts have changed * Simplify the mlx to md export logic
1 parent fcd56f6 commit 09b18df

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

.githooks/pre-commit

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ pwd
1919
changedMlxFiles=`git diff --cached --name-only --diff-filter=d '*.mlx'`
2020

2121
if [ -n "$changedMlxFiles" ]; then
22-
# Keep the line break here, we replace end-of-line with "' '" to get the quotes right
23-
matlab -batch "for file = {'${changedMlxFiles//
24-
/' '}'}, export(file{1},replace(erase(file{1},'mlx-scripts'),'.mlx','.md')); end"
22+
for file in $changedMlxFiles; do
23+
echo "Pre-commit hook: exporting ${file} to md"
24+
matlab -batch "export('${file}',replace(erase('${file}','mlx-scripts'),'.mlx','.md'));"
25+
done
2526
tmp=${changedMlxFiles//mlx-scripts\//}
2627
mdFiles=${tmp//.mlx/.md}
2728
for file in $mdFiles; do

0 commit comments

Comments
 (0)