Last active
December 18, 2015 15:29
-
-
Save teabot/5804726 to your computer and use it in GitHub Desktop.
Periodically converts a dot file into a PNG so that I can create diagrams in a text editor and view them in a web browser and/or "OSX Preview".
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -ne 1 ] | |
then | |
echo "Usage: `basename $0` {dot file}" | |
exit -1 | |
fi | |
FILE=$1 | |
NAME=${FILE%.dot} | |
DOT=$NAME.dot | |
PNG=$NAME.png | |
echo "View diagram at URL: file://$PNG" | |
# Open in Preview on OSX - will auto update whenever it has focus | |
open -g -a "Preview" $PNG | |
while :; | |
do | |
dot -Tpng -o $PNG $DOT | |
sleep 1 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment