From f3f80c1efb7f7452c01f600a671a45088ad0c591 Mon Sep 17 00:00:00 2001 From: InigoGutierrez Date: Wed, 4 Mar 2020 23:17:03 +0100 Subject: Created script to compile PlantUML files. --- compilePlantUML.sh | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100755 compilePlantUML.sh (limited to 'compilePlantUML.sh') 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 -- cgit v1.2.1