Created
July 7, 2022 13:48
-
-
Save codingoutloud/3437fd469b944cf79567dc9788efcf38 to your computer and use it in GitHub Desktop.
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 | |
# Mostly this script exists to simply make it possible/simple to do "puml.sh foo.puml" to create "foo.png" from command line. | |
# | |
# If you want it even simpler - "puml foo.puml" (no ".sh" extension) consider using an alias. | |
# Here is example for .bash_profile: | |
# alias puml=~/bin/puml.sh | |
for ARG in "$@" | |
do | |
if [ "$ARG" = "v" ]; then | |
echo "Autoview enabled" | |
VIEW_PUML_OUTPUT_AUTOMATICALLY=$true | |
else | |
PUML=$ARG | |
PNG="${PUML%.*}.png" | |
if [ -f "$PUML" ]; then | |
# 💘➜↓↳⇢➤🏹➡️ ➡ | |
echo "Compiling $PUML ➡️ $PNG" | |
java -jar ~/bin/plantuml.jar $PUML | |
if [ -z "$VIEW_PUML_OUTPUT_AUTOMATICALLY" ]; then | |
echo "Opening $PNG" | |
open -g "$PNG" | |
fi | |
else | |
echo "$PUML not found." | |
fi | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment