From 1abb54372fb4b8799e232bca633a4c3d3d69898c Mon Sep 17 00:00:00 2001 From: OBJNULL Date: Tue, 25 Jun 2024 12:10:42 -0400 Subject: [PATCH] Added a Clear Screen feature & build script. --- build.sh | 4 ++++ src/interface.rs | 9 ++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..d8350b3 --- /dev/null +++ b/build.sh @@ -0,0 +1,4 @@ +# This script builds the application WITHOUT using dependencies on the system! +# THE POWER OF DOCKER! +clear +docker run --rm -t -v "$PWD:/src:ro,z" -v "$PWD/build:/app:Z" tasky \ No newline at end of file diff --git a/src/interface.rs b/src/interface.rs index 8be6f77..0116fee 100644 --- a/src/interface.rs +++ b/src/interface.rs @@ -1,6 +1,6 @@ // Libraries use crate::{board, card, manager}; -use std::{io, process::exit}; +use std::{io::{self, Write}, process::exit}; // Constants const COLOR_ERROR: &str = "\x1b[31m"; @@ -318,11 +318,18 @@ impl<'a> Interface<'a> { self.on = (self.manager.boards.len()-1) as u32; } + fn clear(){ + println!("\x1B[2J\x1B[1;1H"); + io::stdout().flush().unwrap(); + } fn error(msg: &str){ println!("INTERFACE ERROR: {}", msg); } pub fn run(&mut self) { + // Clearing the screen + Interface::clear(); + // Based on the page do something match self.page { 0 => self.p_0(),