aboutsummaryrefslogtreecommitdiff
path: root/compilePlantUML.sh
diff options
context:
space:
mode:
Diffstat (limited to 'compilePlantUML.sh')
-rwxr-xr-xcompilePlantUML.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/compilePlantUML.sh b/compilePlantUML.sh
new file mode 100755
index 0000000..dcef247
--- /dev/null
+++ b/compilePlantUML.sh
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# compilePlantUML.sh
+#
+# Usage: compilePlantUML.sh [-o] INPUTFILE
+#
+# Compiles a PlantUML file to a temporal png, updating the temporal file if
+# it already exists.
+# Opens the file with $VIEWER if -o option is given.
+
+open=""
+if [ "$1" = "-o" ]; then
+ open="1"
+ shift
+fi
+
+[ -z "$1" ] && exit 1
+
+targetDir="/tmp/plantUML"
+sourceFile="$1"
+targetFile="${targetDir}/${sourceFile##*/}"
+targetFile="${targetFile%.*}.png"
+plantUMLExec="$HOME/programs/plantUML/plantuml.jar"
+
+[ -d "$targetDir" ] || mkdir -p "$targetDir"
+java -jar "$plantUMLExec" "$sourceFile" -o "$targetDir"
+[ -n "$open" ] && "$VIEWER" "$targetFile" &
+exit 0 # So return value is not that of previous line