Skip to content

Commit b4644c7

Browse files
Davieysassman
authored andcommitted
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) <email@daviey.com>
1 parent 9ba1873 commit b4644c7

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

77
## 🎯 [Unreleased]
8+
### Added
9+
- Quiet (-q|--quiet) mode to suppress Ctrl+D banner: 'Press Ctrl+D to end recording' [pull/39]
810

911
## [0.4.2] - 2021-01-04
1012
### Added
@@ -108,4 +110,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
108110
- Generating a gif out of n frames of a recording
109111
- CI pipeline as GitHub Actions workflow
110112

111-
[issue/4]: https://github.com/sassman/t-rec-rs/issues/4
113+
[issue/4]: https://github.com/sassman/t-rec-rs/issues/4

src/cli.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,13 @@ pub fn launch<'a>() -> ArgMatches<'a> {
1414
.required(false)
1515
.help("Enable verbose insights for the curious.")
1616
)
17+
.arg(Arg::with_name("quiet")
18+
.takes_value(false)
19+
.short("q")
20+
.long("quiet")
21+
.required(false)
22+
.help("Quiet mode, suppresses the banner: 'Press Ctrl+D to end recording'")
23+
)
1724
.arg(
1825
Arg::with_name("decor")
1926
.takes_value(true)

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,11 @@ fn main() -> Result<()> {
105105
println!("Recording window id: {}", win_id);
106106
}
107107
}
108-
println!("Press Ctrl+D to end recording");
108+
if args.is_present("quiet") {
109+
println!();
110+
} else {
111+
println!("Press Ctrl+D to end recording");
112+
}
109113
thread::sleep(Duration::from_millis(1250));
110114
clear_screen();
111115

0 commit comments

Comments
 (0)