1use crate::{account, project};
2use clap::{Parser, Subcommand};
3use smbcloud_networking::environment::Environment;
4use spinners::Spinner;
5
6pub struct CommandResult {
7 pub spinner: Spinner,
8 pub symbol: String,
9 pub msg: String,
10}
11
12impl CommandResult {
13 pub fn stop_and_persist(mut self) {
14 self.spinner.stop_and_persist(&self.symbol, self.msg);
15 }
16}
17
18#[derive(Parser)]
19#[clap(author, version, about)]
20pub struct Cli {
21 #[arg(short, long, env = "ENVIRONMENT", default_value = "production")]
23 pub environment: Environment,
24
25 #[clap(short, long, global = true)]
27 pub log_level: Option<String>,
28
29 #[clap(subcommand)]
30 pub command: Commands,
31}
32
33#[derive(Subcommand)]
34pub enum Commands {
35 #[clap(about = "Manage your account.")]
36 Account {
37 #[clap(subcommand)]
38 command: account::cli::Commands,
39 },
40
41 #[clap(about = "Login to your account.")]
42 Login {},
43
44 #[clap(about = "Logout from your account.")]
45 Logout {},
46
47 #[clap(about = "Manage your projects. Add, delete, edit. Need authentication.")]
48 Project {
49 #[clap(subcommand)]
50 command: project::cli::Commands,
51 },
52
53 #[clap(about = "Initialize project. Requires an smbCloud account.")]
54 Init {},
55
56 #[clap(about = "Deploy project. It will use deploy.sh script in the .smb folder.")]
57 Deploy {},
58}