use clap::Subcommand;
use super::{AuthFlow, CLAUDE_AUTH_FLOWS, CODEX_AUTH_FLOWS, auth_flow_parser};
#[derive(Debug, Subcommand)]
pub enum AuthOp {
Claude {
#[arg(long)]
code: Option<String>,
#[arg(long, value_parser = auth_flow_parser(&CLAUDE_AUTH_FLOWS), default_value = "auto")]
flow: AuthFlow,
#[arg(long)]
mode: Option<String>,
#[command(flatten)]
target: AuthTarget,
},
Codex {
#[arg(long, value_parser = auth_flow_parser(&CODEX_AUTH_FLOWS), default_value = "auto")]
flow: AuthFlow,
#[arg(long, default_value_t = 1455)]
port: u16,
#[command(flatten)]
target: AuthTarget,
},
Gh {
#[arg(long, value_name = "DIR")]
from_gh_config: Option<String>,
#[arg(long, conflicts_with = "from_gh_config")]
token_stdin: bool,
#[arg(long, conflicts_with_all = ["from_gh_config", "token_stdin"])]
status: bool,
},
Status {
#[command(flatten)]
target: AuthTarget,
},
}
#[derive(Debug, Clone, Default, clap::Args)]
pub struct AuthTarget {
#[arg(long, conflicts_with = "server")]
pub local: bool,
#[arg(long, value_name = "URL", conflicts_with = "local")]
pub server: Option<String>,
#[arg(long, conflicts_with_all = ["local", "server"])]
pub managed: bool,
}
#[derive(Debug, Subcommand)]
pub enum TlsOp {
Ca,
Generate {
#[arg(long, value_name = "NAMES", default_value = "localhost")]
dns: String,
},
}