From 6ba2b71ebfb1af8c7435c8a966523ba1eb70b2a0 Mon Sep 17 00:00:00 2001 From: Erik Corry Date: Sat, 11 Jan 2025 19:25:44 +0100 Subject: [PATCH] fix: When used with `--quiet`, don't print a blank line on startup. (#210) * When used with `--quiet`, don't print a blank line on startup. * Fix empty if. --------- Co-authored-by: Erik Corry Co-authored-by: Sven Kanoldt --- src/main.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 323e924..e78649c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -33,6 +33,7 @@ use anyhow::{bail, Context}; use clap::ArgMatches; use image::FlatSamples; use std::borrow::Borrow; +use std::io::{self, Write}; use std::sync::{mpsc, Arc, Mutex}; use std::time::{Duration, Instant}; use std::{env, thread}; @@ -108,6 +109,7 @@ fn main() -> Result<()> { let interact = thread::spawn(move || -> Result<()> { sub_shell_thread(&program).map(|_| ()) }); clear_screen(); + io::stdout().flush().unwrap(); if args.get_flag("verbose") { println!( "Frame cache dir: {:?}", @@ -119,9 +121,7 @@ fn main() -> Result<()> { println!("Recording window id: {}", win_id); } } - if args.get_flag("quiet") { - println!(); - } else { + if !args.get_flag("quiet") { println!("[t-rec]: Press Ctrl+D to end recording"); } thread::sleep(Duration::from_millis(1250));