MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / read_with_command

Function read_with_command

crates/opencode-tui/src/ui/clipboard.rs:111–126  ·  view source on GitHub ↗
(program: &str, args: &[&str])

Source from the content-addressed store, hash-verified

109}
110
111fn read_with_command(program: &str, args: &[&str]) -> anyhow::Result<String> {
112 let output = Command::new(program)
113 .args(args)
114 .output()
115 .with_context(|| format!("failed to execute clipboard read command: {program}"))?;
116
117 if !output.status.success() {
118 anyhow::bail!(
119 "clipboard read command `{}` failed with status {}",
120 program,
121 output.status
122 );
123 }
124
125 Ok(String::from_utf8_lossy(&output.stdout).to_string())
126}
127
128fn write_with_command(program: &str, args: &[&str], text: &str) -> anyhow::Result<()> {
129 let mut child = Command::new(program)

Callers 1

read_textMethod · 0.85

Calls 3

newFunction · 0.85
outputMethod · 0.80
successMethod · 0.45

Tested by

no test coverage detected