Skip to content

Commit

Permalink
Add Quiet (-q|--quiet) to suppress Ctrl+D banner
Browse files Browse the repository at this point in the history
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) <[email protected]>
  • Loading branch information
Daviey authored and sassman committed Jan 5, 2021
1 parent 9ba1873 commit b4644c7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
[issue/4]: https://github.com/sassman/t-rec-rs/issues/4
7 changes: 7 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down

0 comments on commit b4644c7

Please sign in to comment.