diff options
author | Aaditya Dhruv <[email protected]> | 2025-06-30 13:58:39 -0500 |
---|---|---|
committer | Aaditya Dhruv <[email protected]> | 2025-06-30 13:58:39 -0500 |
commit | 08256ef07b8b2c478111d34a4c2029b09257f6de (patch) | |
tree | fe864597dbb6d7d1d21ebdc85c0f5547edf63985 /src | |
parent | 82ec8a35a2034bc733f4693ed9b721eee0ff87f2 (diff) |
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index e7a11a9..7ccca1d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,24 @@ -fn main() { - println!("Hello, world!"); +use color_eyre::Result; +use crossterm::event::{self, Event}; +use ratatui::{DefaultTerminal, Frame}; + +fn main() -> Result<()> { + color_eyre::install()?; + let terminal = ratatui::init(); + let result = run(terminal); + ratatui::restore(); + result +} + +fn run(mut terminal: DefaultTerminal) -> Result<()> { + loop { + terminal.draw(render)?; + if matches!(event::read()?, Event::Key(_)) { + break Ok(()); + } + } +} + +fn render(frame: &mut Frame) { + frame.render_widget("hello world", frame.area()); } |