From b6d772f47ffa47249a445f199b88c3f324eadd76 Mon Sep 17 00:00:00 2001
From: Olaf Bohlen <olbohlen@eenfach.de>
Date: Mon, 02 Jan 2023 13:11:33 +0100
Subject: [PATCH] made the output look nicer

---
 receipt-processor.ksh |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/receipt-processor.ksh b/receipt-processor.ksh
index 0179d0d..2e961d6 100644
--- a/receipt-processor.ksh
+++ b/receipt-processor.ksh
@@ -56,6 +56,7 @@
 
     # now that we have a list of updated receipts, we are going to process them
     for r in ${updatedreceipts}; do
+	printf "\n\nNew receipt found: %s\n" "${receiptname[${r}]}"
 	# get the name for the UID and fetch only that object
 	receipt=$(eval curl -XGET ${CURLOPTS} '${APIURL}/apis/de.eenfach.olbohlen/v1/namespaces/${NAMESPACE}/cookiereceipts/${receiptname[${r}]}' )
 
@@ -70,13 +71,14 @@
 	
 	preheat_b=$( echo "${receipt}" | jq -r .spec.preheat )
 	if [ "x${preheat_b}" == "xtrue" ]; then
-	    printf "Pre: we heat up the oven to %s degrees %s\n" "${temperature}" "${scale:-Celsius}"
+	    printf "Pre: we heat up the oven to %s degrees %s\n\n" "${temperature}" "${scale:-Celsius}"
 	fi
 
 	# how many ingredients do we have?
 	num_in=$(echo "${receipt}" | jq .spec.ingredients\[\].name | wc -l)
-
+	
 	# list up that we fetch needed ingredients
+	printf "Fetching ingredients from receipt:\n"
 	i=0
 	while [ ${i} -lt ${num_in} ]; do
 	    in_name=$( echo "${receipt}" | jq -r .spec.ingredients[${i}].name )
@@ -102,6 +104,7 @@
 	num_steps=$(echo "${receipt}" | jq .spec.steps\[\].order | wc -l)
 
 	# now let's iterate over that
+	printf "Processing the instructions:\n"
 	i=1
 	while [ ${i} -lt ${num_steps} ]; do
 	    instruction=$( echo "${receipt}" | jq '.spec.steps[] | select(.order == '${i}') | { instruction | join (" ")' )
@@ -112,6 +115,7 @@
 	    sleep 1
 	    i=$(( ${i} + 1 ))
 	done
+	printf "Done with this receipt.\n\n"
     done
 done
     

--
Gitblit v1.9.3