Skip to content

Instantly share code, notes, and snippets.

@m42e
Created June 2, 2019 06:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save m42e/08dd6f6c18fb97edf3079ece3f7ba85c to your computer and use it in GitHub Desktop.
Save m42e/08dd6f6c18fb97edf3079ece3f7ba85c to your computer and use it in GitHub Desktop.
#!/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