diff --git a/src/bin/main.rs b/src/bin/main.rs index effe49136..975062ffd 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -33,6 +33,7 @@ fn main() -> Result<()> { utils::logging::init_logger(log::LevelFilter::Debug, std::ffi::OsStr::new("debug.log"))?; } + // Read from config file. let config_path = read_config(matches.value_of("config_location")) .context("Unable to access the given config file location.")?; let mut config: Config = create_or_get_config(&config_path) @@ -58,7 +59,7 @@ fn main() -> Result<()> { canvas::Painter::init(widget_layout, &config, get_color_scheme(&matches, &config)?)?; // Check if the current environment is in a terminal. - if !check_if_terminal_and_wait() { + if !check_if_terminal() { return Ok(()); } @@ -114,7 +115,6 @@ fn main() -> Result<()> { enable_raw_mode()?; let mut terminal = Terminal::new(CrosstermBackend::new(stdout_val))?; - terminal.clear()?; terminal.hide_cursor()?; diff --git a/src/lib.rs b/src/lib.rs index 6f0c83463..7e6b8ee7f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -274,9 +274,8 @@ pub fn cleanup_terminal( Ok(()) } -/// Check and report to the user if the current environment is not a terminal. If it isn't a terminal, wait -/// for user input and return `false` if the caller should bail. Otherwise, return `true`. -pub fn check_if_terminal_and_wait() -> bool { +/// Check and report to the user if the current environment is not a terminal. +pub fn check_if_terminal() -> bool { use crossterm::tty::IsTty; let out = stdout(); @@ -284,16 +283,7 @@ pub fn check_if_terminal_and_wait() -> bool { println!( "Warning: bottom is not being output to a terminal. Things might not work properly." ); - println!("Press Ctrl-c or input q to exit, or any other key to continue."); - - match read().unwrap() { - Event::Key(event) => match event.modifiers { - KeyModifiers::NONE => !matches!(event.code, KeyCode::Char('q')), - KeyModifiers::CONTROL => !matches!(event.code, KeyCode::Char('c')), - _ => true, - }, - _ => true, - } + false } else { true }