From a4e83a94b06110ac3a2b82c1061d0073e359eda8 Mon Sep 17 00:00:00 2001 From: kaotisk Date: Sun, 2 Apr 2023 19:25:12 +0300 Subject: Eliminated json_pp usage --- README | 2 -- bin/ak-config | 4 ++-- bin/ak-data-expand | 2 +- bin/ak-enter | 2 +- bin/ak-files | 2 +- bin/ak-folders | 2 +- bin/ak-get-ipfs-hashes-from-my-zchain | 2 +- bin/ak-mixtapes | 2 +- bin/ak-pack_z_block | 2 +- bin/ak-transactions | 2 +- bin/ak-zblock-manipulator | 4 ++-- bin/ak-zchain-chk | 2 +- 12 files changed, 13 insertions(+), 15 deletions(-) diff --git a/README b/README index d67c227..4dc4b8b 100644 --- a/README +++ b/README @@ -65,8 +65,6 @@ programs used are: - nodejs (v18.14) - npm (v9.5.0) -`json_pp` is also used put you cat remove it and change it with `jq` - How to install the repository ----------------------------- diff --git a/bin/ak-config b/bin/ak-config index bc06e49..b64c731 100755 --- a/bin/ak-config +++ b/bin/ak-config @@ -19,7 +19,7 @@ usage(){ show(){ echo ' { - "profile":'$(profile index | json_pp)', + "profile":'$(profile index | jq -M)', "genesis":"'$(cat $HOME/.arching-kaos/config/zgenesis)'", "gpg":"'$GPG_PUB_KEY'", "zchain":"'$(cat $HOME/.arching-kaos/config/zchain)'" @@ -27,7 +27,7 @@ show(){ } publish(){ - show | json_pp > tmpfile + show | jq -M > tmpfile ipfs name publish --key=ak-config /ipfs/$(ipfs add -q tmpfile) if [ "$?" != 0 ] then diff --git a/bin/ak-data-expand b/bin/ak-data-expand index 1799957..35f7826 100755 --- a/bin/ak-data-expand +++ b/bin/ak-data-expand @@ -17,7 +17,7 @@ then logit "[ERROR]" "Error while reading $1" exit 1 fi - ipfs --timeout=10s cat $1 | json_pp > /dev/null + ipfs --timeout=10s cat $1 | jq -M > /dev/null if [ "$?" -ne 0 ] then logit "[ERROR]" "Error while parsing JSON for $1" diff --git a/bin/ak-enter b/bin/ak-enter index c47a827..0f3b17c 100755 --- a/bin/ak-enter +++ b/bin/ak-enter @@ -114,7 +114,7 @@ do logit "[INFO]" "ZBLOCK $zblock READ" # If it's JSON formated - ipfs --timeout=10s cat $zblock | json_pp > /dev/null 2>&1 + ipfs --timeout=10s cat $zblock | jq -M > /dev/null 2>&1 if [ "$?" -ne 0 ] then logit "[ERROR]" "ZBLOCK $zblock is not JSON" diff --git a/bin/ak-files b/bin/ak-files index 923e246..9fddc60 100755 --- a/bin/ak-files +++ b/bin/ak-files @@ -45,7 +45,7 @@ add(){ CRP="$(pwd)" FILENAME="$1" main $FILENAME $CRP - cat $TEMPASSIN/data | json_pp + cat $TEMPASSIN/data | jq -M } main(){ FILENAME="$1" diff --git a/bin/ak-folders b/bin/ak-folders index 108e7ff..234592a 100755 --- a/bin/ak-folders +++ b/bin/ak-folders @@ -35,7 +35,7 @@ add(){ CRP="$(pwd)" FOLDERNAME="$1" main $FOLDERNAME $CRP - cat $TEMPASSIN/data | json_pp + cat $TEMPASSIN/data | jq -M } main(){ FOLDERNAME="$1" diff --git a/bin/ak-get-ipfs-hashes-from-my-zchain b/bin/ak-get-ipfs-hashes-from-my-zchain index db90ecb..3640cc5 100755 --- a/bin/ak-get-ipfs-hashes-from-my-zchain +++ b/bin/ak-get-ipfs-hashes-from-my-zchain @@ -1,2 +1,2 @@ #!/bin/bash -enter | json_pp | grep Qm | sed -e 's/{"zblock":"//g; s/",//; s/".*".*: "//g; s/"//g; s/{//g; s/://g; s/ //g' +enter | jq -M | grep Qm | sed -e 's/{"zblock":"//g; s/",//; s/".*".*: "//g; s/"//g; s/{//g; s/://g; s/ //g' diff --git a/bin/ak-mixtapes b/bin/ak-mixtapes index aefaf26..a40f33b 100755 --- a/bin/ak-mixtapes +++ b/bin/ak-mixtapes @@ -42,7 +42,7 @@ then MIXTAPE_TITLE="$2" MIXTAPE_FILE="$PWD/$3" main - cat $PWD/data | json_pp + cat $PWD/data | jq -M # sh pack_z_block.sh mixtape/add $PWD/data else usage fi diff --git a/bin/ak-pack_z_block b/bin/ak-pack_z_block index 59ded17..9252122 100755 --- a/bin/ak-pack_z_block +++ b/bin/ak-pack_z_block @@ -119,7 +119,7 @@ then exit 1 fi - # cat $PWD/zblock | json_pp + # cat $PWD/zblock | jq -M # Optional or extending with # python send_as_ak_tx $ZBLOCK # or for "offline" use diff --git a/bin/ak-transactions b/bin/ak-transactions index 30fd5eb..9281152 100755 --- a/bin/ak-transactions +++ b/bin/ak-transactions @@ -44,7 +44,7 @@ then TO_ADDRESS="$2" AMOUNT="$3" main - cat $PWD/data | json_pp + cat $PWD/data | jq -M # sh pack_z_block.sh mixtape/add $PWD/data else usage fi diff --git a/bin/ak-zblock-manipulator b/bin/ak-zblock-manipulator index 433ab11..6570484 100755 --- a/bin/ak-zblock-manipulator +++ b/bin/ak-zblock-manipulator @@ -115,7 +115,7 @@ then ipfs get "$BLOCK_TO_ADD" sed -i.bak -e 's/^.*previous.*$/\"previous\":\"'$PREVIOUS'\"/' $BLOCK_TO_ADD - cat $BLOCK_TO_ADD | json_pp + cat $BLOCK_TO_ADD | jq -M exit 2 else @@ -123,7 +123,7 @@ then exit 1 fi - # cat $PWD/zblock | json_pp + # cat $PWD/zblock | jq -M # Optional or extending with # python send_as_ak_tx $ZBLOCK # or for "offline" use diff --git a/bin/ak-zchain-chk b/bin/ak-zchain-chk index 3315415..a57e722 100755 --- a/bin/ak-zchain-chk +++ b/bin/ak-zchain-chk @@ -119,7 +119,7 @@ do for value in ${blocks_found[@]} do echo $value - ipfs cat $value | json_pp + ipfs cat $value | jq -M done fi exit 0 -- cgit v1.2.3