Skip to content

Commit 3d2d149

Browse files
committed
dyt-cli: support --no-clipboard option to not clobber it
1 parent e5efb06 commit 3d2d149

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,14 @@ dyt --record
169169
dyt --record --daemon http://192.168.1.10:3030
170170
```
171171

172-
Output goes to both clipboard and stdout, so you can pipe it:
172+
By default, output goes to both clipboard and stdout, so you can pipe it:
173173

174174
```bash
175175
dyt --record | wc -w
176176
```
177177

178+
Copying to the clipboard can be suppressed with the `--no-clipboard` option.
179+
178180
### Smoke test
179181

180182
Verify your mic works without needing the daemon:

dyt-cli/src/main.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ struct Cli {
1313
/// Daemon address
1414
#[arg(long, default_value = "http://127.0.0.1:3030")]
1515
daemon: String,
16+
17+
/// Suppress copying text to the clipboard.
18+
#[arg(long)]
19+
no_clipboard: bool,
1620
}
1721

1822
fn main() -> Result<()> {
@@ -33,9 +37,11 @@ fn main() -> Result<()> {
3337
let text = transport::transcribe(&cli.daemon, &wav_bytes)?;
3438
eprintln!("Transcribed: {text}");
3539

36-
let mut clipboard = arboard::Clipboard::new()?;
37-
clipboard.set_text(&text)?;
38-
eprintln!("Copied to clipboard.");
40+
if !cli.no_clipboard {
41+
let mut clipboard = arboard::Clipboard::new()?;
42+
clipboard.set_text(&text)?;
43+
eprintln!("Copied to clipboard.");
44+
}
3945

4046
// Also print to stdout for piping
4147
print!("{text}");

0 commit comments

Comments
 (0)