pub trait CodexCommand: Send + Sync {
type Output: Send;
// Required methods
fn args(&self) -> Vec<String>;
fn execute(
&self,
codex: &Codex,
) -> impl Future<Output = Result<Self::Output>> + Send;
// Provided method
fn to_command_string(&self, codex: &Codex) -> String { ... }
}Expand description
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn to_command_string(&self, codex: &Codex) -> String
fn to_command_string(&self, codex: &Codex) -> String
Render the exact command line this builder will spawn, quoted for a POSIX shell.
Useful for logging a reproduction or checking an invocation before running it. The client’s global args precede the command’s own, the same order the spawn uses, because both go through one assembly function: the preview cannot drift from what runs.
use codex_wrapper::{Codex, CodexCommand, ExecCommand};
let codex = Codex::builder().build()?;
let cmd = ExecCommand::new("fix the failing tests").ephemeral();
println!("{}", cmd.to_command_string(&codex));
// codex exec --ephemeral 'fix the failing tests'The rendering is for humans. It is faithful to the argv, but the args are passed to the process directly rather than through a shell, so a shell is never involved at spawn time.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".