From 57cfdfd0cd334b17f58fb08b6307958bf6f883de Mon Sep 17 00:00:00 2001 From: Felix Lohmeier Date: Wed, 6 Dec 2023 16:02:59 +0000 Subject: [PATCH 1/2] fix bug that occurs when GREL contains brackets --- orcli | 4 ++-- src/transform_command.sh | 2 +- tests/transform-bracket.sh | 48 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 3 deletions(-) create mode 100644 tests/transform-bracket.sh diff --git a/orcli b/orcli index 51d5bf6..967bd5f 100755 --- a/orcli +++ b/orcli @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# This script was generated by bashly 1.1.2 (https://bashly.dannyb.co) +# This script was generated by bashly 1.1.3 (https://bashly.dannyb.co) # Modifying it manually is not recommended # :wrapper.bash3_bouncer @@ -2264,7 +2264,7 @@ orcli_transform_command() { array[expression]="${array[expression]//$'\n'/}" # prepare curl options mapfile -t curloptions < <(for K in "${!array[@]}"; do - echo "--data" + echo "--data-urlencode" echo "$K=${array[$K]}" done) # get csrf token and post data to it's individual endpoint diff --git a/src/transform_command.sh b/src/transform_command.sh index 3fec410..d1d59dc 100644 --- a/src/transform_command.sh +++ b/src/transform_command.sh @@ -88,7 +88,7 @@ for i in "${!files[@]}"; do array[expression]="${array[expression]//$'\n'/}" # prepare curl options mapfile -t curloptions < <(for K in "${!array[@]}"; do - echo "--data" + echo "--data-urlencode" echo "$K=${array[$K]}" done) # get csrf token and post data to it's individual endpoint diff --git a/tests/transform-bracket.sh b/tests/transform-bracket.sh new file mode 100644 index 0000000..f35cbbc --- /dev/null +++ b/tests/transform-bracket.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +t="transform-bracket" + +# create tmp directory +tmpdir="$(mktemp -d)" +trap '{ rm -rf "${tmpdir}"; }' 0 2 3 15 + +# assertion +cat << "DATA" > "${tmpdir}/${t}.assert" +email name test state gender purchase +danny.baron@example1.com Danny Baron (Danny Baron) CA M TV +melanie.white@example2.edu Melanie White (Melanie White) NC F iPhone +danny.baron@example1.com D. Baron (D. Baron) CA M Winter jacket +ben.tyler@example3.org Ben Tyler (Ben Tyler) NV M Flashlight +arthur.duff@example4.com Arthur Duff (Arthur Duff) OR M Dining table +danny.baron@example1.com Daniel Baron (Daniel Baron) CA M Bike +jean.griffith@example5.org Jean Griffith (Jean Griffith) WA F Power drill +melanie.white@example2.edu Melanie White (Melanie White) NC F iPad +ben.morisson@example6.org Ben Morisson (Ben Morisson) FL M Amplifier +arthur.duff@example4.com Arthur Duff (Arthur Duff) OR M Night table +DATA + +# transform +cat << "DATA" > "${tmpdir}/${t}.history" +[ + { + "op": "core/column-addition", + "engineConfig": { + "facets": [], + "mode": "row-based" + }, + "baseColumnName": "name", + "expression": "grel:forNonBlank(value, x, '(' + x + ')', null)", + "newColumnName": "test", + "columnInsertIndex": 2 + } +] +DATA + +# action +cd "${tmpdir}" || exit 1 +orcli import csv "https://git.io/fj5hF" --projectName "duplicates" +orcli transform "duplicates" "${t}.history" +orcli export tsv "duplicates" --output "${t}.output" + +# test +diff -u "${t}.assert" "${t}.output" From 0a5b77792dc0f4d2a1508ddd0c3aa8c9ea87347a Mon Sep 17 00:00:00 2001 From: Felix Lohmeier Date: Wed, 6 Dec 2023 16:05:53 +0000 Subject: [PATCH 2/2] release 0.2.2 --- help/README.md | 2 +- orcli | 2 +- src/bashly.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/help/README.md b/help/README.md index 72fbe9e..816441d 100644 --- a/help/README.md +++ b/help/README.md @@ -1,4 +1,4 @@ -# orcli 0.2.1 +# orcli 0.2.2 ## command help screens diff --git a/orcli b/orcli index 967bd5f..390f849 100755 --- a/orcli +++ b/orcli @@ -4750,7 +4750,7 @@ orcli_run_parse_requirements() { # :command.initialize initialize() { - version="0.2.1" + version="0.2.2" long_usage='' set -e diff --git a/src/bashly.yml b/src/bashly.yml index cd497d4..9660d28 100644 --- a/src/bashly.yml +++ b/src/bashly.yml @@ -1,6 +1,6 @@ name: orcli help: OpenRefine command-line interface written in Bash -version: 0.2.1 +version: 0.2.2 footer: https://github.com/opencultureconsulting/orcli dependencies: