cmdiet is a terminal app for logging what you eat without leaving your keyboard. It saves entries in a small SQLite file and opens simple on-screen prompts to add meals, review weeks, and glance at trends. The rich terminal UI is powered by Bubble Tea, so all flows feel smooth and familiar to Go developers who love text interfaces.
- Log breakfast, lunch, dinner, or snacks with a short guided flow.
- Revisit any recent week, jump by day offsets, or open a focused view of today.
- Keep a meal catalog, tune the nutrition numbers, and reuse meals in later logs.
- Draw quick charts of calories, protein, carbs, or fat to spot patterns.
- Spin up a fake dataset for demos or testing without touching your real log.
- Go 1.22 or newer.
- A macOS, Linux, or Windows terminal that can run Go programs.
Go will pull every other dependency automatically the first time you run the app.
- Clone this repo and move into it.
- Run
go run .once to download modules and set up the database. - A new
diet.dbfile appears in the project folder; it holds your real data.
Build a reusable binary if you prefer:
go build -o cmdiet
./cmdiet --helpgo run . log breakfastPick an existing meal or type a new one. cmdiet blocks duplicate entries for the same meal type on the same day and timestamps the log for you.
Use --pdays (or -d) if you need to backfill a past day, for example:
go run . log lunch --pdays 1go run . view today
go run . view --offset 14The first command opens today's breakdown. The second shows the last 14 days and lets you move backward or forward with the arrow keys.
go run . eval caloriesSwap calories for protein, carbs, or fat to focus on a different macro. Press the keys shown on screen to switch between chart styles.
go run . meals list-meals
go run . meals add-meal
go run . meals list-components
go run . meals add-component --fixedThese screens manage the meals and components you reuse when logging food. Edits update future logs right away.
Use the --fake flag to point the app at fake.db, then populate it with sample rows:
go run . --fake populate meals
go run . --fake populate dietsSwitch back to your real log by dropping the --fake flag.
diet.db: your everyday log in SQLite form.fake.db: optional sandbox database created when you use--fake.commands/: code that wires up the terminal commands and flags.ui/: terminal screen logic for the interactive views.meals/anddiet/: data access helpers and validation rules.
- Run
go test ./...to make sure the services still behave. - Run
go run . --helpto see every command and flag. - Temporary logs from the UI live in
tea.log; delete it whenever you like.