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 "Notes:"
echo " The dough can be kept overnight in the refidgerator if needed" echo " The dough can be kept overnight in the refidgerator if needed"
echo " Water may also be used in place of beer" 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 " Try adding your choice of spices and/or herbs into the dough for more flavor"
echo echo
} }
@ -31,7 +32,7 @@ if [ -a "${XDG_CONFIG_HOME}/pizzacalc/conf" ]; then
elif [ -a "$HOME/.config/pizzacalc/conf" ]; then elif [ -a "$HOME/.config/pizzacalc/conf" ]; then
ALTPIZZA="${HOME}/.config/pizzacalc/conf" ALTPIZZA="${HOME}/.config/pizzacalc/conf"
else else
ALTPIZZA=- ALTPIZZA=/dev/null
fi fi
function pizzarecipe { function pizzarecipe {
@ -71,6 +72,7 @@ function panarea {
} }
function arraytio { # im funny portmantaus are never bad 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 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. 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 declare -a INGREDIENT # make arrays
@ -104,19 +106,7 @@ case $1 in # this parses the first argument (and actually calls our main functio
panarea;; panarea;;
*) *)
read -p "Diameter of pan (in inches): " WIDTH read -p "Diameter of pan (in inches): " WIDTH
if [[ -n "$WIDTH" ]]; then DFSI=$(cat "$INSTDIR/pizza.txt" | cat - "$ALTPIZZA" | grep -A 1 "\[$RECIPE:ratios\]" | tail -n -1 | cut -f 2-)
if [[ -z "$FSI" ]]; then read -p "Flour per square inch [$DFSI]: " FSI
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 panarea;;
else
DFSI="$FSI"
fi
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;;
esac esac