mirror of
https://github.com/MalteT/mensa.git
synced 2024-10-22 21:59:17 +02:00
Add some usage examples
This commit is contained in:
parent
100c9eabe8
commit
13ed33f51f
86
README.md
86
README.md
|
@ -55,8 +55,92 @@ See `mensa --help`.
|
|||
IP in a default radius of 10km.
|
||||
- `mensa tags` will list the currently known meal tags like "**12** Nuts".
|
||||
|
||||
### Examples
|
||||
|
||||
## Configuration
|
||||
####
|
||||
<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)*
|
||||
|
||||
See [config.toml](config.toml) for an example. Copy the file to:
|
||||
- `$XDG_CONFIG_DIR/mensa/config.toml` on **Linux**,
|
||||
|
|
2
src/cache/mod.rs
vendored
2
src/cache/mod.rs
vendored
|
@ -103,7 +103,7 @@ where
|
|||
/// List all cache entries.
|
||||
fn list(&self) -> Result<Vec<Metadata>>;
|
||||
|
||||
/// Wrapper around [`fetch`] for responses that contain json.
|
||||
/// Wrapper around [`Cache::fetch`] for responses that contain json.
|
||||
fn fetch_json<S, T>(&self, url: S, local_ttl: Duration) -> Result<T>
|
||||
where
|
||||
S: AsRef<str>,
|
||||
|
|
86
src/main.rs
86
src/main.rs
|
@ -55,8 +55,92 @@
|
|||
//! IP in a default radius of 10km.
|
||||
//! - `mensa tags` will list the currently known meal tags like "**12** Nuts".
|
||||
//!
|
||||
//! ### Examples
|
||||
//!
|
||||
//! ## Configuration
|
||||
//! ####
|
||||
//! <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)*
|
||||
//!
|
||||
//! See [config.toml](config.toml) for an example. Copy the file to:
|
||||
//! - `$XDG_CONFIG_DIR/mensa/config.toml` on **Linux**,
|
||||
|
|
|
@ -23,7 +23,7 @@ pub struct Headers {
|
|||
pub last_page: Option<usize>,
|
||||
}
|
||||
|
||||
/// A subset of a Response, derived from [`reqwest::Response`].
|
||||
/// A subset of a Response, derived from [`::reqwest::Response`].
|
||||
pub struct Response<'url> {
|
||||
pub url: &'url str,
|
||||
pub status: StatusCode,
|
||||
|
|
Loading…
Reference in a new issue