use clap::{Parser, Subcommand, ValueEnum};
mod apps;
mod balancers;
mod databases;
mod domains;
mod firewall;
mod images;
mod kubernetes;
mod network;
mod projects;
mod registry;
mod s3;
mod servers;
mod settings;
mod ssh;
pub use apps::AppsCommands;
pub use balancers::BalancerCommands;
pub use databases::DatabaseCommands;
pub use domains::DomainCommands;
pub use firewall::FirewallCommands;
pub use images::ImageCommands;
pub use kubernetes::KubernetesCommands;
pub use network::{IpCommands, VpcCommands};
pub use projects::ProjectCommands;
pub use registry::RegistryCommands;
pub use s3::S3Commands;
pub use servers::ServerCommands;
pub use settings::{AccountCommands, AuthCommands, ConfigCommands};
pub use ssh::SshCommands;
#[derive(ValueEnum, Clone, Copy, Debug)]
pub enum LangArg {
En,
Ru
}
#[derive(ValueEnum, Clone, Copy, Debug)]
pub enum ShellArg {
Bash,
Zsh,
Fish,
Powershell,
Elvish,
Nushell
}
#[derive(Parser, Debug)]
#[command(
name = "twc-rs",
version,
about = "Timeweb Cloud CLI — manage servers, SSH keys, and projects"
)]
pub struct Cli {
#[arg(
short,
long,
global = true,
default_value = "table",
env = "TWC_OUTPUT"
)]
pub format: String,
#[arg(short, long, global = true, env = "TWC_TOKEN")]
pub token: Option<String>,
#[arg(long, global = true, env = "TWC_PROFILE")]
pub profile: Option<String>,
#[command(subcommand)]
pub command: Commands
}
#[derive(Subcommand, Debug)]
pub enum Commands {
#[command(subcommand)]
Server(ServerCommands),
#[command(subcommand)]
Ssh(SshCommands),
#[command(subcommand)]
Project(ProjectCommands),
#[command(subcommand)]
Database(DatabaseCommands),
#[command(subcommand)]
S3(S3Commands),
#[command(subcommand)]
Kubernetes(KubernetesCommands),
#[command(subcommand)]
Registry(RegistryCommands),
#[command(subcommand)]
Balancer(BalancerCommands),
#[command(subcommand)]
Domain(DomainCommands),
#[command(subcommand)]
Firewall(FirewallCommands),
#[command(subcommand)]
Apps(AppsCommands),
#[command(subcommand)]
Image(ImageCommands),
#[command(subcommand)]
Ip(IpCommands),
#[command(subcommand)]
Vpc(VpcCommands),
#[command(subcommand)]
Account(AccountCommands),
#[command(subcommand)]
Config(ConfigCommands),
#[command(subcommand)]
Auth(AuthCommands),
Dashboard {
#[arg(short, long, default_value_t = 5)]
interval: u64
},
Completions {
#[arg(value_enum)]
shell: ShellArg
}
}
#[cfg(test)]
mod tests;