From afe9f9ea08ced270ab5f723341cf03680b36ed96 Mon Sep 17 00:00:00 2001 From: Landon Curt Noll Date: Tue, 20 Aug 2024 11:19:51 -0700 Subject: [PATCH] change JSON wrapper tools to not use -T with JSONPATH.sh In keeping with [GH-issues 931](https://github.com/ioccc-src/mkiocccentry/issues/931), we remove the use of `-T` from the `JSONPATH.sh` tool. This will implement JSON formatting using multiples of 4 ASCII spaces and without TABs. Changed `bin/jfmt-wrapper.sh` VERSION form "1.0.2 2024-08-08" to "1.1 2024-08-20". Changed `bin/jprint-wrapper.sh` VERSION form "1.0.2 2024-08-08" to "1.1 2024-08-20". Changed `bin/jval-wrapper.sh` VERSION form "1.0.3 2024-08-11" to "1.0.4 2024-08-20". --- bin/jfmt-wrapper.sh | 14 +++++++------- bin/jprint-wrapper.sh | 18 +++++++++--------- bin/jval-wrapper.sh | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/bin/jfmt-wrapper.sh b/bin/jfmt-wrapper.sh index b45a74928..1ed0272f2 100755 --- a/bin/jfmt-wrapper.sh +++ b/bin/jfmt-wrapper.sh @@ -95,7 +95,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.2 2024-08-08" +export VERSION="1.1 2024-08-20" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -120,10 +120,10 @@ if [[ -z $JSONPATH_SH ]]; then echo "$0: notice: obtain JSONPath.sh from: $JSONPATH_REPO" 1>&2 exit 5 fi -# verify JSONPath.sh supports -S -A -T +# verify JSONPath.sh supports -S -A export FIZZBIN_JSON='"fizzbin"' -if ! "$JSONPATH_SH" -S -A -T -p >/dev/null 2>&1; then - echo "$0: FATAL: JSONPath.sh tool does not support -S -A -T: $FIZZBIN_JSON" 1>&2 +if ! "$JSONPATH_SH" -S -A -p >/dev/null 2>&1; then + echo "$0: FATAL: JSONPath.sh tool does not support -S -A: $FIZZBIN_JSON" 1>&2 echo "$0: notice: we recommend you obtain and install JSONPath.sh from: $JSONPATH_REPO" 1>&2 exit 5 fi <<< "$FIZZBIN_JSON" @@ -303,12 +303,12 @@ fi # canonically format the JSON file # if [[ $V_FLAG -ge 3 ]]; then - echo "$0: debug[3]: about to: $JSONPATH_SH -S -A -T -j -f $JSON_FILE > $TMP_JSON_FILE" 1>&2 + echo "$0: debug[3]: about to: $JSONPATH_SH -S -A -j -f $JSON_FILE > $TMP_JSON_FILE" 1>&2 fi -"$JSONPATH_SH" -S -A -T -j -f "$JSON_FILE" > "$TMP_JSON_FILE" +"$JSONPATH_SH" -S -A -j -f "$JSON_FILE" > "$TMP_JSON_FILE" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: ERROR: $JSONPATH_SH -S -A -T -j -f $JSON_FILE > $TMP_JSON_FILE failed," \ + echo "$0: ERROR: $JSONPATH_SH -S -A -j -f $JSON_FILE > $TMP_JSON_FILE failed," \ "error code: $status" 1>&2 exit 1 fi diff --git a/bin/jprint-wrapper.sh b/bin/jprint-wrapper.sh index 5e2d8ca03..b67d7bd0b 100755 --- a/bin/jprint-wrapper.sh +++ b/bin/jprint-wrapper.sh @@ -92,7 +92,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.2 2024-08-08" +export VERSION="1.1 2024-08-20" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -117,9 +117,9 @@ if [[ -z $JSONPATH_SH ]]; then echo "$0: notice: obtain JSONPath.sh from: $JSONPATH_REPO" 1>&2 exit 5 fi -# verify JSONPath.sh supports -S -A -T +# verify JSONPath.sh supports -S -A export FIZZBIN_JSON='"fizzbin"' -if ! "$JSONPATH_SH" -S -A -T -p >/dev/null 2>&1; then +if ! "$JSONPATH_SH" -S -A -p >/dev/null 2>&1; then echo "$0: FATAL: JSONPath.sh tool does not support -S -A -T: $FIZZBIN_JSON" 1>&2 echo "$0: notice: we recommend you obtain and install JSONPath.sh from: $JSONPATH_REPO" 1>&2 exit 5 @@ -276,13 +276,13 @@ fi if [[ -z $JSON_FILE ]]; then if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: about to: $JSONPATH_SH -S -A -T -j" 1>&2 + echo "$0: debug[1]: about to: $JSONPATH_SH -S -A -j" 1>&2 fi - "$JSONPATH_SH" -S -A -T -j + "$JSONPATH_SH" -S -A -j status="$?" if [[ $status -ne 0 ]]; then - echo "$0: ERROR: $JSONPATH_SH -S -A -T -j failed," \ + echo "$0: ERROR: $JSONPATH_SH -S -A -j failed," \ "error code: $status" 1>&2 exit 1 fi @@ -292,12 +292,12 @@ if [[ -z $JSON_FILE ]]; then else if [[ $V_FLAG -ge 1 ]]; then - echo "$0: debug[1]: about to: $JSONPATH_SH -S -A -T -j -f $JSON_FILE" 1>&2 + echo "$0: debug[1]: about to: $JSONPATH_SH -S -A -j -f $JSON_FILE" 1>&2 fi - "$JSONPATH_SH" -S -A -T -j -f "$JSON_FILE" + "$JSONPATH_SH" -S -A -j -f "$JSON_FILE" status="$?" if [[ $status -ne 0 ]]; then - echo "$0: ERROR: $JSONPATH_SH -S -A -T -j -f $JSON_FILE failed," \ + echo "$0: ERROR: $JSONPATH_SH -S -A -j -f $JSON_FILE failed," \ "error code: $status" 1>&2 exit 1 fi diff --git a/bin/jval-wrapper.sh b/bin/jval-wrapper.sh index 1dd8bf352..05a4e14d5 100755 --- a/bin/jval-wrapper.sh +++ b/bin/jval-wrapper.sh @@ -106,7 +106,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an # set variables referenced in the usage message # -export VERSION="1.0.3 2024-08-11" +export VERSION="1.0.4 2024-08-20" NAME=$(basename "$0") export NAME export V_FLAG=0 @@ -128,10 +128,10 @@ if [[ -z $JSONPATH_SH ]]; then echo "$0: notice: obtain JSONPath.sh from: $JSONPATH_REPO" 1>&2 exit 5 fi -# verify JSONPath.sh supports -S -A -T +# verify JSONPath.sh supports -S -A export FIZZBIN_JSON='"fizzbin"' -if ! "$JSONPATH_SH" -S -A -T -p >/dev/null 2>&1; then - echo "$0: FATAL: JSONPath.sh tool does not support -S -A -T: $FIZZBIN_JSON" 1>&2 +if ! "$JSONPATH_SH" -S -A -p >/dev/null 2>&1; then + echo "$0: FATAL: JSONPath.sh tool does not support -S -A: $FIZZBIN_JSON" 1>&2 echo "$0: notice: we recommend you obtain and install JSONPath.sh from: $JSONPATH_REPO" 1>&2 exit 5 fi <<< "$FIZZBIN_JSON"