twc_rs/cli/settings.rs
1// SPDX-FileCopyrightText: 2026 RAprogramm <andrey.rozanov.vl@gmail.com>
2// SPDX-License-Identifier: MIT
3
4//! Config, auth and account subcommands.
5
6use clap::Subcommand;
7
8use super::LangArg;
9
10/// Configuration subcommands.
11#[derive(Subcommand, Debug)]
12pub enum ConfigCommands {
13 /// Show the current configuration.
14 Show,
15 /// Set the API token (for the default profile, or a named one).
16 SetToken {
17 /// The Timeweb Cloud API token.
18 #[arg(long)]
19 token: String,
20
21 /// Store the token under this profile name instead of the default.
22 #[arg(long)]
23 profile: Option<String>
24 },
25 /// List configured profile names.
26 Profiles,
27 /// Set the UI language (en or ru).
28 SetLanguage {
29 /// Language code.
30 #[arg(value_enum)]
31 language: LangArg
32 }
33}
34
35/// Authentication subcommands.
36#[derive(Subcommand, Debug)]
37pub enum AuthCommands {
38 /// Run the guided browser authentication flow.
39 Flow,
40 /// Show current authentication status.
41 Status,
42 /// Remove stored token from keyring and config.
43 Logout,
44 /// Accept a token directly (for CI/CD).
45 Token {
46 /// The API token to store.
47 #[arg(long)]
48 token: String
49 }
50}
51
52/// Account subcommands.
53#[derive(Subcommand, Debug)]
54pub enum AccountCommands {
55 /// Show account login, company and balance.
56 Show,
57 /// Show account auth access restrictions (IP/country allow lists).
58 Access
59}