Skip to content

Instantly share code, notes, and snippets.

@tbrisbout
Last active November 2, 2020 21:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbrisbout/445530ff71be0d33cfde49761057b3e0 to your computer and use it in GitHub Desktop.
Save tbrisbout/445530ff71be0d33cfde49761057b3e0 to your computer and use it in GitHub Desktop.
build diagrams
#!/bin/bash
# To run like this:
# ./run.sh foo.py
#
# If you have `entr` installed, you can build and preview on change:
# ls *.py | entr -p ./run.sh /_
#
set -e
input_file=$(basename -- "$1")
filename="${input_file%%.*}"
output_file="${filename}.png"
cat "$input_file" | sudo docker run --rm -i -v $PWD/out:/out gtramontina/diagrams:0.17.0
xdg-open "./out/${output_file}" 2>/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment