Compare commits

..

No commits in common. "8fba85e60ee717755040802645c2fed90480be1e" and "e05b4fda3a60f8a5ce950f9da50289ef73d167fa" have entirely different histories.

1 changed files with 6 additions and 16 deletions

View File

@ -22,6 +22,7 @@ function pizzahelp { # this only prints help text
echo "Notes:"
echo " The dough can be kept overnight in the refidgerator if needed"
echo " Water may also be used in place of beer"
echo " When in interactive mode, -f will get overridden"
echo " Try adding your choice of spices and/or herbs into the dough for more flavor"
echo
}
@ -31,7 +32,7 @@ if [ -a "${XDG_CONFIG_HOME}/pizzacalc/conf" ]; then
elif [ -a "$HOME/.config/pizzacalc/conf" ]; then
ALTPIZZA="${HOME}/.config/pizzacalc/conf"
else
ALTPIZZA=-
ALTPIZZA=/dev/null
fi
function pizzarecipe {
@ -71,6 +72,7 @@ function panarea {
}
function arraytio { # im funny portmantaus are never bad
[ -n SIZE ] || read -p "Grams of flour: " SIZE # test ([) will send a non-zero exit code on if $SIZE doesnt exist, tripping the or (the '||')
INDEX=0
for RATIO in $(cat "$INSTDIR/pizza.txt" | cat - "$ALTPIZZA" | sed -n "/\[$RECIPE:ratios\]/,/^$/p" | tail -n +3 | cut -f 2-); do # finding [ratios] until the next blank line, removing the first two lines.
declare -a INGREDIENT # make arrays
@ -104,19 +106,7 @@ case $1 in # this parses the first argument (and actually calls our main functio
panarea;;
*)
read -p "Diameter of pan (in inches): " WIDTH
if [[ -n "$WIDTH" ]]; then
if [[ -z "$FSI" ]]; then
DFSI=$(cat "$INSTDIR/pizza.txt" | cat - "$ALTPIZZA" | grep -A 1 "\[$RECIPE:ratios\]" | tail -n -1 | cut -f 2- | xargs) # the fsi retrieved from the recipe may have whitespace preceding it, and we dont want that printed in the brackets, breaking formatting
else
DFSI="$FSI"
fi
DFSI=$(cat "$INSTDIR/pizza.txt" | cat - "$ALTPIZZA" | grep -A 1 "\[$RECIPE:ratios\]" | tail -n -1 | cut -f 2-)
read -p "Flour per square inch [$DFSI]: " FSI
panarea
else
read -p "Grams of flour: " SIZE # if the user doesnt input pan dimentions, ask for amount of flour instead
if [[ -z "$SIZE" ]]; then
exit 1
fi
arraytio
fi;;
panarea;;
esac