Compare commits
No commits in common. "88e3f8c3be801f6eef243d5325bb8a54c43d46e5" and "070e8257037a43a167439a1cba981d8e6d108db7" have entirely different histories.
88e3f8c3be
...
070e825703
@ -1,15 +1,11 @@
|
|||||||
fn escape(s: String) -> String {
|
fn escape(s: String) -> String {
|
||||||
format!("\x1b[{}", s)
|
format!("\x1b[{}m", s)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn reset() -> String {
|
pub fn reset() -> String {
|
||||||
escape("0m".to_string())
|
escape("0".to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn color(r: u8, g: u8, b: u8) -> String {
|
pub fn color(r: u8, g: u8, b: u8) -> String {
|
||||||
escape(format!("38;2;{};{};{}m", r, g, b))
|
escape(format!("38;2;{};{};{}", r, g, b))
|
||||||
}
|
|
||||||
|
|
||||||
pub fn cursor_up(lines: u32) -> String {
|
|
||||||
escape(format!("{}A", lines))
|
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
use std::thread::sleep;
|
use std::thread::sleep;
|
||||||
use std::time;
|
use std::time;
|
||||||
use fuedra_schwitzt::cpuusagebuffer::CpuUsageBuffer;
|
use fuedra_schwitzt::cpuusagebuffer::CpuUsageBuffer;
|
||||||
use fuedra_schwitzt::ansiiescape::cursor_up;
|
|
||||||
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
@ -13,12 +12,12 @@ fn main() {
|
|||||||
// Print buffer
|
// Print buffer
|
||||||
print!("{}", buffer.braille());
|
print!("{}", buffer.braille());
|
||||||
|
|
||||||
loop {
|
for _ in 0..100 {
|
||||||
// Push new cpu usage stats
|
// Push new cpu usage stats
|
||||||
buffer.push();
|
buffer.push();
|
||||||
|
|
||||||
// Reset paint area
|
// Reset paint area
|
||||||
print!("{}", cursor_up(buffer.cpu_num().try_into().unwrap()));
|
print!("\x1b[{}A", buffer.cpu_num());
|
||||||
// Print buffer
|
// Print buffer
|
||||||
print!("{}", buffer.braille());
|
print!("{}", buffer.braille());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user