use rustkernel::handlers;
use rustkernel::Program;
use std::net::TcpListener;
fn main() {
let host: &str = "127.0.0.1:8787";
let listener = TcpListener::bind(host).expect("Could not start listener");
println!(
r"
-------------------------------------------------------------
-- Rustkernel - For VS Code Extension - Rustnote ------------
-------------------------------------------------------------
Rustkernel is running on {host}
The default path for your notes is ~/rustnote
Change the path in File > Preferences > Settings > 'rustnote'
--------------------------------------------------------------
-- Default Keybindings ---------------------------------------
--------------------------------------------------------------
alt+f: Search notes in VS Code, add rustnote path to workspace
alt+p: Preview notes as static website using mdBook
alt+o: Open main.rs to see what code is being generated
Change in File > Preferences > Keyboard Shortcuts > 'rustnote'
"
);
let mut program = Program::new();
for stream in listener.incoming() {
let stream = stream.expect("Could not iterate over stream");
handlers::code_request(stream, &mut program);
}
}