Discussion: accept `pantry.toml` as the pantry file name (keeping `pantry.conf`)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 25/100
Direzione di ricerca
Start with crates/core/src/context.rs and the pantry edit path at crates/core/src/pantry/mod.rs:1142; inspect how Context::discover and Context::search find pantry files. The proposal is still under discussion, with compatibility questions about other apps and older CookCLI versions unresolved, so first determine whether the change is agreed before attempting implementation.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
This is a proposal for discussion, not a decided change. Comments are welcome, especially from anyone who maintains another app that reads the pantry file.
Background
A recipe folder can hold two hand-written config files side by side, in two different formats:
| File | Format | Comments |
|---|---|---|
config/aisle.conf |
Cooklang's own format ([aisle], then name | synonym) |
// |
config/pantry.conf |
TOML | # |
Both end in .conf, so nothing tells you which one is which. #687 (reported on Discord) is the result: someone wrote # comments in aisle.conf, the way pantry.conf beside it takes them, and they became ingredients. #688 now warns about those lines, but the cause is still there. The same confusion works in reverse: // note or -- note in pantry.conf is a TOML error, and the web shopping list then ignores the whole pantry.
The spec's conventions.md says the pantry file is TOML, but it doesn't name the file. pantry.conf is a CookCLI convention.
Proposal
Accept pantry.toml as the pantry file's name, and keep reading pantry.conf:
- Look for
pantry.tomlfirst, thenpantry.conf, in./config/and in the global config dir (COOK_CONFIG_DIR,~/.config/cook/, …). All lookups go throughContext::discover/Context::searchincrates/core/src/context.rs, so this is mostly one place. - If both exist, use
pantry.toml.cook doctor pantryand the/pantrypage say thatpantry.confis being ignored. - Edits (the CLI and the
/pantrypage) go back to the file that was read, whatever its name. - When there is no pantry yet, the first edit creates
config/pantry.tomlinstead ofconfig/pantry.conf(crates/core/src/pantry/mod.rs:1142). The exception is if another app turns out to look forpantry.confby name (question 1): then new pantries staypantry.confuntil those apps read both names. Otherwise, new users would still get the two.conffiles side by side. - Docs, README and help texts say "
pantry.toml(orpantry.conf)".
aisle.conf keeps its name and its format. With pantry.toml next to it, the different extensions show that the two files have different formats.
Questions
- Does anything else look for
config/pantry.confby name? For example the Cook mobile apps, cook.md, or the sync service. If one does and a user renames the file, that app loses the pantry without saying why. This is the main question; if the answer is yes, those apps need to readpantry.tomltoo before CookCLI creates it. - Is it worth it? About 60 files on main mention
pantry.conf(tests, docs, the 9 locales, core, server). The alternative is to keep the name and rely on documentation plus the #688-style warnings. - Should the spec name the files?
conventions.mdcould say "pantry.toml(formerlypantry.conf)", so that every app agrees. - When should new pantries become
pantry.toml? Right away, or after one release that reads both names, so that an oldercookon the same folder still finds the pantry?
Not part of this proposal: changing the aisle.conf format. That needs the spec and cooklang-rs, and was option 3 in #687.
- Lingua principale
- Rust
- Stelle
- 1.4k
- Fork
- 120
- Merge medio
- 1g 20h
- PR unite (30g)
- 116
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di cooklang/cookcli
-
Editor save status and save errors are in English whatever the site's languageForse già presa @LeMyst l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 38/100
I maintainer di solito rispondono entro 1 giorno
-
Shopping list counts a recipe twice when three or more menus reference each other in a ringForse già presa @LeMyst l’ha presa 2 giorni fa. Aperta
Difficoltà 4/5 3-5 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
feat(server): tag pages, so a recipe can belong to several collectionsForse già presa @LeMyst l’ha presa 4 giorni fa. Apertaarea: server feature request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
wontfix
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
cooklang/cookcli#784 · 4 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di cooklang/cookcli
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
yunfie-twitter/Palleria#474 ·
I maintainer di solito rispondono entro 1 giorno
-
good first issue help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
servo/rust-smallvec#827 ·
I maintainer di solito rispondono entro 1 giorno