summaryrefslogtreecommitdiff
path: root/src/term.rs
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-08-08 02:45:18 +0200
committermo8it <mo8it@proton.me>2024-08-08 02:45:18 +0200
commit8df66f79918168617da9709c0edcfeb3ca0e53c8 (patch)
tree8d80b2bd7d320e296c02d3e72f3cfdbf8d0f9de6 /src/term.rs
parent39580381fa9cd52cf8026ad0360e077ee25d1aa0 (diff)
Allow initialization in a workspace
Diffstat (limited to 'src/term.rs')
-rw-r--r--src/term.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/term.rs b/src/term.rs
new file mode 100644
index 0000000..e1ac3da
--- /dev/null
+++ b/src/term.rs
@@ -0,0 +1,12 @@
+use std::io::{self, BufRead, StdoutLock, Write};
+
+pub fn clear_terminal(stdout: &mut StdoutLock) -> io::Result<()> {
+ stdout.write_all(b"\x1b[H\x1b[2J\x1b[3J")
+}
+
+pub fn press_enter_prompt(stdout: &mut StdoutLock) -> io::Result<()> {
+ stdout.flush()?;
+ io::stdin().lock().read_until(b'\n', &mut Vec::new())?;
+ stdout.write_all(b"\n")?;
+ Ok(())
+}