From 581d4a14cda6b84a1d0b5bd8a5d40d58f93b554a Mon Sep 17 00:00:00 2001 From: kaotisk Date: Wed, 7 Sep 2022 00:52:16 +0300 Subject: Reworked logging and Usage --- bin/pack_z_block | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'bin') diff --git a/bin/pack_z_block b/bin/pack_z_block index 4ed9ab7..b166463 100755 --- a/bin/pack_z_block +++ b/bin/pack_z_block @@ -14,20 +14,27 @@ # The following example finds kaos@kaos.kaos' GPG fingerprint like this # FINGERPRINT="$(gpg2 --list-keys | grep kaos@kaos.kaos -1 | head -n1 | awk '{print $1}')" +PROGRAM="pack_z_block" + # Below, the usage information usage(){ - title - echo "$0 - action data_file" - echo "Creates and publishes a ZBLOCK based on ACTION and DATA file." echo "" - echo "action An action for the render to grasp" - echo "data_file A data file that according to the action is valid" + echo "Usage:" + echo "$PROGRAM " + echo "" + echo " Creates and publishes a ZBLOCK based on ACTION and DATA file." + echo "" + echo " action An action for the render to grasp" + echo " data_file A data file that according to the action is valid" echo "" + echo "#TODO:" + echo "implement flags to change the inputs so we can manufacture" + echo "zblocks directly from IPFS hashes refering to blocks." } main(){ - logthis "We are doing" $ACTION "with content" $MESSAGE + logthis "[INFO]" "We are doing" $ACTION "with content" $MESSAGE # We add it to IPFS MESSAGE_HASH=$(ipfs add -q $MESSAGE) @@ -81,11 +88,6 @@ EOF echo $ZBLOCK } -title(){ - echo "AK zblock creator" - echo "=================" -} - if [ ! -z $2 ]; then PWD="$(pwd)" @@ -94,7 +96,7 @@ then if [ -f "$MESSAGE" ]; then main else - logthis "File does not exist. Aborting..." + logthis "[ERROR]" "File does not exist. Aborting..." exit 1 fi -- cgit v1.2.3