|
|
@ -141,6 +141,16 @@ fn newline(stdout: HANDLE) -> Result<()> {
|
|
|
|
Ok(())
|
|
|
|
Ok(())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn eval(line: String) -> Result<()> {
|
|
|
|
|
|
|
|
if line == "pwd" {
|
|
|
|
|
|
|
|
let pb = std::env::current_dir()?;
|
|
|
|
|
|
|
|
println!("{}", pb.as_path().as_os_str().to_str().unwrap());
|
|
|
|
|
|
|
|
return Ok(());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
println!("{}", line);
|
|
|
|
|
|
|
|
Ok(())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
fn main() -> Result<()> {
|
|
|
|
match Log::file("C:\\Users\\JordanOrelli\\wash.log") {
|
|
|
|
match Log::file("C:\\Users\\JordanOrelli\\wash.log") {
|
|
|
|
Ok(f) => {
|
|
|
|
Ok(f) => {
|
|
|
@ -169,10 +179,8 @@ fn main() -> Result<()> {
|
|
|
|
|
|
|
|
|
|
|
|
if event.code == key::ENTER {
|
|
|
|
if event.code == key::ENTER {
|
|
|
|
newline(stdout)?;
|
|
|
|
newline(stdout)?;
|
|
|
|
line.print()?;
|
|
|
|
eval(line.pop())?;
|
|
|
|
newline(stdout)?;
|
|
|
|
|
|
|
|
prompt.print()?;
|
|
|
|
prompt.print()?;
|
|
|
|
line.clear();
|
|
|
|
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -187,7 +195,6 @@ fn main() -> Result<()> {
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
Error::check(Console::WriteConsoleA(stdout, text.as_bytes(), None, None))?;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let tail = format!("{} ", line.tail());
|
|
|
|
let tail = format!("{} ", line.tail());
|
|
|
|
let n = tail.chars().count();
|
|
|
|
|
|
|
|
unsafe {
|
|
|
|
unsafe {
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
Error::check(Console::WriteConsoleA(
|
|
|
|
stdout,
|
|
|
|
stdout,
|
|
|
|