From f8de07846f52288f7f7562bc3de4688c3dc65a8d Mon Sep 17 00:00:00 2001 From: "Dave Walker (Daviey)" Date: Tue, 5 Jan 2021 17:25:12 +0000 Subject: [PATCH] Add Quiet (-q|--quiet) to suppress Ctrl+D banner Previously, all recordings would display, "Press Ctrl+D to end recording". This is helpful (& even desirable) on first usage. However, it is annoying to have the banner in all the recordings. This adds the ability to add -q|--quiet, which suppresses the banner making cleaner recordings. (An empty string is outputted as the application needs there to be something to begin recording) Signed-off-by: Dave Walker (Daviey) --- CHANGELOG.md | 4 +++- src/cli.rs | 7 +++++++ src/main.rs | 6 +++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2f4a2c..175caa6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## 🎯 [Unreleased] +### Added +- Quiet (-q|--quiet) mode to suppress Ctrl+D banner: 'Press Ctrl+D to end recording' [pull/39] ## [0.4.2] - 2021-01-04 ### Added @@ -108,4 +110,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Generating a gif out of n frames of a recording - CI pipeline as GitHub Actions workflow -[issue/4]: https://github.com/sassman/t-rec-rs/issues/4 \ No newline at end of file +[issue/4]: https://github.com/sassman/t-rec-rs/issues/4 diff --git a/src/cli.rs b/src/cli.rs index 95af31c..2fdf1c5 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -14,6 +14,13 @@ pub fn launch<'a>() -> ArgMatches<'a> { .required(false) .help("Enable verbose insights for the curious.") ) + .arg(Arg::with_name("quiet") + .takes_value(false) + .short("q") + .long("quiet") + .required(false) + .help("Quiet mode, suppresses the banner: 'Press Ctrl+D to end recording'") + ) .arg( Arg::with_name("decor") .takes_value(true) diff --git a/src/main.rs b/src/main.rs index 13c757e..6313109 100644 --- a/src/main.rs +++ b/src/main.rs @@ -105,7 +105,11 @@ fn main() -> Result<()> { println!("Recording window id: {}", win_id); } } - println!("Press Ctrl+D to end recording"); + if args.is_present("quiet") { + println!(); + } else { + println!("Press Ctrl+D to end recording"); + } thread::sleep(Duration::from_millis(1250)); clear_screen();