Skip to content

feat(shopping-list): add --extra for items no recipe calls for - #457

Merged
dubadub merged 1 commit into
cooklang:mainfrom
ChrisJr404:shopping-list-extra-items
Aug 23, 2026
Merged

feat(shopping-list): add --extra for items no recipe calls for#457
dubadub merged 1 commit into
cooklang:mainfrom
ChrisJr404:shopping-list-extra-items

Conversation

@ChrisJr404

Copy link
Copy Markdown
Contributor

This adds a --extra flag to cook shopping-list so you can drop items no recipe calls for onto the same list — the paper towels and bin bags from #175.

Each --extra value is a Cooklang ingredient written without the leading @: a bare name like --extra "paper towels" for something with no amount, or the brace form (--extra "eggs{12}", --extra "flour{200%g}") when you want one. Repeat the flag per item. I leaned on cooklang's own ingredient parsing here rather than inventing a second little quantity syntax, so amounts and units behave exactly the way they do in a recipe, and a stray @ typed out of habit is tolerated instead of doubled into the name.

Extra items are aggregated with the recipe ingredients rather than kept in a section of their own, which felt like the least surprising behaviour: an extra that shares a name with something a recipe already needs merges into it, gets grouped into its aisle category, and is subtracted from by the pantry — the same path every ingredient already takes.

The field lives on GenerateRequest in cookcli-core and defaults to empty, so existing callers are unaffected; the CLI just passes the flag through. Tests cover the bare, multi-word and quantified cases, merging with a matching recipe ingredient, aisle grouping, pantry subtraction, the tolerated @, and the error for an empty entry. Docs updated in docs/shopping-list.md.

Closes #175

Adds a repeatable --extra flag to `cook shopping-list` for the paper
towels and bin bags that belong on the same shopping trip but that no
recipe asks for. Each value is a Cooklang ingredient written without the
leading @: a bare name for something with no amount, or the brace form
(eggs{12}, flour{200%g}) to give one.

Extra items are aggregated with the recipe ingredients rather than kept
apart, so one that shares a name with an ingredient a recipe already
needs merges into it, lands in its aisle category, and is subtracted
from by the pantry.

Closes cooklang#175
@dubadub

dubadub commented Aug 22, 2026

Copy link
Copy Markdown
Member

Nice! Thank you

@dubadub
dubadub merged commit edab519 into cooklang:main Aug 23, 2026
6 checks passed
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

Successfully merging this pull request may close these issues.

Add custom items to shopping lists

2 participants