Skip to content

Commit b3d68a5

Browse files
authored
fix: project create (#2096)
1 parent 933cbe9 commit b3d68a5

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cargo-shuttle/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cargo-shuttle"
3-
version = "0.56.5"
3+
version = "0.56.6"
44
edition.workspace = true
55
license.workspace = true
66
repository.workspace = true

cargo-shuttle/src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ impl Shuttle {
212212
| Command::Certificate(..)
213213
| Command::Project(
214214
// ProjectCommand::List does not need to know which project we are in
215-
ProjectCommand::Create
216-
| ProjectCommand::Update(..)
215+
// ProjectCommand::Create is handled separately and will always make the POST call
216+
ProjectCommand::Update(..)
217217
| ProjectCommand::Status
218218
| ProjectCommand::Delete { .. }
219219
| ProjectCommand::Link
@@ -224,8 +224,7 @@ impl Shuttle {
224224
self.load_project(
225225
&args.project_args,
226226
matches!(args.cmd, Command::Project(ProjectCommand::Link)),
227-
// Only the deploy command should create a project if the provided name is not found in the project list.
228-
// (ProjectCommand::Create should always make the POST call since it's an upsert operation)
227+
// Only 'deploy' should create a project if the provided name is not found in the project list
229228
matches!(args.cmd, Command::Deploy(..)),
230229
)
231230
.await?;
@@ -290,7 +289,7 @@ impl Shuttle {
290289
} => self.delete_certificate(domain, yes).await,
291290
},
292291
Command::Project(cmd) => match cmd {
293-
ProjectCommand::Create => self.project_create().await,
292+
ProjectCommand::Create => self.project_create(args.project_args.name).await,
294293
ProjectCommand::Update(cmd) => match cmd {
295294
ProjectUpdateCommand::Name { new_name } => self.project_rename(new_name).await,
296295
},
@@ -1799,9 +1798,12 @@ impl Shuttle {
17991798
Ok(())
18001799
}
18011800

1802-
async fn project_create(&self) -> Result<()> {
1801+
async fn project_create(&self, name: Option<String>) -> Result<()> {
1802+
let Some(ref name) = name else {
1803+
bail!("Provide a project name with '--name <name>'");
1804+
};
1805+
18031806
let client = self.client.as_ref().unwrap();
1804-
let name = self.ctx.project_name();
18051807
let r = client.create_project(name).await?;
18061808

18071809
match self.output_mode {
@@ -1816,6 +1818,7 @@ impl Shuttle {
18161818

18171819
Ok(())
18181820
}
1821+
18191822
async fn project_rename(&self, name: String) -> Result<()> {
18201823
let client = self.client.as_ref().unwrap();
18211824

0 commit comments

Comments
 (0)