Compare commits
2 Commits
e05b4fda3a
...
8fba85e60e
Author | SHA1 | Date |
---|---|---|
ida schmidt | 8fba85e60e | |
ida schmidt | d49b9f3866 |
22
pizza.sh
22
pizza.sh
|
@ -22,7 +22,6 @@ 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
|
||||
}
|
||||
|
@ -32,7 +31,7 @@ if [ -a "${XDG_CONFIG_HOME}/pizzacalc/conf" ]; then
|
|||
elif [ -a "$HOME/.config/pizzacalc/conf" ]; then
|
||||
ALTPIZZA="${HOME}/.config/pizzacalc/conf"
|
||||
else
|
||||
ALTPIZZA=/dev/null
|
||||
ALTPIZZA=-
|
||||
fi
|
||||
|
||||
function pizzarecipe {
|
||||
|
@ -72,7 +71,6 @@ 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
|
||||
|
@ -106,7 +104,19 @@ case $1 in # this parses the first argument (and actually calls our main functio
|
|||
panarea;;
|
||||
*)
|
||||
read -p "Diameter of pan (in inches): " WIDTH
|
||||
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;;
|
||||
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
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue