Created
June 2, 2019 06:38
-
-
Save m42e/08dd6f6c18fb97edf3079ece3f7ba85c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env zsh | |
# | |
# | |
local PLANTUML_TOOL_FILE | |
local PLANTUML_DOWNLOAD_URL | |
PLANTUML_TOOL_FILE=~/.dotfiles/tools/plantuml.jar | |
PLANTUML_DOWNLOAD_URL=http://sourceforge.net/projects/plantuml/files/plantuml.jar/download | |
_plantuml_download_if_needed(){ | |
if [ ! -f ${PLANTUML_TOOL_FILE} ]; then | |
curl -o ${PLANTUML_TOOL_FILE} -JL -q ${PLANTUML_DOWNLOAD_URL} | |
fi | |
} | |
_plantuml_execute(){ | |
java -jar ${PLANTUML_TOOL_FILE} $* | |
} | |
_plantuml_check_dot(){ | |
[ -f ${PLANTUML_TOOL_FILE}.hasdot ] || _plantuml_execute -testdot > /dev/null || (echo "dot not found" && exit 1) | |
touch ${PLANTUML_TOOL_FILE}.hasdot | |
} | |
plantuml(){ | |
if [[ "$1" == "!" ]];then | |
rm ${PLANTUML_TOOL_FILE} | |
shift | |
fi | |
_plantuml_download_if_needed | |
_plantuml_check_dot | |
_plantuml_execute $* | |
} | |
plantuml_from_image(){ | |
_plantuml_execute -metadata $1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment