feat: consider included files and relative paths
This commit is contained in:
parent
2b91a16d7d
commit
4573e87344
12
run-fmt.sh
12
run-fmt.sh
|
@ -17,7 +17,7 @@ function format() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
local imports=$(rg "#import \"([a-z0-9/\-]+\.typ)\"" -Nor '$1' "$1")
|
||||
local imports=$(rg "#import \"([a-z0-9/\-.]+\.typ)\"" -Nor '$1' "$1")
|
||||
|
||||
# format all included files
|
||||
while IFS= read -r line; do
|
||||
|
@ -26,6 +26,16 @@ function format() {
|
|||
fi
|
||||
format "$wd/$line" "$2"
|
||||
done <<< "$imports"
|
||||
|
||||
local includes=$(rg "#import \"([a-z0-9/\-.]+\.typ)\"" -Nor '$1' "$1")
|
||||
|
||||
# format all included files
|
||||
while IFS= read -r line; do
|
||||
if [ -z "$line" ]; then
|
||||
continue
|
||||
fi
|
||||
format "$wd/$line" "$2"
|
||||
done <<< "$includes"
|
||||
}
|
||||
|
||||
case $1 in
|
||||
|
|
Loading…
Reference in New Issue