Skip to content

Instantly share code, notes, and snippets.

@yanivmo
Created November 2, 2020 19:06
Show Gist options
  • Save yanivmo/08a8a446a7bc9b8372e6d39179d588e9 to your computer and use it in GitHub Desktop.
Save yanivmo/08a8a446a7bc9b8372e6d39179d588e9 to your computer and use it in GitHub Desktop.
Edit PlantUML diagram definition locally and see the changes on the fly
#!/bin/bash
# The only argument is the diagram definition file
test -z "$1" && (echo "Expected one filename argument"; exit 1)
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# plantuml.jar is the PlantUML distribution as downloaded from https://plantuml.com/download
java -jar ${script_dir}/plantuml.jar $1
# feh is a popular command-line oriented image viewer
# Shows the rendered image and updates itself if the file changes
feh "${1%.*}.png" &
# Regenerate the image each time the diagram definition file is modified
while inotifywait --quiet --event modify $1; do
java -jar ${script_dir}/plantuml.jar $1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment