Skip to content

Commit

Permalink
fix: cargo-shuttle panic on the login command (#1302)
Browse files Browse the repository at this point in the history
* fix: cargo-shuttle panic on the login command

* bump version
  • Loading branch information
jonaro00 committed Oct 5, 2023
1 parent faaf9e8 commit bdbf92f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion cargo-shuttle/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "cargo-shuttle"
version = "0.28.0"
version = "0.28.1"
edition.workspace = true
license.workspace = true
repository.workspace = true
Expand Down
13 changes: 8 additions & 5 deletions cargo-shuttle/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,10 @@ impl Shuttle {
self.init(init_args, args.project_args, provided_path_to_init)
.await
}
Command::Generate { shell, output } => self.complete(shell, output).await,
Command::Generate { shell, output } => self.complete(shell, output),
Command::Login(login_args) => self.login(login_args).await,
Command::Logout(logout_args) => self.logout(logout_args).await,
Command::Feedback => self.feedback().await,
Command::Feedback => self.feedback(),
Command::Run(run_args) => self.local_run(run_args).await,
Command::Deploy(deploy_args) => self.deploy(deploy_args).await,
Command::Status => self.status().await,
Expand Down Expand Up @@ -498,7 +498,7 @@ impl Shuttle {
}

/// Provide feedback on GitHub.
async fn feedback(&self) -> Result<CommandOutcome> {
fn feedback(&self) -> Result<CommandOutcome> {
let _ = webbrowser::open(SHUTTLE_GH_ISSUE_URL);
println!("If your browser did not open automatically, go to {SHUTTLE_GH_ISSUE_URL}");

Expand All @@ -523,7 +523,10 @@ impl Shuttle {
let api_key = ApiKey::parse(&api_key_str)?;

self.ctx.set_api_key(api_key.clone())?;
self.client.as_mut().unwrap().set_api_key(api_key);

if let Some(client) = self.client.as_mut() {
client.set_api_key(api_key);
}

Ok(CommandOutcome::Ok)
}
Expand Down Expand Up @@ -582,7 +585,7 @@ impl Shuttle {
Ok(CommandOutcome::Ok)
}

async fn complete(&self, shell: Shell, output: Option<PathBuf>) -> Result<CommandOutcome> {
fn complete(&self, shell: Shell, output: Option<PathBuf>) -> Result<CommandOutcome> {
let name = env!("CARGO_PKG_NAME");
let mut app = Command::command();
match output {
Expand Down

0 comments on commit bdbf92f

Please sign in to comment.