ratatui / ratatui-website

Ratatui Documentation
http://ratatui.rs/
MIT License
100 stars 73 forks source link

Change `anyhow` to `color_eyre` in all tutorials #192

Open kdheepak opened 10 months ago

kdheepak commented 10 months ago

Currently the tutorials start off using anyhow and switch to using color_eyre, something I did in all my projects while I was writing some of the tutorial material. If I were to write them from scratch, I'd start off using color_eyre to begin with.

KekmaTime commented 10 months ago

@kdheepak i would like to work on this issue can you assign me this

kdheepak commented 10 months ago

Awesome! Thanks for offering to work on this! Let us know if you have any questions!

joshka commented 10 months ago

See https://github.com/ratatui-org/website/pull/229 for some details on this. Also, I'm gradually rewriting the existing counter app tutorials in https://github.com/ratatui-org/website/pull/209, which covers color_eyre in the second part, so those will all end up having color_eyre installed as the next one builds on top of it etc.

Hello world shouldn't have color_eyre as it should be as simple as possible. So that really leaves the JSON tutorial

KekmaTime commented 10 months ago

@kdheepak https://github.com/ratatui-org/website/pull/240

mccartney commented 7 months ago

Is there anything to be done after #240 is merged?

kdheepak commented 7 months ago

There's still a number of places anyhow is mentioned or used.

$ rg anyhow
code/the-elm-architecture/src/main.rs
4:// cargo add anyhow crossterm ratatui

src/content/docs/how-to/develop-apps/config-directories.md
44:use anyhow::{anyhow, Context, Result};
53:return Err(anyhow!("Unable to find data directory for ratatui-template"));
64:return Err(anyhow!("Unable to find config directory for ratatui-template"));

src/content/docs/tutorials/counter-app/multiple-functions.md
39:If you use the popular [`anyhow`](https://docs.rs/anyhow/latest/anyhow/) then instead of these two
47:you can simply import `Result` from `anyhow`:
50:use anyhow::Result;
53:You will need to run `cargo add anyhow` for this to work.
222:use anyhow::Result;

src/content/docs/tutorials/counter-async-app/sync-increment-decrement.md
82:use anyhow::Result;

src/content/docs/tutorials/counter-async-app/async-increment-decrement.md
12:use anyhow::Result;

src/content/docs/concepts/application-patterns/component-architecture.md
40:use anyhow::Result;

src/content/docs/tutorials/counter-app/index.md
24:cargo add ratatui crossterm anyhow
29:We opt to use the `anyhow` crate for easier error handling; it is not necessary to build apps with

src/content/docs/tutorials/counter-app/multiple-files/index.md
33:We are going to use `anyhow` in this section of the tutorial.
36:cargo add anyhow
41:Instead of `anyhow` you can also use [`eyre`](https://github.com/eyre-rs/eyre) or
45:- use anyhow::Result;
49:You'll need to add `color-eyre` and remove `anyhow`:
52:cargo remove anyhow

src/content/docs/templates/component/tui-rs.md
55:use color_eyre::eyre::{anyhow, Context, Result};

But I believe this PR will address most of it: https://github.com/ratatui-org/website/pull/209/

Anything not addressed by that PR, i.e. anything not in the counter tutorial, will have to be addressed separately.

KekmaTime commented 7 months ago

There's still a number of places anyhow is mentioned or used.

$ rg anyhow
code/the-elm-architecture/src/main.rs
4:// cargo add anyhow crossterm ratatui

src/content/docs/how-to/develop-apps/config-directories.md
44:use anyhow::{anyhow, Context, Result};
53:return Err(anyhow!("Unable to find data directory for ratatui-template"));
64:return Err(anyhow!("Unable to find config directory for ratatui-template"));

src/content/docs/tutorials/counter-app/multiple-functions.md
39:If you use the popular [`anyhow`](https://docs.rs/anyhow/latest/anyhow/) then instead of these two
47:you can simply import `Result` from `anyhow`:
50:use anyhow::Result;
53:You will need to run `cargo add anyhow` for this to work.
222:use anyhow::Result;

src/content/docs/tutorials/counter-async-app/sync-increment-decrement.md
82:use anyhow::Result;

src/content/docs/tutorials/counter-async-app/async-increment-decrement.md
12:use anyhow::Result;

src/content/docs/concepts/application-patterns/component-architecture.md
40:use anyhow::Result;

src/content/docs/tutorials/counter-app/index.md
24:cargo add ratatui crossterm anyhow
29:We opt to use the `anyhow` crate for easier error handling; it is not necessary to build apps with

src/content/docs/tutorials/counter-app/multiple-files/index.md
33:We are going to use `anyhow` in this section of the tutorial.
36:cargo add anyhow
41:Instead of `anyhow` you can also use [`eyre`](https://github.com/eyre-rs/eyre) or
45:- use anyhow::Result;
49:You'll need to add `color-eyre` and remove `anyhow`:
52:cargo remove anyhow

src/content/docs/templates/component/tui-rs.md
55:use color_eyre::eyre::{anyhow, Context, Result};

But I believe this PR will address most of it: #209

Anything not addressed by that PR, i.e. anything not in the counter tutorial, will have to be addressed separately. @kdheepak can i work on this again?

KekmaTime commented 6 months ago

@kdheepak i've made a few changes but i might need your help in this

joshka commented 6 months ago

@kdheepak i've made a few changes but i might need your help in this

Feel free to post a WIP PR.

Edit: just saw https://github.com/ratatui-org/ratatui-website/pull/546