From 2a7fb091abed06d79bad789b62333e3bbfeef6bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Wo=C5=BAniak?= Date: Sat, 3 Dec 2022 19:49:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=96=20update=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 30 ++++++---- docs/list-all-restaurants.md | 108 +++++++++++++++++++++++++++++++++++ docs/random.md | 72 +++++++++++++++++++++++ what_to_eat/main.py | 2 +- 4 files changed, 200 insertions(+), 12 deletions(-) create mode 100644 docs/list-all-restaurants.md create mode 100644 docs/random.md diff --git a/README.md b/README.md index 2cffa12..813e8d4 100644 --- a/README.md +++ b/README.md @@ -44,17 +44,17 @@ $ what-to-eat --help Usage: what-to-eat [OPTIONS] COMMAND [ARGS]... -╭─ Options ────────────────────────────────────────────────────────────────────╮ -│ --install-completion Install completion for the current shell. │ -│ --show-completion Show completion for the current shell, to copy │ -│ it or customize the installation. │ -│ --help Show this message and exit. │ -╰──────────────────────────────────────────────────────────────────────────────╯ -╭─ Commands ───────────────────────────────────────────────────────────────────╮ -│ configure Create configuration file to your orders │ -│ ls Finds best restaurants via Wolt API │ -│ random Finds random restaurant via Wolt API │ -╰──────────────────────────────────────────────────────────────────────────────╯ +╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ --version -v │ +│ --install-completion Install completion for the current shell. │ +│ --show-completion Show completion for the current shell, to copy it or customize the installation. │ +│ --help Show this message and exit. │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─ Commands ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ configure Create configuration file to your orders │ +│ ls List restaurants queried from Wolt API. │ +│ random Finds random restaurant via Wolt API │ +╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ``` @@ -155,6 +155,14 @@ You can select one of the following techniques: - `delivery_time` - the restaurant will be selected based on the delivery time. - `random` - the restaurant will be selected randomly. +

📖 Documentation

+ +| Documentation | Command | Options | +|-----------------------------------------------------------|-----------------------|--------------------------------------------------------| +| [🚀 List all restaurants](./docs/list-all-restaurants.md) | `what-to-eat ls` | `query`, `profile`, `tag`, `sort`, `ordering`, `limit` | +| [🎲 Random restaurant](./docs/random.md) | `what-to-eat random` | `profile`, `tag`, `technique` | +| 👤 Configure profile | `what-to-eat config` | | +

📚 License

This project is licensed under the terms of the MIT license. diff --git a/docs/list-all-restaurants.md b/docs/list-all-restaurants.md new file mode 100644 index 0000000..1d4bbef --- /dev/null +++ b/docs/list-all-restaurants.md @@ -0,0 +1,108 @@ +

📖 Documentation: List all restaurants

+ +Command manual: + +```console +$ what-to-eat ls --help + + Usage: what-to-eat ls [OPTIONS] [RESTAURANT] + + List restaurants queried from Wolt API. + +╭─ Arguments ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ restaurant [RESTAURANT] Restaurant name [default: None] │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ +╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ --query -q TEXT Query search for restaurants [default: None] │ +│ --profile -p TEXT Profile name [default: None] │ +│ --tag -t TEXT Tag [default: None] │ +│ --sort -s [none|restaurant|address|delivery_cost|estimate_time|rating|price] Sort by: none, restaurant, address, delivery_cost, estimate_time, rating, price │ +│ [default: Sort.NONE] │ +│ --ordering -o [asc|desc] Ordering: asc, desc [default: Ordering.ASC] │ +│ --limit -l INTEGER Limit results [default: None] │ +│ --help Show this message and exit. │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ + +``` + +By default your first profile is `default` one. But while listing restaurants you can change it using `profile` option: + +```console +$ what-to-eat ls --profile work +``` + +You can query restaurants by name using `query` option and limit the number of results using `limit` option: + +```console +$ what-to-eat ls --query pizza --limit 3 +┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ No. ┃ Restaurant ┃ Address ┃ Estimate time ┃ Delivery cost ┃ Rating ┃ Price ┃ Tags ┃ +┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━┩ +│ 1 │ Pizza Royal │ Chełmońskiego 11 │ 50 - 60 min │ 9.99 PLN │ 8.2 │ 💰💰 │ Pizza, Italian │ +│ 2 │ N'Pizza │ Ul. Rajska 3/lok. 2 │ 30 - 40 min │ 2.49 PLN │ 9.2 │ 💰💰 │ Italian, Pizza, European │ +│ 3 │ Nonna Maria Pizza Napoletana │ Dajwór 9 │ 25 - 35 min │ 2.49 PLN │ 9.2 │ 💰💰 │ Italian, Pizza │ +└─────┴──────────────────────────────┴─────────────────────┴───────────────┴───────────────┴────────┴───────┴──────────────────────────┘ + 🍿 Restaurants in Kraków via wolt 🍿 + +``` + +Another cool feature is to list restaurants by tags. You can use `--tag` (or `-t`) option to filter restaurants by tags: + +```console +$ what-to-eat ls --tag kebab --limit 3 +┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ No. ┃ Restaurant ┃ Address ┃ Estimate time ┃ Delivery cost ┃ Rating ┃ Price ┃ Tags ┃ +┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ +│ 1 │ Berlin Döner Kebap Galeria Krakowska │ Pawia 5 │ 25 - 35 min │ 2.49 PLN │ 8.2 │ 💰 │ Doner, Kebab, Middle eastern │ +│ 2 │ Vegab │ Starowiślna 8 │ 25 - 35 min │ 2.49 PLN │ 9.2 │ 💰💰 │ Bowl, Kebab, Vegan │ +│ 3 │ Kebaber Starowiślna 8 │ Starowiślna 8 │ 20 - 30 min │ 2.49 PLN │ 8.8 │ 💰 │ Kebab, Turkish │ +└─────┴──────────────────────────────────────┴───────────────┴───────────────┴───────────────┴────────┴───────┴──────────────────────────────┘ + 🍿 Restaurants in Kraków via wolt 🍿 + +``` + +By using sorting options you can sort restaurants by name, rating, price, delivery cost and delivery time and chose order (ascending or descending): + +```console +$ what-to-eat ls --sort rating --ordering desc --limit 3 +┏━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ No. ┃ Restaurant ┃ Address ┃ Estimate time ┃ Delivery cost ┃ Rating ┃ Price ┃ Tags ┃ +┡━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━╇━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━┩ +│ 1 │ Cukiernia Czarodziej │ Karmelicka 15 │ 20 - 30 min │ (No delivery) │ 10.0 │ 💰💰 │ Ice cream │ +│ 2 │ MARLIN - Fish & Chips - Smażalnie Rybne │ Krowoderskich Zuchów 21A │ 45 - 55 min │ (No delivery) │ 9.8 │ 💰💰 │ Fish, Mediterranean │ +│ 3 │ Baqaro - Rakowicka │ Rakowicka 11 │ 25 - 35 min │ 2.49 PLN │ 9.8 │ 💰💰 │ Italian, Pinsa, Pizza │ +└─────┴─────────────────────────────────────────┴──────────────────────────┴───────────────┴───────────────┴────────┴───────┴───────────────────────┘ + 🍿 Restaurants in Kraków via wolt 🍿 + +``` + +You can also display restaurant details by using `ls` command with restaurant name: + +```console +$ what-to-eat ls poco +┏━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ 🍕 Poco Loco Czysta ┃ Kraków, Ul. Czysta 9 🍕 ┃ +┡━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ +│ Rating │ Excellent (9 / 200 reviews) │ +│ Price │ 💰💰 │ +│ Opening time │ 12:00 - 23:00 │ +│ Website │ https://wolt.com/pl/pol/krakow/restaurant/poco-loco │ +│ Phone │ +48 690800805 │ +│ Estimates │ 35 minutes │ +│ Payment Methods │ Card │ +│ Description │ Zdrowa i lekka kuchnia meksykańska w nowej odsłonie... │ +│ Tags │ Mexican, Taco, Latin american │ +└─────────────────────┴────────────────────────────────────────────────────────┘ +``` + +

