Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync shopping list #103

Open
SkepticMystic opened this issue Feb 28, 2024 · 4 comments
Open

Sync shopping list #103

SkepticMystic opened this issue Feb 28, 2024 · 4 comments

Comments

@SkepticMystic
Copy link

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.

@dubadub
Copy link
Member

dubadub commented Feb 28, 2024

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.

@SkepticMystic
Copy link
Author

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?

@SkepticMystic
Copy link
Author

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

@dubadub
Copy link
Member

dubadub commented Mar 10, 2024

Cool, that's smart!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants