parse_json_test_output.sh 282 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!/bin/bash

set -euo pipefail

if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <test name> <json file>"
    exit 1
fi

TEST_NAME="$1"
JSON_FILE="$2"

jq --raw-output --join-output --arg testName "${TEST_NAME}" 'select(.Test == $testName and .Action == "output").Output' "${JSON_FILE}"