mensa/README.md

151 lines
3.5 KiB
Markdown
Raw Permalink Normal View History

2022-06-26 16:01:41 +02:00
<img src="https://raw.githubusercontent.com/MalteT/mensa/main/static/logo.png" alt="mensa CLI logo" width="400" align="right">
2021-10-19 16:50:18 +02:00
2021-10-17 14:41:49 +02:00
[![tests](https://github.com/MalteT/mensa/actions/workflows/rust.yml/badge.svg)](https://github.com/MalteT/mensa/actions/workflows/rust.yml)
2021-10-24 17:16:49 +02:00
2021-10-17 13:06:19 +02:00
# mensa
2020-01-29 17:52:40 +01:00
2021-10-17 22:49:46 +02:00
CLI tool to query the menu of canteens contained in the
[OpenMensa](https://openmensa.org) database.
2019-04-11 17:40:04 +02:00
2021-10-17 13:06:19 +02:00
## Features
2019-04-11 17:40:04 +02:00
2021-10-19 16:10:59 +02:00
- [X] Runs on Linux, macOS and Windows.
2021-10-17 13:06:19 +02:00
- [X] Custom filters and favourites using CLI flags or the
optional configuration file.
- [X] List canteens close to you based on GeoIP.
2021-10-14 10:10:42 +02:00
- [X] All request are cached locally.
2021-10-17 13:06:19 +02:00
- [X] Fuzzy date parsing based on
[date_time_parser](https://lib.rs/crates/date_time_parser).
2021-10-24 17:16:49 +02:00
- [X] List your favourite meals in canteens close to your location.
- [X] JSON Output
2021-10-24 19:33:49 +02:00
![example](https://raw.githubusercontent.com/MalteT/mensa/main/static/example-collection.png)
2019-04-11 17:40:04 +02:00
2021-10-19 16:10:59 +02:00
2021-10-17 13:06:19 +02:00
## Installation
2019-04-11 17:40:04 +02:00
2021-10-17 13:06:19 +02:00
### Cargo
2021-10-14 10:32:24 +02:00
2021-10-24 17:16:49 +02:00
**Only nightly Rust supported at the moment**.
2021-10-14 10:32:24 +02:00
```console
$ cargo install --git https://github.com/MalteT/mensa
```
2021-10-17 13:06:19 +02:00
### Nix
2021-10-14 10:32:24 +02:00
2021-10-17 13:06:19 +02:00
This is a [Nix Flake](https://nixos.wiki/wiki/Flakes), add it
to your configuration or just test the application with:
2021-10-14 10:32:24 +02:00
```console
$ nix run github:MalteT/mensa
```
2019-04-11 17:41:30 +02:00
2021-10-19 16:10:59 +02:00
2021-10-17 13:06:19 +02:00
## Usage
2019-04-11 17:41:30 +02:00
2021-10-14 10:32:24 +02:00
See `mensa --help`.
2021-10-19 16:10:59 +02:00
- `mensa meals` will show meals served today for the default canteen
mentioned in the configuration.
If no such configuration exists, try `mensa meals --id 63`.
2021-10-14 12:23:52 +02:00
You can find the id for your canteen using
2021-10-17 13:06:19 +02:00
- `mensa canteens` lists canteens near you based on your current
IP in a default radius of 10km.
2021-10-14 10:32:24 +02:00
- `mensa tags` will list the currently known meal tags like "**12** Nuts".
2021-10-27 13:53:04 +02:00
### Examples
####
<details>
<summary><b>Meals on monday</b> (<i>Click me!</i>)</summary>
You can omit the `-i/--id` if you've configured a default id in the config.toml.
```console
$ mensa meals -d mon -i 63
Leipzig, Mensa am Park
┊ ╭───╴Bohnengemüse
┊ ├─╴Gemüsebeilage 🌱
┊ ╰╴( 0.55€ )
...
```
</details>
<details>
<summary><b>Canteens near your location</b> (<i>Click me!</i>)</summary>
```console
$ mensa canteens
70 Leipzig, Cafeteria Dittrichring
Dittrichring 21, 04109 Leipzig
63 Leipzig, Mensa am Park
Universitätsstraße 5, 04109 Leipzig
...
```
</details>
<details>
<summary><b>All currently known tags</b> (<i>Click me!</i>)</summary>
```console
$ mensa tags
0 Acidifier
Contains artificial acidifier
1 Alcohol
Contains alcohol
2 Antioxidant
Contains an antioxidant
...
```
</details>
<details>
<summary><b>Meals of canteens close to your location next sunday</b> (<i>Click me!</i>)</summary>
```console
$ mensa meals close --date sun
Leipzig, Cafeteria Dittrichring
┊ ╭───╴Vegetarisch gefüllte Zucchini
┊ ├─╴Vegetarisches Gericht 🧀
┊ ├╴Rucola-Kartoffelpüree
┊ ├╴Tomaten-Ratatouille-Soße
┊ ╰╴( 2.65€ ) 2 11 12 19
Leipzig, Mensa am Park
┊ ╭───╴Apfelrotkohl
┊ ├─╴Gemüsebeilage 🌱
┊ ╰╴( 0.55€ ) 2
...
```
</details>
<details>
<summary><b>Count OpenMensa's canteens</b> (<i>Click me!</i>)</summary>
```console
$ mensa canteens --all --json | jq '.[].id' | wc -l
704
```
</details>
## Configuration *(Optional)*
2019-04-11 17:40:04 +02:00
2021-10-14 10:32:24 +02:00
See [config.toml](config.toml) for an example. Copy the file to:
- `$XDG_CONFIG_DIR/mensa/config.toml` on **Linux**,
- `$HOME/Library/Application Support/mensa/config.toml` on **macOS**,
2021-10-19 16:10:59 +02:00
- `{FOLDERID_RoamingAppData}\mensa\config.toml` on **Windows**
2021-10-17 13:06:19 +02:00
2021-10-20 10:39:13 +02:00
License: MIT