Skip to content

Commit 830f631

Browse files
feat: hide the cursor while running
1 parent f9cdf47 commit 830f631

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/main.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
use codspeed_runner::{clean_logger, cli};
2-
use console::style;
2+
use console::{Term, style};
33
use log::log_enabled;
44

5+
struct HiddenCursor(Term);
6+
7+
impl HiddenCursor {
8+
fn new() -> Self {
9+
let term = Term::stderr();
10+
let _ = term.hide_cursor();
11+
Self(term)
12+
}
13+
}
14+
15+
impl Drop for HiddenCursor {
16+
fn drop(&mut self) {
17+
let _ = self.0.show_cursor();
18+
}
19+
}
20+
521
#[tokio::main(flavor = "current_thread")]
622
async fn main() {
23+
let _cursor = HiddenCursor::new();
724
let res = cli::run().await;
825
if let Err(err) = res {
926
// Show the primary error

0 commit comments

Comments
 (0)