Skip to main content

CodexCommand

Trait CodexCommand 

Source
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

Trait implemented by all Codex CLI command builders.

args returns the CLI arguments the builder would pass to the codex binary. execute spawns the process and returns typed output.

Required Associated Types§

Source

type Output: Send

The type returned on success.

Required Methods§

Source

fn args(&self) -> Vec<String>

Build the argument list for this command.

Source

fn execute( &self, codex: &Codex, ) -> impl Future<Output = Result<Self::Output>> + Send

Execute the command against the given Codex client.

Provided Methods§

Source

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".

Implementors§

Source§

impl CodexCommand for ApplyCommand

Source§

impl CodexCommand for ArchiveCommand

Source§

impl CodexCommand for CompletionCommand

Source§

impl CodexCommand for DeleteCommand

Source§

impl CodexCommand for DoctorCommand

Source§

impl CodexCommand for ExecCommand

Source§

impl CodexCommand for ExecResumeCommand

Source§

impl CodexCommand for FeaturesDisableCommand

Source§

impl CodexCommand for FeaturesEnableCommand

Source§

impl CodexCommand for FeaturesListCommand

Source§

impl CodexCommand for ForkCommand

Source§

impl CodexCommand for LoginCommand

Source§

impl CodexCommand for LoginStatusCommand

Source§

impl CodexCommand for LogoutCommand

Source§

impl CodexCommand for McpAddCommand

Source§

impl CodexCommand for McpGetCommand

Source§

impl CodexCommand for McpListCommand

Source§

impl CodexCommand for McpLoginCommand

Source§

impl CodexCommand for McpLogoutCommand

Source§

impl CodexCommand for McpRemoveCommand

Source§

impl CodexCommand for McpServerCommand

Source§

impl CodexCommand for PluginAddCommand

Source§

impl CodexCommand for PluginListCommand

Source§

impl CodexCommand for PluginMarketplaceAddCommand

Source§

impl CodexCommand for PluginMarketplaceListCommand

Source§

impl CodexCommand for PluginMarketplaceRemoveCommand

Source§

impl CodexCommand for PluginMarketplaceUpgradeCommand

Source§

impl CodexCommand for PluginRemoveCommand

Source§

impl CodexCommand for RawCommand

Source§

impl CodexCommand for ResumeCommand

Source§

impl CodexCommand for ReviewCommand

Source§

impl CodexCommand for SandboxCommand

Source§

impl CodexCommand for UnarchiveCommand

Source§

impl CodexCommand for UpdateCommand

Source§

impl CodexCommand for VersionCommand