codex_wrapper/command/
apply.rs1use crate::Codex;
5use crate::command::CodexCommand;
6use crate::error::Result;
7use crate::exec::{self, CommandOutput};
8
9#[derive(Debug, Clone)]
11pub struct ApplyCommand {
12 task_id: String,
13}
14
15impl ApplyCommand {
16 #[must_use]
18 pub fn new(task_id: impl Into<String>) -> Self {
19 Self {
20 task_id: task_id.into(),
21 }
22 }
23}
24
25impl CodexCommand for ApplyCommand {
26 type Output = CommandOutput;
27
28 fn args(&self) -> Vec<String> {
29 vec!["apply".into(), self.task_id.clone()]
30 }
31
32 async fn execute(&self, codex: &Codex) -> Result<CommandOutput> {
33 exec::run_codex(codex, self.args()).await
34 }
35}
36
37#[cfg(test)]
38mod tests {
39 use super::*;
40
41 #[test]
42 fn apply_args() {
43 let args = ApplyCommand::new("abc-123").args();
44 assert_eq!(args, vec!["apply", "abc-123"]);
45 }
46}