aboutsummaryrefslogtreecommitdiff
path: root/tests/manifest-serializer/driver.in
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-21 12:30:38 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-21 12:30:38 +0200
commit03ff256dc44228c9465cd2040593a72b2d084d1e (patch)
tree00a0ea59a21f49f4ffb9565f624c73a45d08826e /tests/manifest-serializer/driver.in
parented93f8450b92579dd639ae25361fa650613a5b7e (diff)
Add manifest serializer module
Diffstat (limited to 'tests/manifest-serializer/driver.in')
-rw-r--r--tests/manifest-serializer/driver.in37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/manifest-serializer/driver.in b/tests/manifest-serializer/driver.in
new file mode 100644
index 0000000..9e619e5
--- /dev/null
+++ b/tests/manifest-serializer/driver.in
@@ -0,0 +1,37 @@
+#!/usr/bin/env bash
+
+# file : tests/manifest-serializer/driver.in
+# copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+# license : MIT; see accompanying LICENSE file
+
+trap "{ exit 1; }" ERR
+set -o errtrace # Trap ERR in functions.
+
+@import libbutl/manifest-serializer@
+
+butl_manifest_serializer_start "$@"
+
+fd="$butl_manifest_serializer_ifd"
+
+while read -r n; do
+
+ printf "%s:" "$n" >&"$fd"
+
+ f=true
+ while read -r v; do
+ if [ -z "$v" ]; then
+ printf "\0" >&"$fd"
+ break
+ else
+ if [ "$f" ]; then
+ f=
+ else
+ printf "\n" >&"$fd"
+ fi
+ printf "%s" "$v" >&"$fd"
+ fi
+ done
+
+done
+
+butl_manifest_serializer_finish