Pantry
The pantry
command helps you manage and analyze your pantry inventory, tracking what items are low on stock, expiring soon, or available for cooking.
Overview
Options
-b, --base-path <PATH>
- Base path for recipes and configuration files-f, --format <FORMAT>
- Output format:human
(default),json
, oryaml
-v, --verbose
- Increase verbosity (can be used multiple times)-h, --help
- Print help information
Subcommands
depleted
(alias: d
)
Shows items that are out of stock or have low quantities.
Options:
--all
- Show all items including those without quantities
How it works:
- Shows items where current quantity is at or below the defined
low
threshold - If no
low
threshold is defined, uses heuristics (≤100g/ml, ≤1 item) - Displays the low threshold for each item when available
Example:
expiring
(alias: e
)
Shows items that are expiring soon.
Options:
-d, --days <DAYS>
- Number of days to look ahead (default: 7)--include-unknown
- Include items without expiry dates
Example:
recipes
(alias: r
)
Lists recipes that can be made with items currently in pantry.
Options:
-p, --partial
- Include partial matches (recipes where most ingredients are available)--threshold <PERCENT>
- Minimum percentage of ingredients that must be available for partial matches (default: 75)
Example:
Pantry Configuration
The pantry inventory is defined in pantry.conf
(TOML format), which is searched for in:
./config/pantry.conf
- Local to recipe directory~/.config/cook/pantry.conf
- Global configuration (Linux/macOS)
Configuration Format
Item Attributes
Each pantry item can have the following optional attributes:
quantity
- Current amount (e.g., "500%ml", "2%kg", "5")low
- Threshold for low stock warning (same format as quantity)bought
- Purchase date (e.g., "2025-09-10")expire
- Expiry date (e.g., "2025-09-25")
Low Stock Threshold
The low
attribute defines when an item should be considered low on stock:
Important: Comparisons only work when units match:
- ✅
400%g
vs500%g
(both grams) - ✅
2%kg
vs1%kg
(both kilograms) - ❌
1%kg
vs500%g
(different units - no comparison)
For items without units (counts), use plain numbers:
Integration with Other Commands
Shopping List
The pantry configuration works with the shopping list command to:
- Filter out items already in stock
- Show what needs restocking based on low thresholds
Recipe Command
Recipes can reference pantry items and the system will:
- Check availability before cooking
- Warn about low stock items used in recipes
Examples
Check Low Stock Items
Monitor Expiring Items
Find Available Recipes
Different Recipe Collections
Output Formats
The pantry command supports multiple output formats for easy integration with other tools:
JSON Output Example:
YAML Output Example:
Tips
- Regular Updates: Keep your pantry.conf updated as you shop and use items
- Set Realistic Thresholds: Set
low
values based on your shopping patterns - Use Sections: Organize items by storage location (fridge, freezer, pantry, etc.)
- Track Expiry: Add expiry dates to perishables to reduce waste
- Combine with Shopping: Use
pantry depleted
output to create shopping lists - Automate with JSON/YAML: Use
-f json
or-f yaml
for scripting and automation - Integration: Parse JSON output in scripts to send notifications, generate reports, or update other systems