main.rs
1 use ratatui::{ 2 crossterm::event::{self, Event, KeyCode}, 3 widgets::{Block, Paragraph}, 4 }; 5 6 fn main() -> anyhow::Result<()> { 7 ratatui::run(|terminal| { 8 let mut exit = false; 9 while !exit { 10 terminal.draw(|frame| { 11 let block = Block::bordered().title("Diff of Services"); 12 let greeting = Paragraph::new("Hello, world!\nPress 'q' to exit.") 13 .centered() 14 .block(block); 15 frame.render_widget(greeting, frame.area()); 16 })?; 17 18 match event::read()? { 19 Event::Key(key) => match key.code { 20 KeyCode::Char('q') => exit = true, 21 _ => {} 22 }, 23 _ => {} 24 } 25 } 26 27 Ok(()) 28 }) 29 }