Skip to main content

codex_wrapper/command/
version.rs

1use crate::Codex;
2use crate::command::CodexCommand;
3use crate::error::Result;
4use crate::exec::{self, CommandOutput};
5
6#[derive(Debug, Clone, Default)]
7pub struct VersionCommand;
8
9impl VersionCommand {
10    #[must_use]
11    pub fn new() -> Self {
12        Self
13    }
14}
15
16impl CodexCommand for VersionCommand {
17    type Output = CommandOutput;
18
19    fn args(&self) -> Vec<String> {
20        vec!["--version".to_string()]
21    }
22
23    async fn execute(&self, codex: &Codex) -> Result<CommandOutput> {
24        exec::run_codex(codex, self.args()).await
25    }
26}
27
28#[cfg(test)]
29mod tests {
30    use super::*;
31
32    #[test]
33    fn version_args() {
34        assert_eq!(VersionCommand::new().args(), vec!["--version"]);
35    }
36}