Skip to main content

claude_code/commands/
update.rs

1use std::time::Duration;
2
3use super::command::ClaudeCommandRequest;
4
5#[derive(Debug, Clone)]
6pub struct ClaudeUpdateRequest {
7    timeout: Option<Duration>,
8}
9
10impl ClaudeUpdateRequest {
11    pub fn new() -> Self {
12        Self { timeout: None }
13    }
14
15    pub fn timeout(mut self, timeout: Duration) -> Self {
16        self.timeout = Some(timeout);
17        self
18    }
19
20    pub fn into_command(self) -> ClaudeCommandRequest {
21        let mut cmd = ClaudeCommandRequest::new(["update"]);
22        if let Some(timeout) = self.timeout {
23            cmd = cmd.timeout(timeout);
24        }
25        cmd
26    }
27}
28
29impl Default for ClaudeUpdateRequest {
30    fn default() -> Self {
31        Self::new()
32    }
33}