Merge pull request #110 from opencultureconsulting/108-templating-export-shall-discard-trailing-newline-in-template-file
export template: remove trailing newline from input
This commit is contained in:
commit
6b3ce8f37d
5
orcli
5
orcli
|
@ -1777,10 +1777,13 @@ orcli_export_template_command() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# read args[file] into variable to remove trailing newline
|
||||||
|
template=$(cat "${args[file]}")
|
||||||
|
|
||||||
# assemble specific post data
|
# assemble specific post data
|
||||||
data+=("project=${projectid}")
|
data+=("project=${projectid}")
|
||||||
data+=("format=template")
|
data+=("format=template")
|
||||||
data+=("template@${args[file]}")
|
data+=("template=${template}")
|
||||||
if [[ ${args[--prefix]} ]]; then
|
if [[ ${args[--prefix]} ]]; then
|
||||||
data+=("prefix=${args[--prefix]}")
|
data+=("prefix=${args[--prefix]}")
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -29,10 +29,13 @@ else
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# read args[file] into variable to remove trailing newline
|
||||||
|
template=$(cat "${args[file]}")
|
||||||
|
|
||||||
# assemble specific post data
|
# assemble specific post data
|
||||||
data+=("project=${projectid}")
|
data+=("project=${projectid}")
|
||||||
data+=("format=template")
|
data+=("format=template")
|
||||||
data+=("template@${args[file]}")
|
data+=("template=${template}")
|
||||||
if [[ ${args[--prefix]} ]]; then
|
if [[ ${args[--prefix]} ]]; then
|
||||||
data+=("prefix=${args[--prefix]}")
|
data+=("prefix=${args[--prefix]}")
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -12,9 +12,7 @@ cp data/duplicates.csv "${tmpdir}/${t}.csv"
|
||||||
|
|
||||||
# assertion
|
# assertion
|
||||||
cat << "DATA" > "${tmpdir}/${t}.assert"
|
cat << "DATA" > "${tmpdir}/${t}.assert"
|
||||||
{ "events" : [{ "name" : "Ben Tyler", "purchase" : "Flashlight" }
|
{ "events" : [{ "name" : "Ben Tyler", "purchase" : "Flashlight" },{ "name" : "Ben Morisson", "purchase" : "Amplifier" }]}
|
||||||
,{ "name" : "Ben Morisson", "purchase" : "Amplifier" }
|
|
||||||
]}
|
|
||||||
DATA
|
DATA
|
||||||
|
|
||||||
# action
|
# action
|
||||||
|
@ -24,7 +22,7 @@ orcli export template "${t}" --output "${t}.output" \
|
||||||
<<< '{ "name" : {{jsonize(cells["name"].value)}}, "purchase" : {{jsonize(cells["purchase"].value)}} }' \
|
<<< '{ "name" : {{jsonize(cells["name"].value)}}, "purchase" : {{jsonize(cells["purchase"].value)}} }' \
|
||||||
--prefix '{ "events" : [' \
|
--prefix '{ "events" : [' \
|
||||||
--separator , \
|
--separator , \
|
||||||
--mode rows \
|
--mode records \
|
||||||
--suffix ]}$'\n' \
|
--suffix ]}$'\n' \
|
||||||
--facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben" } ]'
|
--facets '[ { "type": "text", "name": "foo", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "Ben" } ]'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue