parser complete
This commit is contained in:
commit
8ffd3b9aff
12 changed files with 1321 additions and 0 deletions
33
tui/main.rs
Normal file
33
tui/main.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
use crossterm::event::{self, Event, KeyCode, KeyEvent, KeyEventKind};
|
||||
use nix_json_parser::*;
|
||||
use ratatui::{
|
||||
DefaultTerminal, Frame,
|
||||
buffer::Buffer,
|
||||
layout::Rect,
|
||||
style::Stylize,
|
||||
symbols::border,
|
||||
text::{Line, Text},
|
||||
widgets::{Block, Paragraph, Widget},
|
||||
};
|
||||
use std::io::{self, stdin};
|
||||
|
||||
fn main() -> io::Result<()> {
|
||||
let mut terminal = ratatui::init();
|
||||
let app_result = Nous::default().run(&mut terminal);
|
||||
ratatui::restore();
|
||||
app_result
|
||||
}
|
||||
|
||||
#[derive(Default)]
|
||||
struct Nous {}
|
||||
|
||||
impl Nous {
|
||||
pub fn run(&mut self, terminal: &mut DefaultTerminal) -> io::Result<()> {
|
||||
let lines = stdin().lines();
|
||||
for line in lines.map_while(Result::ok) {
|
||||
let trim = line.trim_start_matches("@nix ");
|
||||
println!("{:?}", serde_json::from_str::<Actions>(trim).unwrap());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue