37 lines
1.0 KiB
Rust
37 lines
1.0 KiB
Rust
use crate::native_node::{node};
|
|
use vlogger::*;
|
|
use tokio::sync::mpsc;
|
|
use crate::core;
|
|
use std::io::{self, Write};
|
|
|
|
impl node::NativeNode {
|
|
pub async fn cli(command_sender: mpsc::Sender<node::NodeCommand>) {
|
|
loop {
|
|
print!("\n> ");
|
|
io::stdout().flush().unwrap();
|
|
let mut input = String::new();
|
|
match io::stdin().read_line(&mut input) {
|
|
Ok(_) => {
|
|
let input = input.trim();
|
|
if input.is_empty() {
|
|
continue ;
|
|
}
|
|
|
|
let parts: Vec<&str> = input.split_whitespace().collect();
|
|
let command = parts[0];
|
|
let args = &parts[1..];
|
|
|
|
match command {
|
|
_ => {
|
|
log!(ERROR, "Unkown command {command}");
|
|
continue;
|
|
}
|
|
}
|
|
},
|
|
Err(_) => {}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|