prompt
parent
d1c379c755
commit
f8f59c2de5
@ -0,0 +1,27 @@
|
||||
use crate::{error::Error, stdout_handle};
|
||||
use anyhow::Result;
|
||||
use windows::Win32::System::Console;
|
||||
|
||||
pub struct Prompt {
|
||||
s: String,
|
||||
}
|
||||
|
||||
impl Prompt {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
s: String::from("\x1b[32m>\x1b[0m "),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn print(&self) -> Result<()> {
|
||||
unsafe {
|
||||
Error::check(Console::WriteConsoleA(
|
||||
stdout_handle()?,
|
||||
self.s.as_bytes(),
|
||||
None,
|
||||
None,
|
||||
))?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue