aboutsummaryrefslogtreecommitdiff
path: root/compilePlantUML.sh
blob: e5de32302ddfd6b420770cf9eb20fa7807e58e6f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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"
plantuml "$sourceFile" -o "$targetDir"
[ -n "$open" ] && "$VIEWER" "$targetFile" &
exit 0 # So return value is not that of previous line