# requires drawio desktop and libxml2-utils
alias drawio='"/mnt/c/Program Files/draw.io/draw.io.exe"' 

#in='SAREF4ENVI_examples.drawio'
in='SAREF4ENVI_figures.drawio'

## doesn't work in wsl2
# drawio --export --format xml --uncompressed -o $xml $in

## This worked in cmd:
# xml=diagrams.xml
# "C:\Program Files\draw.io\draw.io.exe" --export --format xml --uncompressed -o "diagrams.xml" "SAREF4ENVI_figures.drawio"
# rm $xml

tabs=$(xmllint --xpath "//diagram/@name" $in | cut -f 2 -d "=" | tr -d '"')
i=0
declare -i i
for tab in $tabs; do
    echo $tab
    '/mnt/c/Program Files/draw.io/draw.io.exe' -x -f png --width 1920 -p $i -o ${in%.drawio}.$tab.png $in
    i+=1
done
