ratatui-org / ratatui

Rust library that's all about cooking up terminal user interfaces (TUIs) 👨‍🍳🐀
https://ratatui.rs
MIT License
8.82k stars 263 forks source link

chore(examples): simplify all examples #1189

Open joshka opened 2 weeks ago

joshka commented 2 weeks ago

In https://github.com/ratatui-org/ratatui/pull/1180 and https://github.com/ratatui-org/ratatui/pull/1181, we introduced some simpler ways to create a backend and terminal, and to setup color_eyre to handle errors. This PR updates the examples to use these new methods, and removes a bunch of unnecessary boilerplate code.

joshka commented 2 weeks ago

Note - panic example is not yet complete, and this probably needs a once over to check that I've not accidentally introduced bugs. This is still a WIP, but the key takeaway is that this drops about 900 lines of code from 41 example files.

codecov[bot] commented 2 weeks ago

Codecov Report

Attention: Patch coverage is 0% with 113 lines in your changes missing coverage. Please review.

Project coverage is 93.7%. Comparing base (4bfdc15) to head (37be39b). Report is 6 commits behind head on main.

Files Patch % Lines
src/backend/crossterm.rs 0.0% 101 Missing :warning:
src/backend.rs 0.0% 12 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1189 +/- ## ======================================= - Coverage 94.3% 93.7% -0.6% ======================================= Files 60 62 +2 Lines 14679 15036 +357 ======================================= + Hits 13843 14095 +252 - Misses 836 941 +105 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

joshka commented 2 weeks ago

Blocked on https://github.com/ratatui-org/ratatui/pull/1181