Add usage information to README.

This commit is contained in:
Nicolás A. Ortega Froysa 2024-10-21 14:58:48 +02:00
parent f68a8b45a5
commit 0b348e8c10

136
README.md
View File

@ -1,11 +1,139 @@
# Menu Helper
# Menu-Helper
A program to manage a database of recipes and help you to pick out meals based
on filters of ingredients and tags.
## Usage
Ensure the `XDG_DATA_HOME` variable is set (e.g. to `$HOME/.local/share`).
Ensure the `XDG_DATA_HOME` variable is set (e.g. to `$HOME/.local/share`) and
that you have installed the SQLite3 library.
Upon first execution of any command, the program will automatically create the
database.
### Adding New Recipes
The first thing you're probably going to want to do is to add a new recipe to
your database. If this database hasn't been created already then the program
will do it automatically. This is done via the `add` subcommand, which will
query you about the different attributes you want for your recipe, looking
something like the following:
```console
$ menu-helper add
Name: Linguine Scampi
Description: A lemony Italian pasta dish.
Ingredients (comma separated): linguine,shrimp,garlic,parsley,lemon
Tags (comma separated): italian,lunch
Creating database in /home/nicolas/.local/share/menu-helper/recipes.db
```
This will have created your recipe within the database. That last line there is
merely informative, telling you that the database did not exist and it is not
being created; if you had a database already and it isn't being found, ensure
that your `XDG_DATA_HOME` environment variable is properly set.
### Querying Recipes
#### Filtering
Once a recipe or two have been added to your database you may now query them
filtering based on ingredients and tags. This is done via the `list` command,
which takes two kinds of arguments, both optional:
- `-i <list>`: Comma-separated list of the ingredients to look for.
- `-t <list>`: Comma-separated list of the tags to look for.
If neither is specified then all recipes will be listed with their respective
ID, name, and description:
```console
$ menu-helper list
1 | Linguine Scampi | A lemony Italian pasta dish.
2 | Garlic Soup | A simple monastic soup for cold winters.
```
However, when one of these arguments is used it filters recipes to only show
those which include __all__ the ingredients and tags specified:
```console
$ menu-helper list -i linguine
1 | Linguine Scampi | A lemony Italian pasta dish.
```
#### Recipe Information
The IDs shown in the queries above now become useful for the rest of
Menu-Helper functionality. If you wish to query all stored information about a
given recipe, this is where you can use the `info` subcommand with the relevant
ID:
```console
$ menu-helper info 2
Name: Garlic Soup
Description: A simple monastic soup for cold winters.
ID: 2
Ingredients:
- garlic
- bread
- egg
Tags:
- soup
- dinner
- simple
```
### Removing Recipes
If you end up desiring to remove a recipe for whatever reason, you can do so by
using the `del` subcommand with the recipe's corresponding ID:
```console
$ menu-helper del 2
$ menu-helper list
1 | Linguine Scampi | A lemony Italian pasta dish.
```
### Modifying Recipe Ingredients/Tags
If there are ingredients/tags which you forgot to add to a recipe, or that you
added erringly, you can correct this with the following commands:
- `add-ingr <id> <list>`: Add list of comma-separated ingredients `list` to
recipe with ID `id`.
- `rm-ingr <id> <list>`: Remove list of comma-separated ingredients `list` from
recipe with ID `id`.
- `add-tag <id> <list>`: Add list of comma-separated tags `list` to recipe with
ID `id`.
- `rm-tag <id> <list>`: Remove list of comma-separated tags `list` from recipe
with ID `id`.
For example, we forgot to add the useful tag to our first recipe (Linguine
Scampi) that it is a pasta dish. We can do this with the following command:
```console
$ menu-helper add-tag 1 pasta
$ menu-helper info 1
Name: Linguine Scampi
Description: A lemony Italian pasta dish.
ID: 1
Ingredients:
- linguine
- shrimp
- garlic
- parsley
- lemon
Tags:
- italian
- lunch
- pasta
```
## Building
@ -15,7 +143,9 @@ To build the program you will require the following dependencies:
- SQLite3 C/C++ library
- Make
Once installed, compile the project with the `make` command.
Once installed, compile the project with the `make` command. To install simply
run the `make install` command, optionally appending `PREFIX=...` to change the
default directory of installation (i.e. `/usr/local/...`).
## Contributing