Created
December 21, 2012 17:18
-
-
Save anonymous/4354187 to your computer and use it in GitHub Desktop.
This generates .png images using yuml.me. I'd like you to simplify my bash script so that I can learn more bash syntax/style.
This file contains hidden or 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
#!/bin/bash | |
download_yuml_image() { | |
local file="$1" | |
local output_directory="$2" | |
instructions=$(tr "\\n" "," < <(cat $file)) | |
image_basename=$(basename $(echo $file | sed -E "s/(.+)\.yuml$/\1/")) | |
image_filename="${output_directory}/${image_basename}.png" | |
wget -O "$image_filename" "http://yuml.me/diagram/plain;dir:TB/class/$instructions" | |
gm convert ${image_filename} -units PixelsPerInch -density 96x96 'xc:white' -flatten ${image_filename} | |
} | |
for file in manuscript/diagrams/class/*.yuml; do | |
download_yuml_image "$file" "manuscript/images/Design" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment