made the output look nicer
This commit is contained in:
@@ -56,6 +56,7 @@ while sleep 5; do
|
|||||||
|
|
||||||
# now that we have a list of updated receipts, we are going to process them
|
# now that we have a list of updated receipts, we are going to process them
|
||||||
for r in ${updatedreceipts}; do
|
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
|
# 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}]}' )
|
receipt=$(eval curl -XGET ${CURLOPTS} '${APIURL}/apis/de.eenfach.olbohlen/v1/namespaces/${NAMESPACE}/cookiereceipts/${receiptname[${r}]}' )
|
||||||
|
|
||||||
@@ -70,13 +71,14 @@ while sleep 5; do
|
|||||||
|
|
||||||
preheat_b=$( echo "${receipt}" | jq -r .spec.preheat )
|
preheat_b=$( echo "${receipt}" | jq -r .spec.preheat )
|
||||||
if [ "x${preheat_b}" == "xtrue" ]; then
|
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
|
fi
|
||||||
|
|
||||||
# how many ingredients do we have?
|
# how many ingredients do we have?
|
||||||
num_in=$(echo "${receipt}" | jq .spec.ingredients\[\].name | wc -l)
|
num_in=$(echo "${receipt}" | jq .spec.ingredients\[\].name | wc -l)
|
||||||
|
|
||||||
# list up that we fetch needed ingredients
|
# list up that we fetch needed ingredients
|
||||||
|
printf "Fetching ingredients from receipt:\n"
|
||||||
i=0
|
i=0
|
||||||
while [ ${i} -lt ${num_in} ]; do
|
while [ ${i} -lt ${num_in} ]; do
|
||||||
in_name=$( echo "${receipt}" | jq -r .spec.ingredients[${i}].name )
|
in_name=$( echo "${receipt}" | jq -r .spec.ingredients[${i}].name )
|
||||||
@@ -102,6 +104,7 @@ while sleep 5; do
|
|||||||
num_steps=$(echo "${receipt}" | jq .spec.steps\[\].order | wc -l)
|
num_steps=$(echo "${receipt}" | jq .spec.steps\[\].order | wc -l)
|
||||||
|
|
||||||
# now let's iterate over that
|
# now let's iterate over that
|
||||||
|
printf "Processing the instructions:\n"
|
||||||
i=1
|
i=1
|
||||||
while [ ${i} -lt ${num_steps} ]; do
|
while [ ${i} -lt ${num_steps} ]; do
|
||||||
instruction=$( echo "${receipt}" | jq '.spec.steps[] | select(.order == '${i}') | { instruction | join (" ")' )
|
instruction=$( echo "${receipt}" | jq '.spec.steps[] | select(.order == '${i}') | { instruction | join (" ")' )
|
||||||
@@ -112,6 +115,7 @@ while sleep 5; do
|
|||||||
sleep 1
|
sleep 1
|
||||||
i=$(( ${i} + 1 ))
|
i=$(( ${i} + 1 ))
|
||||||
done
|
done
|
||||||
|
printf "Done with this receipt.\n\n"
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user