2023-01-27 18:04:27 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
t="export-tsv-facets"
|
|
|
|
|
|
|
|
# create tmp directory
|
|
|
|
tmpdir="$(mktemp -d)"
|
|
|
|
trap '{ rm -rf "${tmpdir}"; }' 0 2 3 15
|
|
|
|
|
|
|
|
# input
|
|
|
|
cp data/duplicates.csv "${tmpdir}/${t}.csv"
|
|
|
|
|
|
|
|
# assertion
|
|
|
|
cat << "DATA" > "${tmpdir}/${t}.assert"
|
|
|
|
email name state gender purchase
|
|
|
|
ben.tyler@example3.org Ben Tyler NV M Flashlight
|
|
|
|
ben.morisson@example6.org Ben Morisson FL M Amplifier
|
|
|
|
DATA
|
|
|
|
|
|
|
|
# action
|
|
|
|
cd "${tmpdir}" || exit 1
|
|
|
|
orcli import csv "${t}.csv" --projectName "${t}"
|
|
|
|
orcli export tsv "${t}" \
|
|
|
|
--output "${t}.output" \
|
2023-10-28 16:23:11 +02:00
|
|
|
--facets '[ { "type": "text", "columnName": "name", "mode": "regex", "caseSensitive": false, "query": "^Ben" } ]'
|
2023-01-27 18:04:27 +01:00
|
|
|
|
|
|
|
# test
|
|
|
|
diff -u "${t}.assert" "${t}.output"
|