From ec1f1588169e96599e0e3d0a7f58eef0f57f1c6e Mon Sep 17 00:00:00 2001 From: xengineering Date: Wed, 3 Aug 2022 15:20:18 +0200 Subject: Use native file extensions --- showdot.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 showdot.sh (limited to 'showdot.sh') diff --git a/showdot.sh b/showdot.sh new file mode 100755 index 0000000..89ada27 --- /dev/null +++ b/showdot.sh @@ -0,0 +1,27 @@ +#!/bin/sh + + +# usage: ./showdot source.dot [compilation args] + + +# process arguments +code=$1 +shift + +file=$(mktemp) + +# compile *.dot code to *.png +if ! dot "$@" -T png -o "${file}" "${code}" +then + echo "Failed to compile with GraphViz." + exit 1 +fi + +# launch image viewer +if ! sxiv "${file}" +then + echo "Failed to display generated image with sxiv." + exit 1 +fi + +rm "${file}" -- cgit v1.2.3-70-g09d2