Skip to main content

claude_code/commands/
setup_token.rs

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