aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkaotisk <kaotisk@arching-kaos.org>2022-09-07 00:52:16 +0300
committerkaotisk <kaotisk@arching-kaos.org>2022-09-07 00:52:16 +0300
commit581d4a14cda6b84a1d0b5bd8a5d40d58f93b554a (patch)
tree34adeb76305f1adc96132db60839d32ecdaf943a
parent7bb430f171a456a0eb7332886b6cfae0f0737ac9 (diff)
downloadarching-kaos-tools-581d4a14cda6b84a1d0b5bd8a5d40d58f93b554a.tar.gz
arching-kaos-tools-581d4a14cda6b84a1d0b5bd8a5d40d58f93b554a.tar.bz2
arching-kaos-tools-581d4a14cda6b84a1d0b5bd8a5d40d58f93b554a.zip
Reworked logging and Usage
-rwxr-xr-xbin/pack_z_block26
1 files changed, 14 insertions, 12 deletions
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 <action> <data_file>"
+ 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