Index: experimental/fiddle/parse-fiddle-output |
diff --git a/experimental/fiddle/parse-fiddle-output b/experimental/fiddle/parse-fiddle-output |
new file mode 100755 |
index 0000000000000000000000000000000000000000..f9a2fac6d6633e3c5f17807481307f55d91cec83 |
--- /dev/null |
+++ b/experimental/fiddle/parse-fiddle-output |
@@ -0,0 +1,21 @@ |
+#!/bin/sh |
+# Copyright 2015 Google Inc. |
+# |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
+# Parse the output of fiddle_main, for use in testing |
+while IFS= read -r line; do |
+ type=$(echo $line | sed -n 's/[^"]*"\([^"]*\)":.*/\1/p') |
+ if [ "$type" ]; then |
+ case "$type" in |
+ Raster|Gpu) ext='.png';; |
+ Pdf) ext='.pdf';; |
+ Skp) ext='.skp';; |
+ esac |
+ dst="${TMPDIR:-/tmp}/fiddle_${type}${ext}" |
+ echo $line | sed 's/[^"]*"[^"]*": "//; s/"\(,\|\)$//' \ |
+ | base64 -d > "$dst" |
+ echo $dst |
+ fi |
+done |