Skip to content

Commit 85c21d3

Browse files
committed
simplify and just output message
1 parent 76d4922 commit 85c21d3

File tree

2 files changed

+5
-15
lines changed

2 files changed

+5
-15
lines changed

src/bin/main.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ fn main() -> Result<()> {
3333
utils::logging::init_logger(log::LevelFilter::Debug, std::ffi::OsStr::new("debug.log"))?;
3434
}
3535

36+
// Read from config file.
3637
let config_path = read_config(matches.value_of("config_location"))
3738
.context("Unable to access the given config file location.")?;
3839
let mut config: Config = create_or_get_config(&config_path)
@@ -58,7 +59,7 @@ fn main() -> Result<()> {
5859
canvas::Painter::init(widget_layout, &config, get_color_scheme(&matches, &config)?)?;
5960

6061
// Check if the current environment is in a terminal.
61-
if !check_if_terminal_and_wait() {
62+
if !check_if_terminal() {
6263
return Ok(());
6364
}
6465

@@ -114,7 +115,6 @@ fn main() -> Result<()> {
114115
enable_raw_mode()?;
115116

116117
let mut terminal = Terminal::new(CrosstermBackend::new(stdout_val))?;
117-
118118
terminal.clear()?;
119119
terminal.hide_cursor()?;
120120

src/lib.rs

+3-13
Original file line numberDiff line numberDiff line change
@@ -274,26 +274,16 @@ pub fn cleanup_terminal(
274274
Ok(())
275275
}
276276

277-
/// Check and report to the user if the current environment is not a terminal. If it isn't a terminal, wait
278-
/// for user input and return `false` if the caller should bail. Otherwise, return `true`.
279-
pub fn check_if_terminal_and_wait() -> bool {
277+
/// Check and report to the user if the current environment is not a terminal.
278+
pub fn check_if_terminal() -> bool {
280279
use crossterm::tty::IsTty;
281280

282281
let out = stdout();
283282
if !out.is_tty() {
284283
println!(
285284
"Warning: bottom is not being output to a terminal. Things might not work properly."
286285
);
287-
println!("Press Ctrl-c or input q to exit, or any other key to continue.");
288-
289-
match read().unwrap() {
290-
Event::Key(event) => match event.modifiers {
291-
KeyModifiers::NONE => !matches!(event.code, KeyCode::Char('q')),
292-
KeyModifiers::CONTROL => !matches!(event.code, KeyCode::Char('c')),
293-
_ => true,
294-
},
295-
_ => true,
296-
}
286+
false
297287
} else {
298288
true
299289
}

0 commit comments

Comments
 (0)