⚙️ Options

+ + +| Option | Description | Example usage | +|--------------------|----------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------| +| `--query`, `-q` | Command used to query restaurants by `Restaurant Name`, `Address` and `Tags`. Query search is case insensitive. | `what-to-eat ls -q pizza` | +| `--profile`, `-p` | Command used to set profile while listing restaurants. By default the `default` profile is used. | `what-to-eat ls -p work` | +| `--tag`, `-t` | Command used to search restaurants by `Tags`. Searching is case insensitive. | `what-to-eat ls -t italian` | +| `--sort`, `-s` | Command used to sort restaurants by one of following fields: `restaurant, address, delivery_cost, estimate_time, rating, price`. | `what-to-eat ls -s rating` | +| `--ordering`, `-o` | Command used to order restaurants ascending or descending by field specified in `--sort` option. | `what-to-eat ls -s rating --ordering desc` | +| `--limit`, `-l` | Command used to limit result to specified number of restaurants. | `what-to-eat ls -l 5` | diff --git a/docs/random.md b/docs/random.md new file mode 100644 index 0000000..ae2aae8 --- /dev/null +++ b/docs/random.md @@ -0,0 +1,72 @@ +

📖 Documentation: Random restaurant

+ +Command manual: + +```console +$ what-to-eat random --help + + Usage: what-to-eat random [OPTIONS] + + Finds random restaurant via Wolt API + +╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ +│ --profile -p TEXT Profile name [default: None] │ +│ --tag -t TEXT Tag [default: None] │ +│ --technique [delivery_price|-delivery_price|rating|-rating|mix|-mix|random] Technique: delivery_price, -delivery_price, rating, -rating, mix, -mix, random │ +│ [default: EvaluateTechnique.MIX] │ +│ --help Show this message and exit. │ +╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ + +``` + +Random restaurant draw is a command that allows you to find a random restaurant from the list of restaurants available in your localization. The basic command is as follows: + +```console +$ what-to-eat random +┏━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ 🍕 Krowarzywa Kraków ┃ Kraków, ul. Sławkowska 8 🍕 ┃ +┡━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┩ +│ Rating │ Excellent (8 / 100 reviews) │ +│ Price │ 💰 │ +│ Opening time │ 11:00 - 00:00 │ +│ Website │ https://wolt.com/pl/pol/krakow/restaurant/krowarzywa-krakow-slawkowska │ +│ Phone │ +48 531777136 │ +│ Estimates │ 40 minutes │ +│ Payment Methods │ Card │ +│ Description │ W naszych restauracjach dostaniesz wyśmienite wegańskie burg... │ +│ Tags │ Burger, Vegetarian, Veggie burger, Vegan, Kebab, Wrap, Plant-based, Healthy │ +└──────────────────────┴─────────────────────────────────────────────────────────────────────────────┘ + +``` + +By default the command uses the `mix` technique, which means that the restaurant is selected based on the rating and delivery price. The `mix` technique is the default one, but you can change it by using the `--technique` option. +The `--technique` option allows you to select one of the following techniques: + + * `delivery_price` - the restaurant with the lowest delivery price is selected + * `-delivery_price` - the restaurant with the highest delivery price is selected + * `rating` - the restaurant with the highest rating is selected + * `-rating` - the restaurant with the lowest rating is selected + * `mix` - the restaurant is selected based on the rating and delivery price + * `-mix` - the restaurant is selected based on the rating and delivery price + * `random` - the restaurant is selected totally randomly + +The `mix` technique is the default one, but you can change it by using the `--technique` option: + +```console +$ what-to-eat random --technique delivery_price +``` + +While randomly drawing restaurants you can limit possible results by using specified tag option: +```console +$ what-to-eat random --tag pizza +``` + +The following command will draw a random restaurant from the list of restaurants available in your localization, but only those that have the `pizza` tag. + +

⚙️ Options

+ +| Option | Description | Example usage | +|-------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------| +| `--profile`, `-p` | Option used to set profile while drawing restaurants. By default the `default` profile is used. | `what-to-eat random -p work` | +| `--tag`, `-t` | Option used to is used to filter restaurants by their tags while drawing restaurant. Searching is case insensitive. | `what-to-eat random -t italian` | +| `--techique` | Option is used to select the technique used to draw a random restaurant. The following techniques are available: `delivery_price, -delivery_price, rating, -rating, mix, -mix, random` | `what-to-eat random --technique random` | diff --git a/what_to_eat/main.py b/what_to_eat/main.py index 5e3b621..ef3afe8 100644 --- a/what_to_eat/main.py +++ b/what_to_eat/main.py @@ -53,7 +53,7 @@ def ls( ), limit: Optional[int] = typer.Option(None, "--limit", "-l", help="Limit results"), # noqa: U007 ) -> None: - """Finds best restaurants via Wolt API""" + """List restaurants queried from Wolt API.""" profile = find_profile(profile_name) with Progress( SpinnerColumn(),