codetether_agent/cli/
clipboard.rs1use anyhow::Result;
4use clap::{Parser, Subcommand};
5
6#[derive(Parser, Debug)]
8pub struct ClipboardArgs {
9 #[command(subcommand)]
11 pub command: ClipboardCommand,
12}
13
14#[derive(Subcommand, Debug)]
16pub enum ClipboardCommand {
17 Image(ClipboardImageArgs),
19}
20
21#[derive(Parser, Debug)]
23pub struct ClipboardImageArgs {
24 #[arg(long)]
26 pub print: bool,
27}
28
29pub fn execute(args: ClipboardArgs) -> Result<()> {
36 match args.command {
37 ClipboardCommand::Image(args) => image(args.print),
38 }
39}
40
41fn image(print: bool) -> Result<()> {
42 let image = crate::image_clipboard::capture_image()?;
43 if print {
44 println!("{}", image.data_url);
45 return Ok(());
46 }
47 crate::image_clipboard::copy_text(&image.data_url)?;
48 eprintln!("Copied image paste text. Paste it into the remote CodeTether TUI.");
49 Ok(())
50}