aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorInigoGutierrez <inigogf.95@gmail.com>2020-03-04 23:17:03 +0100
committerInigoGutierrez <inigogf.95@gmail.com>2020-03-04 23:17:03 +0100
commitf3f80c1efb7f7452c01f600a671a45088ad0c591 (patch)
tree04185896a3f4403988967c52dab3453a61b8e9cc
parent331f8ee4388e2b349c8a4972a51960b31c668a23 (diff)
downloadscripts-f3f80c1efb7f7452c01f600a671a45088ad0c591.tar.gz
scripts-f3f80c1efb7f7452c01f600a671a45088ad0c591.zip
Created script to compile PlantUML files.
-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