1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//! CLI parser definition for `cargo ai auth`.
use clap::{Arg, ArgAction, Command};
/// Builds the `auth` command schema and nested subcommands.
pub fn command() -> Command {
Command::new("auth")
.about("Manage OpenAI account login state")
.subcommand(
Command::new("login")
.about("Authenticate via provider login")
.subcommand(
Command::new("openai")
.about("Login with an OpenAI account")
.arg(
Arg::new("profile")
.long("profile")
.help("Optional profile to mark as openai_account mode")
.required(false)
.value_name("NAME")
.num_args(1),
)
.arg(
Arg::new("set_default")
.long("set-default")
.help("Set --profile as the default profile")
.requires("profile")
.required(false)
.action(ArgAction::SetTrue),
),
),
)
.subcommand(
Command::new("status")
.about("Show OpenAI account-login session status")
.arg(
Arg::new("json")
.long("json")
.help("Print machine-readable JSON output")
.required(false)
.action(ArgAction::SetTrue),
),
)
.subcommand(
Command::new("logout")
.about("Log out of OpenAI for Cargo AI (local by default)")
.arg(
Arg::new("global")
.long("global")
.help("Also log out Codex/OpenAI session globally via `codex logout`")
.required(false)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("revoke")
.long("revoke")
.help("Deprecated alias for --global")
.required(false)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new("yes")
.long("yes")
.help("Skip interactive confirmation")
.required(false)
.action(ArgAction::SetTrue),
),
)
}