Диаграммы
This commit is contained in:
38
Report/lab2/newuml/render-png.sh
Executable file
38
Report/lab2/newuml/render-png.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Rasterize PlantUML sources in this directory to PNG (ОЗ.Р1 / отчёт).
|
||||
# Requires one of: plantuml in PATH, or Java + plantuml.jar (see below).
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# PNG рядом с исходником: oz-r1-foo.puml -> oz-r1-foo.png
|
||||
OUT_OPTS=(-tpng)
|
||||
|
||||
run_plantuml() {
|
||||
if command -v plantuml >/dev/null 2>&1; then
|
||||
plantuml "${OUT_OPTS[@]}" "$@"
|
||||
return 0
|
||||
fi
|
||||
|
||||
local jar="${PLANTUML_JAR:-}"
|
||||
if [[ -n "$jar" && -f "$jar" ]] && command -v java >/dev/null 2>&1; then
|
||||
java -jar "$jar" "${OUT_OPTS[@]}" "$@"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo "plantuml не найден. Установите пакет (например plantuml) или задайте PLANTUML_JAR" >&2
|
||||
echo " export PLANTUML_JAR=/path/to/plantuml.jar" >&2
|
||||
echo "Скачать JAR: https://plantuml.com/download" >&2
|
||||
return 127
|
||||
}
|
||||
|
||||
shopt -s nullglob
|
||||
sources=(*.puml)
|
||||
if ((${#sources[@]} == 0)); then
|
||||
echo "В $SCRIPT_DIR нет файлов *.puml" >&2
|
||||
exit 0
|
||||
fi
|
||||
|
||||
run_plantuml "${sources[@]}"
|
||||
echo "Готово: PNG рядом с исходниками в $SCRIPT_DIR"
|
||||
Reference in New Issue
Block a user