parser complete
This commit is contained in:
commit
8ffd3b9aff
12 changed files with 1321 additions and 0 deletions
14
tui/Cargo.toml
Normal file
14
tui/Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
|||
[package]
|
||||
name = "nous"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[[bin]]
|
||||
name = "nous"
|
||||
path = "./main.rs"
|
||||
|
||||
[dependencies]
|
||||
nix_json_parser = { path = "../parser" }
|
||||
color-eyre = "0.6.5"
|
||||
crossterm = "0.29.0"
|
||||
ratatui = "0.29.0"
|
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