Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Fadeev <[email protected]>
  • Loading branch information
samuela and fadeevab committed Jan 17, 2024
1 parent 464b865 commit 84774bf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
7 changes: 4 additions & 3 deletions examples/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ use std::{thread, time::Duration};
use console::style;

fn main() -> std::io::Result<()> {
// Set a no-op Ctrl-C handler so that Ctrl-C results in a
// `term.read_key()` error instead of terminating the process. You can skip
// Set a no-op Ctrl-C handler so that Ctrl-C results in
// `Esc` behavior because of a `term.read_key()` error
// instead of terminating the process. You can skip
// this step if you have your own Ctrl-C handler already set up.
//
// We cannot (easily) handle this at the library level due to
// https://github.com/Detegr/rust-ctrlc/issues/106#issuecomment-1887793468.
ctrlc::set_handler(move || {}).expect("Error setting Ctrl-C handler");
ctrlc::set_handler(move || {}).expect("setting Ctrl-C handler");

cliclack::clear_screen()?;

Expand Down
9 changes: 2 additions & 7 deletions examples/basic_dynamic_items.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
use console::style;

fn main() -> std::io::Result<()> {
// Set a no-op Ctrl-C handler so that Ctrl-C results in a
// `term.read_key()` error instead of terminating the process. You can skip
// this step if you have your own Ctrl-C handler already set up.
//
// We cannot (easily) handle this at the library level due to
// https://github.com/Detegr/rust-ctrlc/issues/106#issuecomment-1887793468.
ctrlc::set_handler(move || {}).expect("Error setting Ctrl-C handler");
// Set a no-op Ctrl-C to make it behave as `Esc` (see the basic example).
ctrlc::set_handler(move || {}).expect("setting Ctrl-C handler");

cliclack::clear_screen()?;

Expand Down
9 changes: 2 additions & 7 deletions examples/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@ impl Theme for MagentaTheme {
}

fn main() -> std::io::Result<()> {
// Set a no-op Ctrl-C handler so that Ctrl-C results in a
// `term.read_key()` error instead of terminating the process. You can skip
// this step if you have your own Ctrl-C handler already set up.
//
// We cannot (easily) handle this at the library level due to
// https://github.com/Detegr/rust-ctrlc/issues/106#issuecomment-1887793468.
ctrlc::set_handler(move || {}).expect("Error setting Ctrl-C handler");
// Set a no-op Ctrl-C to make it behave as `Esc` (see the basic example).
ctrlc::set_handler(move || {}).expect("setting Ctrl-C handler");

set_theme(MagentaTheme);

Expand Down

0 comments on commit 84774bf

Please sign in to comment.