CookCLI
CookCLI copied to clipboard
Sync shopping list
Possibly more of a question.
In my setup, I cook server
from a raspberry pi, then tailscale serve
that to my other devices.
If I add a recipe to my shopping list on one device, it doesn't show up on the shopping list of a different device. I assume the list is stored locally in the browser, or something.
Is this possible to achieve? Please let me know if there is more info I can share to assist.
Yes, as of now the shopping list is stored in browser's local storage, not on a server. That's an interesting use-case, I don't mind changing CLI to store the shopping list on server side, but I don't have time at the moment to do that.
OK cool, good to know!
I might give it a try, but I don't know Rust yet. Would you store the shopping list in/next to config
in the recipes folder, or somewhere else entirely?
This is what I'm using as a workaround for now, quite happy with it!
Read all recipes from my Obsidian vault (can be anywhere though), fzf
the ones to create a shopping list for, then pipe those into a file in Markdown format:
function cook-sl
set ingredients $(
# Get all recipes from vault
find ~/obsidian/Recipes/*.cook \
# fzf, showing just the basename as a label, with a cooklang preview on the side
| fzf --delimiter / --with-nth 6 --multi --preview "cook recipe {}" \
# Send those chosen recipes to `cook`, with the given aisle config
| xargs -d "\n" cook shopping-list --aisle ~/obsidian/Recipes/config/aisle.conf
)
for ingredient in $ingredients
# Lines starting with [ are aisle groupings
if test $(string sub -l 1 $ingredient) = '['
echo ""
echo "**$( string sub -s 2 -e -1 $ingredient )**"
echo ""
else
echo "- [ ] $ingredient"
end
# Pipe echos into shopping list, overwriting the file
end >~/obsidian/Recipes/Shopping\ List.md
echo "Shopping list updated"
end
Cool, that's smart!