Added a Clear Screen feature & build script.

This commit is contained in:
Maddox Werts 2024-06-25 12:10:42 -04:00
parent 016acf0ca0
commit 1abb54372f
2 changed files with 12 additions and 1 deletions

4
build.sh Executable file
View file

@ -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

View file

@ -1,6 +1,6 @@
// Libraries // Libraries
use crate::{board, card, manager}; use crate::{board, card, manager};
use std::{io, process::exit}; use std::{io::{self, Write}, process::exit};
// Constants // Constants
const COLOR_ERROR: &str = "\x1b[31m"; const COLOR_ERROR: &str = "\x1b[31m";
@ -318,11 +318,18 @@ impl<'a> Interface<'a> {
self.on = (self.manager.boards.len()-1) as u32; 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){ fn error(msg: &str){
println!("INTERFACE ERROR: {}", msg); println!("INTERFACE ERROR: {}", msg);
} }
pub fn run(&mut self) { pub fn run(&mut self) {
// Clearing the screen
Interface::clear();
// Based on the page do something // Based on the page do something
match self.page { match self.page {
0 => self.p_0(), 0 => self.p_0(),