@smbcloud / cli / commits / a5e76f0

init project if needed

Seto committed Oct 10, 2025 at 10:50 UTC a5e76f019aeff56d7175f57d9989ffd2ae4f3631
4 files changed +14 -5
crates/cli/src/main.rs
+1 -1
@@ -129,7 +129,7 @@ async fn run() -> Result<CommandResult> {
129
130 match cli.command {
131 Some(Commands::Me {}) => process_me(cli.environment).await,
132 - Some(Commands::Init {}) => process_project_init(cli.environment).await,
132 + Some(Commands::Init {}) => process_project_init(cli.environment, true).await,
133 Some(Commands::Deploy {}) => process_deploy(cli.environment).await,
134 Some(Commands::Account { command }) => process_account(cli.environment, command).await,
135 Some(Commands::Login {}) => process_login(cli.environment, None).await,
crates/cli/src/project/cli.rs
+5 -1
@@ -3,7 +3,11 @@ use clap::Subcommand;
3 #[derive(Subcommand)]
4 pub enum Commands {
5 #[clap(about = "Add new project.")]
6 - New {},
6 + New {
7 + /// No init project by default. If this flag exist, we'll init the project.
8 + #[clap(short, long, required = false)]
9 + init: bool,
10 + },
11
12 #[clap(about = "List all your projects.")]
13 List {},
crates/cli/src/project/crud_create.rs
+7 -2
@@ -13,7 +13,10 @@ use smbcloud_network::environment::Environment;
13 use smbcloud_networking_project::crud_project_create::create_project;
14 use spinners::Spinner;
15
16 -pub async fn process_project_init(env: Environment) -> Result<CommandResult> {
16 +pub async fn process_project_init(
17 + env: Environment,
18 + should_init_project: bool,
19 +) -> Result<CommandResult> {
20 let is_logged_in = is_logged_in(env).await?;
21 if !is_logged_in {
22 let _ = process_login(env, Some(is_logged_in)).await;
@@ -47,7 +50,9 @@ pub async fn process_project_init(env: Environment) -> Result<CommandResult> {
50 }
51 };
52
50 - setup_smb_folder(&project_name, &description).await?;
53 + if should_init_project {
54 + setup_smb_folder(&project_name, &description).await?;
55 + }
56
57 let spinner = Spinner::new(
58 spinners::Spinners::SimpleDotsScrolling,
crates/cli/src/project/process.rs
+1 -1
@@ -14,7 +14,7 @@ use smbcloud_network::environment::Environment;
14
15 pub async fn process_project(env: Environment, commands: Commands) -> Result<CommandResult> {
16 match commands {
17 - Commands::New {} => process_project_init(env).await,
17 + Commands::New { init } => process_project_init(env, init).await,
18 Commands::List {} => process_project_list(env).await,
19 Commands::Show { id } => process_project_show(env, id).await,
20 Commands::Delete { id } => process_project_delete(env, id).await,